From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTP id 1A0A65A0082 for ; Fri, 24 Feb 2023 07:59:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677221982; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qYbPxVDjrUrvgSFs9PJ2UC1wfyfeC3NOG8PxYaCi4Z8=; b=V/Fph3MYt4kJhiQ3xAUVTZewwlaGy+Xlvw+NxKEzMetZtej297Vtfkpqi16z8JsLHbxHk9 r0i65w1jl4a+MSoOyiiGH7UFRUPGqzQm14duQEXsCeCvHAvVHQGVNvDyx8DWeTkQAiU9t1 XZxQC2JppKppp6iwPUx6lq3w2L1hgOM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-643-yvRaO2cDNseG5m1BElG2Vw-1; Fri, 24 Feb 2023 01:59:40 -0500 X-MC-Unique: yvRaO2cDNseG5m1BElG2Vw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 81557101A52E for ; Fri, 24 Feb 2023 06:59:40 +0000 (UTC) Received: from maya.cloud.tilaa.com (unknown [10.33.32.23]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3A87051FF; Fri, 24 Feb 2023 06:59:40 +0000 (UTC) Date: Fri, 24 Feb 2023 07:59:37 +0100 From: Stefano Brivio To: Andrea Bolognani Subject: Re: [PATCH] log: Send identifier string in log messages, openlog() won't work for us Message-ID: <20230224075937.01b6345d@elisabeth> In-Reply-To: References: <20230223173555.3896768-1-sbrivio@redhat.com> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: Z2WCZGG2SBDFESGC73QKAYHHEOETEKQW X-Message-ID-Hash: Z2WCZGG2SBDFESGC73QKAYHHEOETEKQW X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Thu, 23 Feb 2023 10:15:15 -0800 Andrea Bolognani wrote: > On Thu, Feb 23, 2023 at 06:35:55PM +0100, Stefano Brivio wrote: > > openlog() can be used to set "ident" and have all the log messages > > prefixed by it, but only if we call syslog() -- this is implemented > > by C libraries. > > > > We don't log messages with syslog(), though, as we have a custom > > implementation to ensure we don't need dynamic memory allocation. > > This means that it's perfectly useless to call openlog(), and that we > > have to prefix every message we log by the identifier on our own. > > > > Reported-by: Andrea Bolognani > > Signed-off-by: Stefano Brivio > > --- > > log.c | 12 +++++------- > > 1 file changed, 5 insertions(+), 7 deletions(-) > > With this patch applied, the entries I see in the journal after > starting a VM go from > > passt.avx2[519959]: No external routable interface for IPv6 > passt.avx2[519959]: Outbound interface (IPv4): enp5s0 > MAC[519959]: > host[519959]: xx:xx:xx:xx:xx:xx > DHCP[519959]: > assign[519959]: 192.168.1.62 > mask[519959]: 255.255.255.0 > router[519959]: 192.168.1.1 > DNS[519959]: > passt.avx2[519959]: 192.168.1.1 > passt.avx2[519959]: DNS search list: > passt.avx2[519959]: xxx > passt.avx2[519959]: UNIX domain socket bound at > /run/libvirt/qemu/passt/12-xxx-net0.socket > passt.avx2[519959]: You can now start qemu (>= 7.2, with commit > 13c6be96618c): > passt.avx2[519959]: kvm ... -device virtio-net-pci,netdev=s > -netdev stream,id=s,server=off,addr.type=unix,addr.path=/run/libvirt/qemu/passt/12-xxx-net0.socket > passt.avx2[519959]: or qrap, for earlier qemu versions: > passt.avx2[519959]: ./qrap 5 kvm ... -net socket,fd=5 -net > nic,model=virtio > passt.avx2[519960]: accepted connection from PID 0 > DHCP[519960]: ack to request > passt.avx2[519960]: from xx:xx:xx:xx:xx:xx > > to > > passt[523786]: No external routable interface for IPv6 > passt[523786]: Outbound interface (IPv4): enp5s0 > passt[523786]: MAC: > passt[523786]: host: xx:xx:xx:xx:xx:xx > passt[523786]: DHCP: > passt[523786]: assign: 192.168.1.62 > passt[523786]: mask: 255.255.255.0 > passt[523786]: router: 192.168.1.1 > passt[523786]: DNS: > passt[523786]: 192.168.1.1 > passt[523786]: DNS search list: > passt[523786]: xxx > passt[523786]: UNIX domain socket bound at > /run/libvirt/qemu/passt/13-xxx-net0.socket > passt[523786]: You can now start qemu (>= 7.2, with commit 13c6be96618c): > passt[523786]: kvm ... -device virtio-net-pci,netdev=s -netdev > stream,id=s,server=off,addr.type=unix,addr.path=/run/libvirt/qemu/passt/13-xxx-net0.socket > passt[523786]: or qrap, for earlier qemu versions: > passt[523786]: ./qrap 5 kvm ... -net socket,fd=5 -net nic,model=virtio > passt[523789]: accepted connection from PID 0 > passt[523789]: DHCP: ack to request > passt[523789]: from xx:xx:xx:xx:xx:xx > > which is clearly much better. > > Tested-by: Andrea Bolognani > Reviewed-by: Andrea Bolognani Thanks for the tests and review! > Note the change from passt.avx2 to passt. Looking at the process > listing, plain passt was used in both cases, so I assume that the > passt.avx2 mention is journald trying to fill in the blanks and > getting it wrong? Yes, it's your system logger filling in the blanks, but it didn't really get it wrong, as the process name is actually "passt.avx2" if the AVX2-enabled build starts. Look at this, cough cough, beauty in arch.c: https://passt.top/passt/tree/arch.c#n21 "passt.avx2" wasn't intended in any case. -- Stefano