From patchwork Wed Jan 24 07:41:56 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: 765613 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:10c4:b0:337:62d3:c6d5 with SMTP id b4csp1989565wrx; Tue, 23 Jan 2024 23:42:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IF0sE5viWOPZO6pRTMQrYTaqaXOAIQjkpz1vIZ7VDX7y6iOX/Xl9as1Go7LyfIFcn2m8Qdn X-Received: by 2002:a05:620a:2442:b0:783:2e5b:1fdc with SMTP id h2-20020a05620a244200b007832e5b1fdcmr9935405qkn.154.1706082165775; Tue, 23 Jan 2024 23:42:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706082165; cv=none; d=google.com; s=arc-20160816; b=j8vx2S+9U9YQAdoNr8y9DjNH9kLFwfi/xOe3ZO2/FV1Y2tGIP7Uw6NnZjsDGTQAeHC Jc28yWkEFTUio1TN+uwT7oNr+1jFV228L+lwP948kP7QoKXEgbuoLtkst0AjN51huti+ AIfE/q2ulcgv01EI2pPj5ICC+MIgHY5ExOks/WsdMJu7W3bJY6uw3U7YiLMXZc1jYimz DTslp47n3boYnFUC/A1ONPt468SJUf/v3/yE3ry0SgRecu0JtDUoy6FrHukacKEZ61Ty GHRGubAaWhmUbwZWebejvluXYtTrAIgXj3pf/o5IbkJzCbETgUbo4fZX76vsKipjJyHK QRgg== 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=dEohNbICE64fiWDiipXLr8WUwbdgtkPH1DVHZNt9exk=; fh=KW5y7sVJWPC3RyYdQ5hWn19/WmIAC8w0zp2qJzzf6xg=; b=dCvCZZSroO7K7AXjPv6STPyyOX2aYUvKwwqPogiEJtiLXwWoVOua644UKgXSxJSpLR Wdgfhm4Y9WZnTxij5bpQXbrvPhOLZdnuNYJazxRKFiIFiSWucIKTedXrm3mj89ls6rai 3zwfUhHUkFeNEG2ubqsYTgoMpLc3yUdPMxAXcy5rkxwp3PYO2rYfulF0NADm/Q/XdntF yeD5Zp+qtjCLNFjnJkwuca+1DiJlSsjfUppe796NQMyTInznm2KMnq1eTRPkTjT4NcRS 01XkBY+nnncgAB5dynyTii+Jmcjp0bgLvHuF+xineXhhkGgUqsfKiy0eXotkQQAtp+Fs 10hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DDoeCPLV; 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 y12-20020a05620a25cc00b007831c0f464csi10178539qko.751.2024.01.23.23.42.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jan 2024 23:42:45 -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=DDoeCPLV; 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 1rSXtq-00035d-RT; Wed, 24 Jan 2024 02:42:18 -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 1rSXtn-00035G-SR for qemu-devel@nongnu.org; Wed, 24 Jan 2024 02:42:15 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSXtm-000347-DC for qemu-devel@nongnu.org; Wed, 24 Jan 2024 02:42:15 -0500 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-33929364bdaso3477181f8f.2 for ; Tue, 23 Jan 2024 23:42:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706082132; x=1706686932; 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=dEohNbICE64fiWDiipXLr8WUwbdgtkPH1DVHZNt9exk=; b=DDoeCPLV3fFdSGskkVyIHmGNphkwkXsjo8m5f9RbvmH1ujm1tMDBaPxyEjJiycBHcn WW2WmuQ8vfySck3aHcc7zQReQYkaaLVxY77sw1NoF4jkAoYNXonlooH7YpezGpamod9c 6aOAqaJOT4H1qVsH0s/O9DIQSW6h2OQleRY6GuKcQ4yavBHJTSlpBj4pHIkdnYldK4V4 Mhu+UAf2NQDQZ2b2VlWjNKj+MltGGxLk1gBetlspNqP+yKbOg1wfjlZMz5H1WBU97oqd lv95mvGPo52b1bgYBkDS/HBsKnHSgFc8yFc0sgA+ZQNFg8j4GhIb1Nr/3TDN+ievcO2d VTfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706082132; x=1706686932; 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=dEohNbICE64fiWDiipXLr8WUwbdgtkPH1DVHZNt9exk=; b=hroMDtLdGaI+TeJ432ZKHXKyS87Zy7gb0zOjr/XnwkGYG1EMRicCCNuZekqb/dcc6Z /vgMoxJeAAKUrvruSXMoB5ZNCvit/kj4pfkXDIPPDnISsbUzHjbZk6RSM+evuUHje62r wyAPlXsvCoWMhouBtfgIssL18/6P2iG8OpzKZ46sGRg7N0p36GxBmpbGi42MtQYgEXib Edp2ArLoPPeMP73OCPbEBwIMS63IMbWwoDXqftqVY1Kz6mMc0PcJaGhzNmshC46/IW3A MR6AuQH0TiXxbinNFuFsFcC+/u+cE+B0Osf8AcDhVlJQ28YLQISWol5B2kpbOJTL7iCr 0jig== X-Gm-Message-State: AOJu0YxXC6k5aKtVazzfssk+h5AfkjzeMy0HEQffQ8Eufi0qxbfsu9Ho 5TFbC2h1Y88faKqN51jP9nIAc6OdeP1W6mcpgraUROHANJIREMSvd/Nrf0l2jounrAAnjw37p9C I X-Received: by 2002:adf:eace:0:b0:339:2c1a:5d79 with SMTP id o14-20020adfeace000000b003392c1a5d79mr267975wrn.6.1706082131894; Tue, 23 Jan 2024 23:42:11 -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 v27-20020adfa1db000000b0033946c0f9e7sm2977610wrv.17.2024.01.23.23.42.10 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 23 Jan 2024 23:42:11 -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 1/6] accel/tcg/cpu-exec: Use RCU_READ macro Date: Wed, 24 Jan 2024 08:41:56 +0100 Message-ID: <20240124074201.8239-2-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::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.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 Reviewed-by: Richard Henderson --- accel/tcg/cpu-exec.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 67eda9865e..6b3f66930e 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -1070,21 +1070,21 @@ int cpu_exec(CPUState *cpu) return EXCP_HALTED; } - rcu_read_lock(); - cpu_exec_enter(cpu); + WITH_RCU_READ_LOCK_GUARD() { + cpu_exec_enter(cpu); - /* - * Calculate difference between guest clock and host clock. - * This delay includes the delay of the last cycle, so - * what we have to do is sleep until it is 0. As for the - * advance/delay we gain here, we try to fix it next time. - */ - init_delay_params(&sc, cpu); + /* + * Calculate difference between guest clock and host clock. + * This delay includes the delay of the last cycle, so + * what we have to do is sleep until it is 0. As for the + * advance/delay we gain here, we try to fix it next time. + */ + init_delay_params(&sc, cpu); - ret = cpu_exec_setjmp(cpu, &sc); + ret = cpu_exec_setjmp(cpu, &sc); - cpu_exec_exit(cpu); - rcu_read_unlock(); + cpu_exec_exit(cpu); + }; return ret; } From patchwork Wed Jan 24 07:41:57 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: 765614 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:10c4:b0:337:62d3:c6d5 with SMTP id b4csp1989563wrx; Tue, 23 Jan 2024 23:42:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IFGQIx8nr0AI+OgkwU301nNNB5VKIU5q/k0d7SAlUTjPDu8fom8CtFV20JL//Y5IAWJk5MZ X-Received: by 2002:a05:6902:38b:b0:dc2:3853:c79b with SMTP id f11-20020a056902038b00b00dc23853c79bmr294055ybs.102.1706082165734; Tue, 23 Jan 2024 23:42:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706082165; cv=none; d=google.com; s=arc-20160816; b=c0rnNDQRiD5ehgZ3gZwptOG+XzZhzrLYs1qsyn5W6wSaBddlbIbyVuLhXU9qDnWRk5 PKSbugrMse+amcUgUYW6tKLXINy1q4GHH2EcmjLKQ4CCKCjuN3eoFcdREx1zgu3n4OR0 eMdBfbnNs05PpJBeWaq0FN0Lv9NqdMGXiCNKGslUuXcBgfb0aW7gAkXj3kVc/J57m28v TRwufX1+ZxZd62RuXmX6CBCTtL+8c4qEGQtC0yiX5vnvkbRScVPf963eISKfXnFHloBV CE7m2jg1IbPoTRbKLJzo/9ndP0IL0G2MiA8wQA7AYwv9ZpiAfHaCKpIVUjTaeU2IDhoL rQ7Q== 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=iAI6SzwuMj1fhJkYbViGKDOa9P8dnzcSn0icKU6xRVc=; fh=KW5y7sVJWPC3RyYdQ5hWn19/WmIAC8w0zp2qJzzf6xg=; b=qJnVFrVWdQbqTorPY3JodOjWqqUZcvd36WbDTtYaOyx+R8tRjJlVSgB+yFvdn6yccG QZtV8HBgXjoAkSlDXIOS5nhLqDLxKvyimmAf0NiSjIbGn51yhU7NWxVw/+Bf5yjf10BU n0soAs87SUT+pfR8IDgNF9DDaJ5+P0JN7ZaadrMCdYQ0yIi0X/wR41TjT6rTZY5WN0wd fuEJSSPkptgaZW3ZLmpaTnm/wN7zAgxFoy2XMD3+W/EdS47nB8DHRXgX9//Hz5MCyYj3 1YbWbYqG39KvK6CkOIRbsLVxeimKj2Z/ULIANGktatyZayOu90JS0vPtEfT51DDY49zW 2Ntw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TdjHpQl6; 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 h21-20020a0cab15000000b0067f89610cdcsi10174514qvb.180.2024.01.23.23.42.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jan 2024 23:42:45 -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=TdjHpQl6; 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 1rSXtw-00036J-MY; Wed, 24 Jan 2024 02:42:24 -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 1rSXtt-00036B-Sq for qemu-devel@nongnu.org; Wed, 24 Jan 2024 02:42:21 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSXts-00034L-E0 for qemu-devel@nongnu.org; Wed, 24 Jan 2024 02:42:21 -0500 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-3394b892691so320453f8f.1 for ; Tue, 23 Jan 2024 23:42:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706082138; x=1706686938; 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=iAI6SzwuMj1fhJkYbViGKDOa9P8dnzcSn0icKU6xRVc=; b=TdjHpQl6HeC5xhmOjRLRiK3M/4SUV3D6v9A2heARnxXi6BojDyESpya/dh30LKE6/K IkRzzry7eAvZ7/5mVLYUih1c7qXDwAUORLH3qZT3hO5UhE8LnEUetHhNkNH6tkjmgiy+ vCAESeXtJLnbpbP5utI6a9nzVo+iylPF9y0f2nZsRMjm04v2FwTlDwsz4DNIpJAku2rd gQiICxS5t/XKd6xZany99UJYRrZrEFP2Hd6je5oT0BDf0vTW1Ye2LdJbf4MXBaxrPjUN 8maaRiDD6+GOvi3fGmZD4HjSOIOQXSMXvqS/rugSuiuKb6dUsak0HaugT81s5HF0k6MI Pkpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706082138; x=1706686938; 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=iAI6SzwuMj1fhJkYbViGKDOa9P8dnzcSn0icKU6xRVc=; b=CWCOif9FKnrdhU2ZuNsP+XgG0jXIu2gPD3/Lvl1T4nasuTJQh6XDcQ5uvA7Ssclt+3 mazNlEDgyg7UQgGF7SRsYZi9kTkv175x+3if3qEPJkQSAn3rT1aWS8mUAKlF49ZYTQG2 GvYwwCZnuqXYBjQYmkTGte6sRhUJns4HUnaDDU5MLrJ5pC49TBuJ/TUgX54E2WTV+5Qu 1PWatduNPXE7dSCoEPjN/tEqGKenll/N+e54JX4q4tOni/ZT/Y7m3zVLsovVOL6728i2 JlxM81yeajk/q6blkN3ORfC0/zC7sduiGRSoheS3DIDDVQ5yfTJ47M4LlZcrMMc7RH5D Il6A== X-Gm-Message-State: AOJu0YwsNbkKFa6V7gfvEHIjuaxhJi+0MwqO8sJkPoxe4DZv7jmq//8H 5/Hvm4j83jQvHrTv7n5AvwNJwuemq6jSb67NoLLriR63cP5nCvVbzyH3bAyHRbcK2PpUQqQ1OMj Z X-Received: by 2002:a05:6000:144a:b0:339:47d7:6527 with SMTP id v10-20020a056000144a00b0033947d76527mr281803wrx.0.1706082138385; Tue, 23 Jan 2024 23:42:18 -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 l11-20020a5d674b000000b003392c727cadsm9218653wrw.27.2024.01.23.23.42.16 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 23 Jan 2024 23:42:18 -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 2/6] hw/9pfs/9p-synth: Use RCU_READ macro Date: Wed, 24 Jan 2024 08:41:57 +0100 Message-ID: <20240124074201.8239-3-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::436; envelope-from=philmd@linaro.org; helo=mail-wr1-x436.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é Acked-by: Greg Kurz Acked-by: Christian Schoenebeck --- hw/9pfs/9p-synth.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/hw/9pfs/9p-synth.c b/hw/9pfs/9p-synth.c index 0ac79a500b..419ea69e3a 100644 --- a/hw/9pfs/9p-synth.c +++ b/hw/9pfs/9p-synth.c @@ -241,15 +241,15 @@ static struct dirent *synth_get_dentry(V9fsSynthNode *dir, int i = 0; V9fsSynthNode *node; - rcu_read_lock(); - QLIST_FOREACH(node, &dir->child, sibling) { - /* This is the off child of the directory */ - if (i == off) { - break; + WITH_RCU_READ_LOCK_GUARD() { + QLIST_FOREACH(node, &dir->child, sibling) { + /* This is the off child of the directory */ + if (i == off) { + break; + } + i++; } - i++; } - rcu_read_unlock(); if (!node) { /* end of directory */ return NULL; @@ -494,13 +494,13 @@ static int synth_name_to_path(FsContext *ctx, V9fsPath *dir_path, goto out; } /* search for the name in the children */ - rcu_read_lock(); - QLIST_FOREACH(node, &dir_node->child, sibling) { - if (!strcmp(node->name, name)) { - break; + WITH_RCU_READ_LOCK_GUARD() { + QLIST_FOREACH(node, &dir_node->child, sibling) { + if (!strcmp(node->name, name)) { + break; + } } } - rcu_read_unlock(); if (!node) { errno = ENOENT; From patchwork Wed Jan 24 07:41:58 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: 765617 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:10c4:b0:337:62d3:c6d5 with SMTP id b4csp1989711wrx; Tue, 23 Jan 2024 23:43:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IEokcaL8+GMHj8o2J0I6cn+7X0jzcv/q4qNETo/hKUET9K5z8ksNo4Tf5Lg1wJuV11uJOOY X-Received: by 2002:a05:620a:2a10:b0:783:b7af:1019 with SMTP id o16-20020a05620a2a1000b00783b7af1019mr81031qkp.49.1706082200644; Tue, 23 Jan 2024 23:43:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706082200; cv=none; d=google.com; s=arc-20160816; b=bwZ+iXQte1vTlSAv2UCf9ZbHJufsmf4DdDq0+eOzgsA2X8HHIURkUlDF5uXskuYnOZ CmG82LMlx5Jnmp3yYj7jVXi6+JTq/1cyjTh0HwqXDDv9hLV1KaTHS+kXWJlNAyNGPuy8 kYmduKP6it96mNcJHaB+SvDDAMn61+71rFT0gt3nYr3a0vzBR3Gi4Pmpwo2+PAbyGPcX qUxTHNZt1TAYltj+uf6oQW5mFwzBNCd4akAVjbswYJHFUxGlHIBXpeYElaGoTei8iWcE gnIaQsnvwML7xPGB0FV2ATYszyyUwaL1eww+I/nBZis095rvWdc5phSWzsFvuo/48QSa mZeA== 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=Xe9EVqe3HoOq4iJwVgfVPRIkfHdkquxwlkFh/k/6XWI=; fh=KW5y7sVJWPC3RyYdQ5hWn19/WmIAC8w0zp2qJzzf6xg=; b=i6tRENV+nXRRD14SpH9wj7sx053z/4Jyu1hQo/OEqORIYwKiLOQlnaErYFZvmEBeA6 qRCEKUowxj8QN7FaYb3WfCwNyTMxrUsgM2+nqUiatVaDq7G16DgE3Lf+nvNMZ/AopFt/ CQ/bps5ziDJR2OhaV9JB3MPC0qxf0YHSODst3zVIPbgR0hUhbDqMAY2fLj7YPReQCHhE hnoNf8A2QQeg2+m1y/Duo8c5nEhl+1PWNd2tI0AdVEtiYRy85ZM5KnrjWFUuzbkWY6Vr ReTJDkdlbwneCleCRGHH6Jf93OK5e0P21oZ6QwB5bxlobI/dUk7UewxTGeU/Sw9RdXn+ gAWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Gr41fZg3; 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 d13-20020a05620a136d00b007833f17b4a4si9213304qkl.579.2024.01.23.23.43.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jan 2024 23:43:20 -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=Gr41fZg3; 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 1rSXu3-00037C-61; Wed, 24 Jan 2024 02:42:31 -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 1rSXu0-00036h-8R for qemu-devel@nongnu.org; Wed, 24 Jan 2024 02:42:28 -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 1rSXty-00034d-O3 for qemu-devel@nongnu.org; Wed, 24 Jan 2024 02:42:28 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40e9ef9853bso29047405e9.1 for ; Tue, 23 Jan 2024 23:42:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706082145; x=1706686945; 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=Xe9EVqe3HoOq4iJwVgfVPRIkfHdkquxwlkFh/k/6XWI=; b=Gr41fZg3M8Rv268VdenzTOMkaYSpiriAqoIGYj9wFbdv8b94XwnxVmsUeM4qbC7nql 3xs8n+he7DGGQDh2ufjN9t4e+LX+HQieT+8g6sHDCFzgizMFyS1PkxTTishW73GwB+f0 whUKTYxcUixsVEhCIhCCN/xuagPEbGSg1XjBllbgVu80KzjBCeFj6Bw0nGIBt7y7vN49 800wY+mcU1VoNGRKyeAngUN2m35C5pBJqKzh9Kh4+QtkJudEM3vOqhuss32zPT17uiLy 9unnlz4W/8OgScs5ZiN2Xf9ARIaM2kp81AC6LecEmBcs/ImaY1gKjZqFyNuUhllWNOu0 5rmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706082145; x=1706686945; 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=Xe9EVqe3HoOq4iJwVgfVPRIkfHdkquxwlkFh/k/6XWI=; b=LFfTo39GiF28xTdFTgEUGUPGMO5AXiA3m51UaIYOYRB1W2fy457rh3gbVX4WADwp1V /v23/Yz+e5GQCa5Qn+8N26ZtIH4VFYCZf402kwPZDyLjoWs4qBibsd+Ry/w7USPYA3kD KJK95vinmbAiulTkXtRhSYj0w4W3HBXoXRGIlO9U7BhniT5c1S/y5l78RaL+G+0Apc52 GM63pvtbKVIjQBZxAnGjiMkYzynbr8vBau5cqyNIGnjL6UGeaF/V1zKZ2nO3gEK6HKJ4 xr3dZuzEZSNL2mZgLDnEBbShMSCHuJ65hqXQRRjWjffu/U5gIyQehh+qQ+m2y6WDjjNr iKlQ== X-Gm-Message-State: AOJu0YwJO2lxKeh8jLXEq0eIzU5zMfyKhUc3mVGEbsnB1yfcy477RAoT xgCkRB1sAwEkGLpeGVF9ddGs980Lq8Blb5Kmw1tohLAYdbG6PUpfAqaL9JdZakYtSN8UXAAyJ04 9 X-Received: by 2002:a05:600c:6a90:b0:40e:666e:4a0d with SMTP id jl16-20020a05600c6a9000b0040e666e4a0dmr430558wmb.126.1706082145077; Tue, 23 Jan 2024 23:42:25 -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 r17-20020a05600c459100b0040e88fbe051sm24940216wmo.48.2024.01.23.23.42.23 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 23 Jan 2024 23:42:24 -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 3/6] hw/display/virtio-gpu-udmabuf: Use RCU_READ macro Date: Wed, 24 Jan 2024 08:41:58 +0100 Message-ID: <20240124074201.8239-4-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/display/virtio-gpu-udmabuf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/display/virtio-gpu-udmabuf.c b/hw/display/virtio-gpu-udmabuf.c index d51184d658..0ee6685803 100644 --- a/hw/display/virtio-gpu-udmabuf.c +++ b/hw/display/virtio-gpu-udmabuf.c @@ -42,9 +42,9 @@ static void virtio_gpu_create_udmabuf(struct virtio_gpu_simple_resource *res) sizeof(struct udmabuf_create_item) * res->iov_cnt); for (i = 0; i < res->iov_cnt; i++) { - rcu_read_lock(); - rb = qemu_ram_block_from_host(res->iov[i].iov_base, false, &offset); - rcu_read_unlock(); + WITH_RCU_READ_LOCK_GUARD() { + rb = qemu_ram_block_from_host(res->iov[i].iov_base, false, &offset); + } if (!rb || rb->fd < 0) { g_free(list); 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; From patchwork Wed Jan 24 07:42:00 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: 765616 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:10c4:b0:337:62d3:c6d5 with SMTP id b4csp1989636wrx; Tue, 23 Jan 2024 23:43:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IHZ82Pl3wtqHlwozlCuWbfYQjrV1CThEM3TCUIQhM+H/Hx3wOK+f7OjKJfXsPBGtqgqMvlx X-Received: by 2002:a05:6214:20a6:b0:683:d73b:46d8 with SMTP id 6-20020a05621420a600b00683d73b46d8mr2408100qvd.85.1706082186931; Tue, 23 Jan 2024 23:43:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706082186; cv=none; d=google.com; s=arc-20160816; b=iNNV/3iqePhW1LA2ArM75ynH/b0x1E+3EY2snRkvOBcgOrD3fJqyi2HXHdxhyDrRzW vex37x8LqkWyjyiqjuqcHT/YNmUeoAIfAnRck+aFTeU2baarNzNJJl6E2NhXkou/waPn Cmvt00iZ1rVUqIpRQixCqumcCbh1UDgigrfGVrou9+MuEc5zZqdW3HtrQx+r3fzbYIrC 6+cPmcpAC7YqoRiIiPPD7cZA/aWDiy5AHKJ+j6p/7dFsQFpMKYEfjw/51f7qHpsM2987 WLK4qEa7Ike0KpCXgux6R8trmisKXq+haHxwbOqYq6LvuGK57TW5vDDk+9DiLsQuDRCO /ZHw== 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=0LfIs7wXUaYUULeAS3e2X+WCSShQ2MUHLfcscfH09+U=; fh=KW5y7sVJWPC3RyYdQ5hWn19/WmIAC8w0zp2qJzzf6xg=; b=yxNGMnAsCmySE2w5cYAlnfFceOrfOs4rRjNepsKbkq3RMAxCCoslAEmza3HDd1lMtD tYyKYtfgBpGddXHpHJUZmYmvtVIDSnYgEYeUQqvh+fQtqNW1LPqtAl/JPRgRUS9/p9Fb QxpGjqc4c0w+CNG7bVbg79V/sYrLkUyM7AIa9aKYMCUKHL+e37lyMDms8d/A99Ulho9d OWLB8O5TrqgaFegrTBns0YNghKdO7Qk3M2YbnocfurPwewtOuiNjTZoO/0u7qvVoGQFD 4wF6oPVnrtItoOoThudKYb0ExQHt8ZZey0eIWi3Vbif1EpFTGGeB3LKbQoSEzs+E/0Q0 VXrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KstOr1mM; 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 x11-20020a0cb20b000000b00682bfd263c0si9956538qvd.347.2024.01.23.23.43.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jan 2024 23:43:06 -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=KstOr1mM; 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 1rSXuF-0003Hm-UV; Wed, 24 Jan 2024 02:42:43 -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 1rSXuE-0003GN-O0 for qemu-devel@nongnu.org; Wed, 24 Jan 2024 02:42:42 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSXuB-00036Y-KI for qemu-devel@nongnu.org; Wed, 24 Jan 2024 02:42:41 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-40ec3535225so9915065e9.2 for ; Tue, 23 Jan 2024 23:42:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706082158; x=1706686958; 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=0LfIs7wXUaYUULeAS3e2X+WCSShQ2MUHLfcscfH09+U=; b=KstOr1mM/om7HpQqrQLv3E7C7UndAaqdgdSjTa52NS9BvdN7gGADsqwsZ9KEMBFga7 CD7aepBaKcypBH+Hl+beamcqFqu/zq4+4/naBTKZsLLiJZtLAdte1fW9q8/YB7YfpPkS 0xFdHv3aDzjicZhYLDxZ79pULdEGqKYEeLDk+zZo5Wl04/fG2WhDEjrAZMUuR7ofsRxU +WvW3W0JuHJSYNRhMup95j9gjQ166VpyzFpLg3CbFPaWX4oO1PvmgCmfnT4TDzH1mokv 8OH/ff/eLXYkPt8MLv03QLHboN4vS+S8Vmw8wVOO/4fTqd2fwqrCNPnREr60Nb2CzCoF u3CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706082158; x=1706686958; 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=0LfIs7wXUaYUULeAS3e2X+WCSShQ2MUHLfcscfH09+U=; b=KUc1buV/s5d0rG/g90WqhSYC1Zcz0CK/kBzGoGktq4pLeZ4VLJjVuMeoVUim7CDCzu TFmnUmcVw49xYVe52JIGaSN/S0PWLNXhW84QH3Kz3Vfes/jjpqhzadqHLVIDpJrQEFJe HPGInf7fYBiGJLjZtBRepidYxUBADsaMw4iCJdsnOcH86U5KL0FYjyHVlKhbNXM58mmC TPTdxcl2Zr2+fUeoq7r3Yc7PHaa7vIT4MbaTD8OxSsY7fub0KsSdOWq7lzK9xJ5DF2cJ 09c+uRNuVOXYXK2nxJLkmcsGyev1/4h7Dxb4h28DZFhqLxkWixD48D88uBRAz1W/0VrM qNCg== X-Gm-Message-State: AOJu0YyjuvWkU5mBDlhmDhxhHAqQFuUJjxpKs/YZ5z4wMF1QHKnH5UGC xZYY4ExufaCogXzOe8fzrlclZH1V2PZhrb6MtIABSJJ7h2uxbEtv08l6qeQ0P0/VY1r2ex3YpWf X X-Received: by 2002:a05:600c:5207:b0:40e:7e40:10c6 with SMTP id fb7-20020a05600c520700b0040e7e4010c6mr679976wmb.182.1706082158086; Tue, 23 Jan 2024 23:42:38 -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 c8-20020a05600c0a4800b0040e4746d80fsm44902735wmq.19.2024.01.23.23.42.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 23 Jan 2024 23:42:37 -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 5/6] hw/vfio/common: Use RCU_READ macros Date: Wed, 24 Jan 2024 08:42:00 +0100 Message-ID: <20240124074201.8239-6-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::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.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 *RCU_READ_LOCK_GUARD macros (See commit ef46ae67ba "docs/style: call out the use of GUARD macros"). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Manos Pitsidianakis --- hw/vfio/common.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 4aa86f563c..09878a3603 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -308,13 +308,13 @@ static void vfio_iommu_map_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb) return; } - rcu_read_lock(); + RCU_READ_LOCK_GUARD(); if ((iotlb->perm & IOMMU_RW) != IOMMU_NONE) { bool read_only; if (!vfio_get_xlat_addr(iotlb, &vaddr, NULL, &read_only)) { - goto out; + return; } /* * vaddr is only valid until rcu_read_unlock(). But after @@ -343,8 +343,6 @@ static void vfio_iommu_map_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb) vfio_set_migration_error(ret); } } -out: - rcu_read_unlock(); } static void vfio_ram_discard_notify_discard(RamDiscardListener *rdl, @@ -1223,23 +1221,23 @@ static void vfio_iommu_map_dirty_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb) if (iotlb->target_as != &address_space_memory) { error_report("Wrong target AS \"%s\", only system memory is allowed", iotlb->target_as->name ? iotlb->target_as->name : "none"); - goto out; - } - - rcu_read_lock(); - if (vfio_get_xlat_addr(iotlb, NULL, &translated_addr, NULL)) { - ret = vfio_get_dirty_bitmap(bcontainer, iova, iotlb->addr_mask + 1, - translated_addr); - if (ret) { - error_report("vfio_iommu_map_dirty_notify(%p, 0x%"HWADDR_PRIx", " - "0x%"HWADDR_PRIx") = %d (%s)", - bcontainer, iova, iotlb->addr_mask + 1, ret, - strerror(-ret)); + } else { + WITH_RCU_READ_LOCK_GUARD() { + if (vfio_get_xlat_addr(iotlb, NULL, &translated_addr, NULL)) { + ret = vfio_get_dirty_bitmap(bcontainer, iova, + iotlb->addr_mask + 1, + translated_addr); + if (ret) { + error_report("vfio_iommu_map_dirty_notify(%p," + " 0x%"HWADDR_PRIx + ", 0x%"HWADDR_PRIx") = %d (%s)", + bcontainer, iova, iotlb->addr_mask + 1, ret, + strerror(-ret)); + } + } } } - rcu_read_unlock(); -out: if (ret) { vfio_set_migration_error(ret); } 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 "