From patchwork Wed Jan 24 07:42:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 765618 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:10c4:b0:337:62d3:c6d5 with SMTP id b4csp1989759wrx; Tue, 23 Jan 2024 23:43:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IFpHOp1HUbBRp8p8PED8qyxDiE5fMLoz82jLDk0Dv8UCvSpwvGTkQfwoZ3EkD2qSIYXtuXV X-Received: by 2002:a05:6214:1c0f:b0:685:f24f:e9a2 with SMTP id u15-20020a0562141c0f00b00685f24fe9a2mr2425787qvc.80.1706082207514; Tue, 23 Jan 2024 23:43:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706082207; cv=none; d=google.com; s=arc-20160816; b=K8RLcYgI3zbKKIG04YuZHMsUMnmHNDTV/5Q0mnPblDiuf4zASSIdbbI/1HGKS2Vbfs mf/d1GyRQjzg16+mFH+B7aH3vO/dG7Kmm3Aw0zCJTJdI4SCWAKgsofghkIcYCNyOnDef m44oz5XAVuR0GWv0OlVYGjyrLZIjZ9loacyUwib0NQ1LuRKWAc8zFs6q6QNV/HFsk9wG gHRmf+kO/4+cHLlE7c6yMrVg6aAX3A9IQXLHMMtNjZcdOe+3LUIs0RTYR6On4UDbDY9+ AEPvJ3bTQG1ri9aGHKxr79ogknOEcsKCYofnGYnkt+6xAG/n0RJVM4tPqnW8fthJHgQc l/lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+CzCtL3SwjCr5p6pkrscLd3wUMqqdx6mKYfPlktWfVc=; fh=KW5y7sVJWPC3RyYdQ5hWn19/WmIAC8w0zp2qJzzf6xg=; b=LC2ZnE9LBExsVoBPzkhwwozqqIl9lRep4WbwShcngufd6fEvptrqCjSJsFUqH8si2Q a5PxXpqX22ACUohAEMLtqIy0lZ3f3DYuWAtnlRmP4F84uWadvXe57djvQEDziKIgRLgm 7hQIduqRH443Tkcn4yl6u6Yq3Sdh2iRznVzbxKMT+dnebR3SNEGkCkai8gWBtzqfG/Nn AaF5UPsJLk43jPWPdPIUA3hfbjOuuMsHywu5JPbKiOkdwD7t7+NfagViJ9MkE2yqnSsY YTcvOk+IY4SNYx3/JpbFCa6KpIVEH6cL4O5ul4yxFMmRN9N0tQDv5Umiu7CPD9TE5HTZ nMKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Dw9EBgOx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n12-20020a0c8c0c000000b006819bba47f3si9805793qvb.508.2024.01.23.23.43.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jan 2024 23:43:27 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Dw9EBgOx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rSXuL-0003Wm-2b; Wed, 24 Jan 2024 02:42:49 -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 1rSXuJ-0003SQ-Lx for qemu-devel@nongnu.org; Wed, 24 Jan 2024 02:42:47 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSXuI-00036k-6s for qemu-devel@nongnu.org; Wed, 24 Jan 2024 02:42:47 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40ebf373130so14050255e9.3 for ; Tue, 23 Jan 2024 23:42:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706082164; x=1706686964; 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=+CzCtL3SwjCr5p6pkrscLd3wUMqqdx6mKYfPlktWfVc=; b=Dw9EBgOxjeWp9+7sEtEm0Nmzo5Ytw/pvrLR5W2xeZekYEnqOhTGSYxG4QtNHVJM3a/ kTfPnbfd1P8LHlxs+j4mpUkD5cbI2wRo1wVERejzluKOgpLAw04hxeDafJdixD8B4o7b yXc4hppOB5kIHjS9puAmI8KdYrNG764vmLbMaaIhrW4Fq5RwgCRJL3gptL4Cd0Cv/Ssr AQNr2vB8+5pXx0FaFv6Iuutr/2ZdwvPkTdFv8ZcEoNXw4PIzGtgRv7YYCQlMNRoOZMXB eE5veuqk9tNeoejZ8wvQsMUtfwVnIf4mddEaQvi9cGsjTlwS6txoTgIGpdfoxJOV7fDI UWxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706082164; x=1706686964; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+CzCtL3SwjCr5p6pkrscLd3wUMqqdx6mKYfPlktWfVc=; b=WP3g8wawFB4hGWPShl+czE0FaS9y9eA6dCqULrdshhcb6G6cinmA6ARwNzuxTSKFkj EQCUdf7ZfpgyK+ASfUWKxOInNa6tG8s7VcHkFOhYbUQsA11a98GDHMT3TlXxcYwg1gIC w6Ysy+kpjtjQX2FZdI1SekrLVO0PqzqCg0zynkt0JckTcgK0Ngl0t2lmTR+wjupPdJil ZH8EJXvktu4vWTJMrcWPzXd6dPL15LjEIyZ9hgWSigx+xswWfmFL4GazH9do4MUp5C9Q sm8pA4XRs0RAsf8/wsr4VDRBZH1BMh9I/W5NCDmGdPUoRZqGp6aQYIQGQpS2QJ2/PKN+ MTAA== X-Gm-Message-State: AOJu0Yz+deo1tMsMhEREdF+d0zyVo+63yohwkwGlt9q1BNppUTscGFYo AmXrnPB1AwvomfocRarmjy1u7oP8enpbLr7H/CipGJSBW0gTcjDnCeKFs0FcuTJpGw0bDxHEApM V X-Received: by 2002:a05:600c:214:b0:40e:52ca:3043 with SMTP id 20-20020a05600c021400b0040e52ca3043mr1154125wmi.131.1706082164453; Tue, 23 Jan 2024 23:42:44 -0800 (PST) Received: from m1x-phil.lan (lgp44-h02-176-184-8-67.dsl.sta.abo.bbox.fr. [176.184.8.67]) by smtp.gmail.com with ESMTPSA id fl21-20020a05600c0b9500b0040e9d507424sm18572088wmb.5.2024.01.23.23.42.42 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 23 Jan 2024 23:42:44 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Christian Schoenebeck , Fam Zheng , Greg Kurz , Richard Henderson , "Michael S. Tsirkin" , Gerd Hoffmann , Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goat?= =?utf-8?q?er?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 6/6] hw/virtio/vhost: Use RCU_READ macro Date: Wed, 24 Jan 2024 08:42:01 +0100 Message-ID: <20240124074201.8239-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240124074201.8239-1-philmd@linaro.org> References: <20240124074201.8239-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Replace the manual rcu_read_(un)lock calls by the WITH_RCU_READ_LOCK_GUARD macro (See commit ef46ae67ba "docs/style: call out the use of GUARD macros"). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Manos Pitsidianakis --- hw/virtio/vhost.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 2c9ac79468..1f5ecb843e 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -186,12 +186,12 @@ static int vhost_sync_dirty_bitmap(struct vhost_dev *dev, hwaddr phys, s, offset; while (used_size) { - rcu_read_lock(); - iotlb = address_space_get_iotlb_entry(dev->vdev->dma_as, + WITH_RCU_READ_LOCK_GUARD() { + iotlb = address_space_get_iotlb_entry(dev->vdev->dma_as, used_phys, true, MEMTXATTRS_UNSPECIFIED); - rcu_read_unlock(); + } if (!iotlb.target_as) { qemu_log_mask(LOG_GUEST_ERROR, "translation "