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; }