From nobody Fri Nov 14 21:03:23 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1762789959; cv=none; d=zohomail.com; s=zohoarc; b=huNoujvuFISZjJCWA7qu+J4NFrFZBeYzZj8pKioYvQOS5JXrluN3SSWkizhLxwZoKyQaqafQ3OUi4ayrRRYwpkeeKFQLsWXGqLv+ErafmzFGODVodjCpC8Sa4kTQbofgxwtcjebJcmD8COjDRE9xEgGCQVayWa8PPa4SmX4Olvg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1762789959; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=4urNL7p8q32yW3vnjExo0mWUQgRDxHTQkHCJr50ZGAA=; b=Df0dC4jMb1L8k1BwHr1pYSoDLGMEphsjcKyfkVnDrORxAXNO4CiQt+nIUito0qSC/mhyvEBJb90ChY6akwhhqLjUUzX14OuskCo2Y3LCS4PsFJaHIM0vZTybtszeoX/toOJxOrI1KoGpIqS62CaXywuzG5qXr+O1T9wMBGnjwpA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 176278995932667.15700123393856; Mon, 10 Nov 2025 07:52:39 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vIU9z-0000L2-59; Mon, 10 Nov 2025 10:50:27 -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 1vIU9V-0007d8-8I for qemu-devel@nongnu.org; Mon, 10 Nov 2025 10:49:59 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vIU9T-00014j-9Z for qemu-devel@nongnu.org; Mon, 10 Nov 2025 10:49:57 -0500 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-383-2Q3KUAzaMoqB4KSRwEHlCw-1; Mon, 10 Nov 2025 10:49:52 -0500 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-42b3086a055so1419188f8f.3 for ; Mon, 10 Nov 2025 07:49:52 -0800 (PST) Received: from localhost (p200300cfd7171f537afd31f3f827a45e.dip0.t-ipconnect.de. [2003:cf:d717:1f53:7afd:31f3:f827:a45e]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42ac67921c3sm23228671f8f.40.2025.11.10.07.49.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Nov 2025 07:49:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762789793; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4urNL7p8q32yW3vnjExo0mWUQgRDxHTQkHCJr50ZGAA=; b=hbLY6B/rjXsF4nz3BILXYUbkOfnroekpkrh/LqsU3mc7tqnDfIaiAiL6A/xoBfK/Ao9szL GyIFUOFCAY45nqwYh741dUyEaW770DFdslm+N9rrRQ3vCcb0ribH9NfrGHaDyKMtClJMdp Uyn/sW743LL79rOQvIuZwbHCQec+ZWg= X-MC-Unique: 2Q3KUAzaMoqB4KSRwEHlCw-1 X-Mimecast-MFC-AGG-ID: 2Q3KUAzaMoqB4KSRwEHlCw_1762789791 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762789791; x=1763394591; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4urNL7p8q32yW3vnjExo0mWUQgRDxHTQkHCJr50ZGAA=; b=O16+4Vh3+aDs0xlpeUEFSUXveMM7FBn6HVX/HFICxG8nRH6P0UNlM8APkHCtiEEf0I kzVH4z62ttwPAQ6HHocrJxd7NNv8fqRkb3DCXIp/viBKZnS/DIrgyIVvCnCwDifxwcfG t9DP/uHlLbJDV3FO50i7/SqETIozVaQY+JVlGk72nm/bqJXygjx3TM/ZePqjSUuXt4tZ aeOUl/NZ8arH1N1xe1TqubJv/XZ7gx0WvmyMRet9oD7hhyTTVoU5NTNq5o37HROIHlPJ SiRV95qs1qQ57okmc0ISrczMqrjT8BikBP+VITTvtQKKHmw5HqVstGfv8+6FT1WSU38P SDsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762789791; x=1763394591; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=4urNL7p8q32yW3vnjExo0mWUQgRDxHTQkHCJr50ZGAA=; b=J6pK0DxRb2TpBskwutAc0EGIeIIFaiRkFOQ8XVcoZqHsXW4xAnY8jnhl/ohxO0HSFy Qm+1aQBoWqJMh/yct0L2ZrogsVpx8iyjZEG0cnYHExw2EbEQEDzRmGPQpB/hColZPqxx HpXbpJikp+pNj7CLBXPOP/m09fGiOMTTv1ASA7a4NydJ0ujJtim3IFs1bbxLBgIt0u3a e2BlvqR/jTmQCxifYyGCWP3TLiTWwOSOn44uCs9v+T00qm3+gE/CtzUW16BM0Hqibggo U8zu5R70wEiNe6Xrag7sNnqrVUp6QA6I52ovcLt0scQ/oUSelR2BpLbFeIsuCHhmbo9C lx3A== X-Gm-Message-State: AOJu0Ywit0GUNqeTJvLud8CixRmXi2yPf/wuncRoNr9vCm31Xkk7I9ui y3zgghoH9TzY9nz2bDxnR6xBfBJ53YzkTh0xxmgzr+ZhKS9+Viul4JP3Gv59yl4urXXblPCR2bh oevw9itwAG5oXxvMesa87OtZdnRDKJ4cUtGVXfNGw+bD4/DjPExQ5Z+0K X-Gm-Gg: ASbGncsNwtoh/6Ke8pFerIWZX1kg/ExvmPB3h7kFgXdTUP47VQdSPF5qPvoDaneP810 tLxsSmgl4RXG9Ay1FiY8aLmrhMTW229RrC4KtEHj0z6yJ6HnoDXBAzCyGC2yT9hBJCAzaUuV4yx 09e7aJjK1GarfYqLtwW0arJid5PVZGj6VN7/jpKggjmvbGcuniHkXgxeHgpnpjIqCvVm9BzfG+9 qW3Mx02uMUVlzqigosYnx2WUBmmfWLu1PDga06ZueNow5sw0RMHydX2mHlgeC6Nw+4lKqR1uTan P0BSXa7s0Xas/FSbxE4wRn8EjsbrNgD+FiN0u01r51FDF+u4OROGVl67aNEufLpmDdms1cpoTH3 Qpbpnu3IVXUaI00U+4rOPGbhwkPFwsSwzmRaVgM5XwvxLMuEX3SQxva3TeQ== X-Received: by 2002:a05:6000:22c5:b0:42b:3220:9412 with SMTP id ffacd0b85a97d-42b32209687mr5078006f8f.28.1762789791050; Mon, 10 Nov 2025 07:49:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IEVynldXxCXJYEZMwyF3pQ5OuWWw0uHHjUE6doVcbTYH01/4I8RNEPeyDayhMghq38ADBVlNg== X-Received: by 2002:a05:6000:22c5:b0:42b:3220:9412 with SMTP id ffacd0b85a97d-42b32209687mr5077986f8f.28.1762789790634; Mon, 10 Nov 2025 07:49:50 -0800 (PST) From: Hanna Czenczek To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Hanna Czenczek , Kevin Wolf , Stefan Hajnoczi , Paolo Bonzini , "Richard W . M . Jones" , Ilya Dryomov , Peter Lieven , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Fam Zheng , Ronnie Sahlberg Subject: [PATCH v2 16/19] block: Note in which AioContext AIO CBs are called Date: Mon, 10 Nov 2025 16:48:51 +0100 Message-ID: <20251110154854.151484-17-hreitz@redhat.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251110154854.151484-1-hreitz@redhat.com> References: <20251110154854.151484-1-hreitz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=hreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1762789960104158501 This doesn=E2=80=99t seem to be specified anywhere, but is something we pro= bably want to be clear. I believe it is reasonable to implicitly assume that callbacks are run in the current thread (unless explicitly noted otherwise), so codify that assumption. Some implementations don=E2=80=99t actually fulfill this contract yet. The= next patches should rectify that. Note: I don=E2=80=99t know of any user-visible bugs produced by not running= AIO callbacks in the original context. AIO functionality is generally mapped to coroutines through the use of bdrv_co_io_em_complete(), which can run in any AioContext, and will always wake the yielding coroutine in its original context. The only benefit here is that running bdrv_co_io_em_complete() in the original context will make that aio_co_wake() most likely a simpler qemu_coroutine_enter() instead of scheduling the wakeup through AioContext.co_schedule_bh. Signed-off-by: Hanna Czenczek --- include/block/block_int-common.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/block/block_int-common.h b/include/block/block_int-com= mon.h index f2a4e863fc..cb0143ea77 100644 --- a/include/block/block_int-common.h +++ b/include/block/block_int-common.h @@ -508,7 +508,12 @@ struct BlockDriver { BlockDriverState *bs, BlockdevAmendOptions *opts, bool force, Error **errp); =20 - /* aio */ + /* + * AIO + * The given completion callback will be run in the same AioContext as= the + * one in which the AIO function was called. + */ + BlockAIOCB * GRAPH_RDLOCK_PTR (*bdrv_aio_preadv)(BlockDriverState *bs, int64_t offset, int64_t bytes, QEMUIOVector *qiov, BdrvRequestFlags flags, BlockCompletionFunc *cb, void *opaque); --=20 2.51.1