From patchwork Sat Dec 17 18:55:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 34240 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp1636271wrn; Sat, 17 Dec 2022 10:58:09 -0800 (PST) X-Google-Smtp-Source: AA0mqf7Mi1ajt7TEWzZqejBFD4cHFO6rVlfANKTie5gd+BzfSLqW1s6C6vFhNFK3gkUuksC72yjV X-Received: by 2002:a17:906:3949:b0:78d:f455:c368 with SMTP id g9-20020a170906394900b0078df455c368mr30496254eje.14.1671303489797; Sat, 17 Dec 2022 10:58:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671303489; cv=none; d=google.com; s=arc-20160816; b=D6QdMTc/RlnGNF5zlyoK9MJwqzSiDPq6J+rGLTj+yGdvK+E/ZoF2wnT5fqm18SgQL8 4G6aQl6OWaBdkSPyyxZ/qOwe00GFmmvCbpJfOjTPq8AtGIiCxK+n+NxvArCHXpExfrcy 67wGY838cSIb6J+9og2Qvys9Hoip+Mrq7DsMGnd9kFDo9TnqN8LJ/H6P0Lq79Oich4nj P3uQn4CZxiy8Q0yIInu4E+sXUoV1r/JS3quVnvIlIDl/JrBGIMrtr2V3dE0mG05BBY5M qVnL+6WUjoYznVpmG4vs5gb60DUu3sAqYocbBWpInhSl7dpR507QQugVpAyDs4yLrZmI xm8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:cc:subject:to:reply-to:sender:from :dkim-signature:dkim-signature:date; bh=c5g6MSrqZsjP8rQ+Bx44M5yo8LZcSCCthyNX2GgIJYU=; b=MC0QTkb8il4MTOoAl46HfuhGknHdS2EGqdkhYzBnsvgcgJm7zhD5jKIQolKXBoLFHP vzrtaFi/iVbuydYNaOMpoJ4SzbgEWbjWg+vo3aqIO7vTKgxpw8nQv8w+D6f6lfFW6LUf Ollvi72fpM6ZxQCvYttUwOlbyY2e3+QeVi5LTtFG5u2g3bs1x7uuBauXTb1QQNZNsVEc jv5v6H6g1tD/FyxYP/WqX7uyPImmRhN2b1ni1DW1fHficHkrILKST0rH00dIpANFHPGN YScdtLhClPs4bhBLM0ZVYrSTBW1s+vovpsrx/P8vhSVTz2NiXC6A7u8qkpDcILqlO1i3 tqWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=YIQSN19L; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=LFhIRGS4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id td9-20020a1709078c8900b007adb388df38si4913047ejc.706.2022.12.17.10.57.46; Sat, 17 Dec 2022 10:58:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=YIQSN19L; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=LFhIRGS4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230448AbiLQS5D (ORCPT + 99 others); Sat, 17 Dec 2022 13:57:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230030AbiLQSzi (ORCPT ); Sat, 17 Dec 2022 13:55:38 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CC7123A; Sat, 17 Dec 2022 10:55:37 -0800 (PST) Date: Sat, 17 Dec 2022 18:55:32 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1671303332; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=c5g6MSrqZsjP8rQ+Bx44M5yo8LZcSCCthyNX2GgIJYU=; b=YIQSN19LWJmoUttmAjjI3Pb/eyiffL6VPEsBMCmPtWT+bBcC7OVrWmScUrH9N8L3n1al2V 9WO9PyAOtkX5+tq63dwh45YfCW40AUe5pkbMi4WEgul6Y7kUNn/XojnPX64iPWQrStX1uE xVnZyFqqCbsvWUp+aWSqcYW1WWRHtiPb3D1IEkX/NIbmaswm6FXhFg4CeHAJFfG7B6K7aX UpweqwHacnFSpi5ySY8hD00UMwalOOwfo5PvXgUCaeWgko5ABKKL/yCANSmELZEfjE9KPa GpvI+6Ii6IkBEqPokCIqSrYpEpCH5OnYjqcJUKgh33I+/KSlUXc/6a1xaO5DAQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1671303332; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=c5g6MSrqZsjP8rQ+Bx44M5yo8LZcSCCthyNX2GgIJYU=; b=LFhIRGS43jiyYOup8PegzRc+4pycbWG13QfFLUT2uBVNZEr1FhXfDHtKR9sPURnYevLMGY dT1gikrMpdvUfHAw== From: "tip-bot2 for Peter Zijlstra" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/mm] x86/mm/pae: Use WRITE_ONCE() Cc: "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Message-ID: <167130333255.4906.14861666890204509269.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752488728345053044?= X-GMAIL-MSGID: =?utf-8?q?1752488728345053044?= The following commit has been merged into the x86/mm branch of tip: Commit-ID: f7bcd4617de67a4700a7bd7dc56808b57f1c8748 Gitweb: https://git.kernel.org/tip/f7bcd4617de67a4700a7bd7dc56808b57f1c8748 Author: Peter Zijlstra AuthorDate: Thu, 26 Nov 2020 17:40:12 +01:00 Committer: Dave Hansen CommitterDate: Thu, 15 Dec 2022 10:37:27 -08:00 x86/mm/pae: Use WRITE_ONCE() Disallow write-tearing, that would be really unfortunate. Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20221022114425.038102604%40infradead.org --- arch/x86/include/asm/pgtable-3level.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/x86/include/asm/pgtable-3level.h b/arch/x86/include/asm/pgtable-3level.h index 0a1b81d..d3a2492 100644 --- a/arch/x86/include/asm/pgtable-3level.h +++ b/arch/x86/include/asm/pgtable-3level.h @@ -27,9 +27,9 @@ */ static inline void native_set_pte(pte_t *ptep, pte_t pte) { - ptep->pte_high = pte.pte_high; + WRITE_ONCE(ptep->pte_high, pte.pte_high); smp_wmb(); - ptep->pte_low = pte.pte_low; + WRITE_ONCE(ptep->pte_low, pte.pte_low); } static inline void native_set_pte_atomic(pte_t *ptep, pte_t pte) @@ -58,16 +58,16 @@ static inline void native_set_pud(pud_t *pudp, pud_t pud) static inline void native_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { - ptep->pte_low = 0; + WRITE_ONCE(ptep->pte_low, 0); smp_wmb(); - ptep->pte_high = 0; + WRITE_ONCE(ptep->pte_high, 0); } static inline void native_pmd_clear(pmd_t *pmdp) { - pmdp->pmd_low = 0; + WRITE_ONCE(pmdp->pmd_low, 0); smp_wmb(); - pmdp->pmd_high = 0; + WRITE_ONCE(pmdp->pmd_high, 0); } static inline void native_pud_clear(pud_t *pudp)