Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B41CCE9A03B for ; Wed, 18 Feb 2026 09:39:27 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vse1H-0000QL-0f; Wed, 18 Feb 2026 04:38:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vse1F-0000PK-Mh for qemu-rust@nongnu.org; Wed, 18 Feb 2026 04:38:53 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vse1E-0005dD-4K for qemu-rust@nongnu.org; Wed, 18 Feb 2026 04:38:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771407530; 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=8FACGrT2kuAXrNVhN9C22rlNJMEUj7m0iCIiYMfnx7E=; b=cjrP0eg5UzhMCP2SIvvpdYZjaUcxcXwoUYA1joFu7BduOMYyCeSvwjCGq9Yl0fu+bFp2Vz uxPIv/sBPVzudBOkHX/081Wxb6N4t7R+VKQZsuZUv9Qv3+wazVYyGIcvy8xLoTlU0nCK1W 0Ld/hU3eb/8OLXsDu3MY6kls/NMNhP4= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-576-I0NIWcD1Mou9wU4oqgSZUA-1; Wed, 18 Feb 2026 04:38:47 -0500 X-MC-Unique: I0NIWcD1Mou9wU4oqgSZUA-1 X-Mimecast-MFC-AGG-ID: I0NIWcD1Mou9wU4oqgSZUA_1771407525 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 15D4E1933FA6; Wed, 18 Feb 2026 09:38:45 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.45.242.14]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3CA161800361; Wed, 18 Feb 2026 09:38:44 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id E6F7421E692D; Wed, 18 Feb 2026 10:38:41 +0100 (CET) From: Markus Armbruster To: Daniel P. =?utf-8?Q?Berrang=C3=A9?= Cc: qemu-devel@nongnu.org, Manos Pitsidianakis , Stefan Weil , "Dr. David Alan Gilbert" , Pierrick Bouvier , devel@lists.libvirt.org, Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , =?utf-8?Q?Marc-Andr?= =?utf-8?Q?=C3=A9?= Lureau , Hanna Reitz , Kevin Wolf , qemu-block@nongnu.org, qemu-rust@nongnu.org, Paolo Bonzini , Gerd Hoffmann , Christian Schoenebeck , Richard Henderson Subject: Re: [PATCH v6 11/27] util: introduce some API docs for logging APIs In-Reply-To: <20260211152508.732487-12-berrange@redhat.com> ("Daniel P. =?utf-8?Q?Berrang=C3=A9=22's?= message of "Wed, 11 Feb 2026 15:24:52 +0000") References: <20260211152508.732487-1-berrange@redhat.com> <20260211152508.732487-12-berrange@redhat.com> Date: Wed, 18 Feb 2026 10:38:41 +0100 Message-ID: <87y0kqe6hq.fsf@pond.sub.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-MFC-PROC-ID: sWZBtEiXcZRN3dD9nBHqJ1yI8VyMkbryaZxnMLQwF5k_1771407525 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.043, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, GB_FAKE_RF=0.754, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-rust@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: QEMU Rust-related patches and discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-rust-bounces+qemu-rust=archiver.kernel.org@nongnu.org Sender: qemu-rust-bounces+qemu-rust=archiver.kernel.org@nongnu.org Daniel P. Berrang=C3=A9 writes: > There is a gotcha with qemu_log() usage in a threaded process. > If fragments of a log message are output via qemu_log() it is > possible for messages from two threads to get mixed up. To > prevent this qemu_log_trylock() should be used, along with > fprintf(f) calls. > > This is a subtle problem that needs to be explained in the > API docs to ensure correct usage. > > In the Rust code, the log_mask_ln method which is conceptually > equivalent to the C qemu_log() call will unconditionally append > a newline so must only ever be used for complete log messages. > > Reported-by: Markus Armbruster > Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Markus Armbruster