From patchwork Wed Jan 24 07:41:59 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: 765615 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:10c4:b0:337:62d3:c6d5 with SMTP id b4csp1989617wrx; Tue, 23 Jan 2024 23:43:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IHz8r3Lepa9huAUitEsuMgrty4bINK1/Rtwo8cxSVWiIwgGgqpA7okwHKAAsII8K6hjc9Or X-Received: by 2002:a05:622a:440f:b0:42a:50fd:25ee with SMTP id ka15-20020a05622a440f00b0042a50fd25eemr997237qtb.47.1706082180800; Tue, 23 Jan 2024 23:43:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706082180; cv=none; d=google.com; s=arc-20160816; b=WzzD6wx7MkQXQOxeBlZTO+4CzdZG2dAY/ypJBnadq59HyHmhgC0ZKgiSKQLvUzJFjl fYrqtfqwzc+HJVhsSk4QIxIfuhPHqhlL6QLd+gu9yafAX05XgENwlqKod7n6SCYba7l2 QnOG2kA1SLQcjXglHRf6H6hLISMxCIGnly9jA0h92G8BAt+eJiJ5FWby/RpovRzAxII/ 4pvbFZFGQhSr0Mt9jUtAmavPC4VLV4ecFLY2nHOo/DFBzmTaCGfIaUv8WGw4jzN56DgJ ZDHP7j8WvocEMJn18oAfOIFZCxBMew5jW+oTh8G4wZmoMs3o41CXSFCP6h/AHE6NRnVu Z9HQ== 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=jOMcngLxDGJkByS9gEJEYPbL5+4ZqnQIMdvGkNbM490=; fh=KW5y7sVJWPC3RyYdQ5hWn19/WmIAC8w0zp2qJzzf6xg=; b=md8KM879d0cpHLiT6kO4xH6FJqDgQ4vlZszF0vrdPGad2ejd94anSSP6jUImFxu8Xd urzvvGUJgKAhw5KWat7Qox9v4S1Ep+nfX2hcCMJ9P0QEf24/E8BFTdVvpPQucGvDz35q JNc4vtMhx0vBvr9o/JR+cu+/gB6jkPoobWT8Hvb8KzuoMQeXBJomQmAl/tYz3L7IARhm /dG7PhWJs0VhKjvU3ew7i5whqEuVD5A6vt5ybqou8I+3iQe4GBMHyxJmhVsqXwme+W6d e8EKk4PqIxIC22TMLaPhHcdfyDNO4jDpIGOn7lFDd+7rMk0/lBfzpqfyuViJ1z1Bbkoz eCWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tfIAk8jU; 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 b19-20020ac87fd3000000b0042a38359c08si7578774qtk.77.2024.01.23.23.43.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jan 2024 23:43:00 -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=tfIAk8jU; 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 1rSXu8-00039Z-Qp; Wed, 24 Jan 2024 02:42:36 -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 1rSXu6-00039G-W7 for qemu-devel@nongnu.org; Wed, 24 Jan 2024 02:42:35 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSXu5-00034x-IC for qemu-devel@nongnu.org; Wed, 24 Jan 2024 02:42:34 -0500 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-3394bec856fso255017f8f.0 for ; Tue, 23 Jan 2024 23:42:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706082151; x=1706686951; 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=jOMcngLxDGJkByS9gEJEYPbL5+4ZqnQIMdvGkNbM490=; b=tfIAk8jUxJ+9qxE3YU0jZNpY0cFh9QX2v9oaiJQktevljvWdFxN6s/bg7maF60jvwZ Kpxuee6/OOYgoONLuer3HOq3pRkRZm0hxy8SsoLnL2AqYKZT8lcKW3xNie6VRMe4ywlw qeF6VZR/7QpyXvbLsYvq16KoJ1fsAj5b4vDnf/J4b68iR9HU7kAsJ+kJgd42UrSkFz6K r3YPs51de7mIw4LWSVqaBl0t/LolSz1j7bpVjEe1qiKDOEnqSLvVkl9lDm6T6JraGBxD BwRVJu9mBPqtwic25Om0C9PfzemhTbP7LtJ2zHfYoJLi9zLQTY8zhODJ88YBzRcYsPIR 4EWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706082151; x=1706686951; 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=jOMcngLxDGJkByS9gEJEYPbL5+4ZqnQIMdvGkNbM490=; b=iREqsJuuFkC4G3WxK0DtA64Z0lIeTkpGk4Kj3aPRmpBnn6xF7GTbbFT25U24zeYWR8 IbEdiMZXnTUKrhCBoM/NJ5GexelAmQ45YTxI6WP0XrTIN7S++GSaHDUHD3bTe0JNC/9T L+YMXDuSmkGTsj5PoN6FHQWKkBR5GCc987qVYr/coEKosZYdYl1UxCeU2cfGD9Ls6n5O gknj0w7DjFIZpXtvA7GB0L7KMFOc4u3/1WhS2b2jAq9wGN4ZuaHCAuPatWNQuaB1JZgV ulSd0k+m4PlJDffZGsDuyKoZ9dqaQDZcwYAQ+ylry1DCEqfqrLhR76pVCr4TOqKfxkU5 Lb9g== X-Gm-Message-State: AOJu0YxxYgdmO+WW732qNzIkp8N0+XDr3R4xIYWrj8n61TtGSdRVARCE U0FwgCbJINjqwvYCjqCFnZBQUQbVDYWSEVc/IBq8nw/jXBIdXtu6fn4vzEw6Et9Kuk0rClOkm1e S X-Received: by 2002:a7b:c4d3:0:b0:40e:52fd:7341 with SMTP id g19-20020a7bc4d3000000b0040e52fd7341mr383336wmk.141.1706082151723; Tue, 23 Jan 2024 23:42:31 -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 p3-20020a05600c1d8300b0040ec7f229b3sm43731wms.34.2024.01.23.23.42.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 23 Jan 2024 23:42:31 -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 4/6] hw/scsi/virtio-scsi: Use RCU_READ macro Date: Wed, 24 Jan 2024 08:41:59 +0100 Message-ID: <20240124074201.8239-5-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::432; envelope-from=philmd@linaro.org; helo=mail-wr1-x432.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/scsi/virtio-scsi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index 690aceec45..998227404a 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -343,14 +343,14 @@ static void virtio_scsi_do_one_tmf_bh(VirtIOSCSIReq *req) target = req->req.tmf.lun[1]; qatomic_inc(&s->resetting); - rcu_read_lock(); - QTAILQ_FOREACH_RCU(kid, &s->bus.qbus.children, sibling) { - SCSIDevice *d1 = SCSI_DEVICE(kid->child); - if (d1->channel == 0 && d1->id == target) { - device_cold_reset(&d1->qdev); + WITH_RCU_READ_LOCK_GUARD() { + QTAILQ_FOREACH_RCU(kid, &s->bus.qbus.children, sibling) { + SCSIDevice *d1 = SCSI_DEVICE(kid->child); + if (d1->channel == 0 && d1->id == target) { + device_cold_reset(&d1->qdev); + } } } - rcu_read_unlock(); qatomic_dec(&s->resetting); break;