From patchwork Mon Oct 21 08:53:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13843738 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9B24DD0E6D3 for ; Mon, 21 Oct 2024 08:55:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=e+LBeuL0p/g9tMPKd7s9Qwfzjl8gNaib2uyFBP1HKJY=; b=ifSrGWWxneHMKHGReVCcG9y9TA YI6GCW9jQZdYHgpgPS/LCevxM+VabSRcZNMdAQ+eo1KGv3Q3C0Aec1NWkoyLr1RzIm05JZvjwDoSs TNIKobGRE5iHTfefF4/YFSsp8hNw91YKmSUBZQp89yK/MNBltBrYmePzXPEgbtSD0qnZJFv21Uvgp ToWzVB93ztNi9eUwgQViEhXTpjvk090tEbRHr64AhzFLC/ZT54R+ykjtvS1qsqfVATiOI9Hh0EoNA RgEyVyyxzYIpDk2yjtTfBHDiUY9nYHW7JmsbJ+YdN5F1WiH64K5ijdHCH8+upSVk2lVSg0+o56k/+ Q61j7ywA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t2oCE-00000006dCD-2h7y; Mon, 21 Oct 2024 08:55:26 +0000 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t2oAk-00000006cwZ-2M6g for linux-arm-kernel@lists.infradead.org; Mon, 21 Oct 2024 08:53:56 +0000 Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2fb51f39394so42079851fa.2 for ; Mon, 21 Oct 2024 01:53:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729500833; x=1730105633; darn=lists.infradead.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=e+LBeuL0p/g9tMPKd7s9Qwfzjl8gNaib2uyFBP1HKJY=; b=cwG1z4uZyTMq14FygSEThjY5VZLgVh4by1fWfSYIHDYuRSu7+DHZc3gVePlVvQlgiW EBgkHGrqVNYsO4VJMLpC1WEwif+xXWZ7uVtQWYC3a5fk/xExO7UORD11fmOSU9URUJo2 /YNFPaEA6fAzEyOoaSSOJbvOvlUv0NPF68mXYxj/KrnG9+XbxiHeoSNzSIgjCaVH4bnv am3cqTSXqz5zgkVbPbJbVrHCdOJLwWToPGSInn/5WAQO0tKD7KX+WJMg5Ep8GMfZv+Ob Oi1gQSbwfEJvzGTiVHoMf4/JUz3HWuRG1KH5fpC/SR3YyWscE8xyv9cn2t9YDLRzMjmG RIYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729500833; x=1730105633; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=e+LBeuL0p/g9tMPKd7s9Qwfzjl8gNaib2uyFBP1HKJY=; b=BcEVZNu5+BCzs2l4Wl4dKHtVTQ2iiKTIAgq4wH5TYePF1zI3LVnX3340dchX2qwkq1 9S4SJPzPkhsb5fm2yVE4NzLYRYZpZ3AguyTKFw5t6ktd/0YsaB90vzKW4C2DRto7KCer 9ZQ0akg93hN4KgfykNQESKW7mqH7hfsKLpmkYNAQc9Bz1DYM99OiLTphv7GJN/3/JQe6 pAXzvGjCPYdOw/xgT0JDaCVWHqeqsqxDezce22+ZuS9fWNrL7ENl5NiqA3WsEzd98mQN sEz2v2nJvVvyPR2L8huEOEiZCT5US1w9zxFj/kEZh4jTTo8pQqvNwNBQFMPwHOy0Hlf5 WBYw== X-Gm-Message-State: AOJu0Yw87ZX54bsUFtFVhbIGOFE/XbDBEyQ6pnNRgXWceOzliB6O0NHx ONaYGkpfW8JgT9G1ZIJEBA5R573cF1Acly1loO5MFqTakzF5a8znWz7bVaV2rEhTVIbPceaWmXG t X-Google-Smtp-Source: AGHT+IGv2jPzFxT/Ehx3tu19lhXmWWG3RQ10dgM4RlZFE55hgZqW/42TreAx2Px/1NVohMRf5BUqEA== X-Received: by 2002:a05:651c:2220:b0:2fb:5a19:5b92 with SMTP id 38308e7fff4ca-2fb8320b8fbmr51193761fa.40.1729500832771; Mon, 21 Oct 2024 01:53:52 -0700 (PDT) Received: from lino.lan ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2fb9adf7b94sm4605291fa.98.2024.10.21.01.53.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2024 01:53:52 -0700 (PDT) From: Linus Walleij Date: Mon, 21 Oct 2024 10:53:52 +0200 Subject: [PATCH] mm: Pair atomic_read_release() with _acquire() MIME-Version: 1.0 Message-Id: <20241021-atomic-read-acquire-v1-1-4dee71191c06@linaro.org> X-B4-Tracking: v=1; b=H4sIAJ8WFmcC/x3MOQqAQAxA0atIagPO4IJeRSxCjJrCLaMiiHd3s HzF/w8EMZUATfKAyaVB1yXCpQnwRMsoqH00+MznLvMO6VhnZTShHon3U02w8FSWVV07HhhiuZk Mev/XtnvfDyCWh+hlAAAA To: Russell King , Clement LE GOFFIC , Mark Rutland , Ard Biesheuvel Cc: linux-arm-kernel@lists.infradead.org, Linus Walleij X-Mailer: b4 0.14.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241021_015354_650788_FC73A13E X-CRM114-Status: GOOD ( 13.69 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The code for syncing vmalloc memory PGD pointers is using atomic_read() in pair with atomic_read_release() but the proper pairing is atomic_read_acquire() paired with atomic_read_release(). Fixes: d31e23aff011 ("ARM: mm: make vmalloc_seq handling SMP safe") Suggested-by: Mark Rutland Signed-off-by: Linus Walleij --- This patch was done on top of Melon Liu's patch: https://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=9427/1 --- arch/arm/mm/ioremap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- base-commit: d530f55d9fde0aae4ac90e072b288da13f6aae81 change-id: 20241021-atomic-read-acquire-52a667991cfc Best regards, diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c index f952b0b0f8a5..257ed86f3474 100644 --- a/arch/arm/mm/ioremap.c +++ b/arch/arm/mm/ioremap.c @@ -138,7 +138,7 @@ void __check_vmalloc_seq(struct mm_struct *mm) int seq; do { - seq = atomic_read(&init_mm.context.vmalloc_seq); + seq = atomic_read_acquire(&init_mm.context.vmalloc_seq); sync_vmalloc_pgds(mm); /* * Use a store-release so that other CPUs that observe the