Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp1079366rdb; Fri, 20 Oct 2023 07:57:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFWdDVgiAXnwiG6EtQwpa3nL4Ct+iOPvv+D8eukznmsziiyrj2NvnPqYVjDTA/ijXr1/UQj X-Received: by 2002:a17:902:d04c:b0:1c9:c97b:ebad with SMTP id l12-20020a170902d04c00b001c9c97bebadmr1711942pll.34.1697813845408; Fri, 20 Oct 2023 07:57:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697813845; cv=none; d=google.com; s=arc-20160816; b=mXD67XZAkvHK/JuUh9TRHDoBViVaX3iHjdPOfy4GHdY43wKnGoKG2uHJ6NYfd8p1FX g3EWPFS/Rp4K7j0XRvkEqGFU0WU3Ae0KMPwso1NI1nj1VFwVMRj+K2e27r0at0hogeSf MWeLYOveUar85XbKN+4fy7FG8jKUdaM7iuOib4NdCvJv2C/V6prnVMNhp0KVnIayXpl0 vZiG7Q1ofJL0S1nzM8cvjV0ydSpKIljCXRlnK2S8OTCuc5Qkbu8B2La754Xwvm+dNChm 77IJH8u72D9v1LOb+/8N5hMLhiWc/bKpT3Nh+SYldgYKaKVQOsbchIXxGQ+/j+pW6a5T c/Eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:date:subject:to:from:message-id :dkim-signature; bh=JHbwUQb8lD1tTuEb5a8cmghLPuMYhOm9x0/pntObncg=; fh=PGaP26rljTYcjLituiXWjvRiYsB22YGWGH+YkC/057Y=; b=AW46Bdz3Z/gVHY4aIie4fZlNUxQFYWL4H++W9k3e4vz3iJgf6vNqEZNZUPoyyUGfD2 7rxFO3OKeELeAQZ4O9b677LIEgrbox1M5KYxnd3eXxH3e+PbR7VRVSzpwsWnBTHaWtbA dZEfL55HHjgg3fk7aY6Sj/axd39bpbL6agcpxvObKAn4S2Km4k1nmexji11qoW/Idq1n hJuNw743a5x7DagCED/9gMg8hCbMarnDKEQeCbluFSVIgLVvUFF7zMqkx/yi7zdaHPa9 QKNfbPiyzv3tsRcH4sgvfE0IAPq7zanYzbQnhhlOd/gVPRYThgyKhE4doTOYM0bRUxja rD3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=uxSF6Wrw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id x3-20020a170902ea8300b001c9d22299e2si2012455plb.437.2023.10.20.07.57.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 07:57:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=uxSF6Wrw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id A7D4F830F567; Fri, 20 Oct 2023 07:57:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377562AbjJTO5P (ORCPT + 99 others); Fri, 20 Oct 2023 10:57:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377529AbjJTO5O (ORCPT ); Fri, 20 Oct 2023 10:57:14 -0400 Received: from out203-205-221-149.mail.qq.com (out203-205-221-149.mail.qq.com [203.205.221.149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A43C2D46 for ; Fri, 20 Oct 2023 07:57:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1697813828; bh=JHbwUQb8lD1tTuEb5a8cmghLPuMYhOm9x0/pntObncg=; h=From:To:Subject:Date:In-Reply-To:References; b=uxSF6WrwYctZlChw7piyjZL3T4n6sMLbQzZCeEN9haHN1R+4FLXl5giJKUIfsDX3B ZwWrXq+FpQL+s2EKqcEylSpnyveny9DxZJohfQINChYEP4Wbv8oJleucEzHieUP4xt tNw+N9W6JUcyHe9MvaSCM0G3MlM42BX8NOJOwn+k= Received: from rtoax.lan ([120.245.114.36]) by newxmesmtplogicsvrszb6-0.qq.com (NewEsmtp) with SMTP id AE3AEEEC; Fri, 20 Oct 2023 22:43:35 +0800 X-QQ-mid: xmsmtpt1697813020tebywjqps Message-ID: X-QQ-XMAILINFO: N7h1OCCDntujuOVB48/Os70qsluFoiNYAhE4QPkzGQOyy7m7FTfareKCeYGFHS HihtYz16ET3FQGu+TcR4ZrkeLHMvR6w0pcQuzzfvQSdHaRxbOo6o1yPVU5pTQ5QlVkiMKQv5dAMn GhJXqifhL+hBkHmCIgvbYC3GAZRl2sKa7cUz5mJRxRJQ0Nt/sH/UlofAUWa40yiF19hmfF/niNg7 gNmRK68X9WtPa1HhNrnUBUvm9204LQXbd3Yinskj+MuYafHaHmeCcmcPzGIRNhAKP7HgWfLcZoLh 2CrOg1vLWd34j2oLvek9cUbR9DmfBrS2C6T56Hd2yXLQhDr4T8g+oeAtmvGM7O9OqXJyILhhDz0A x+fsPRqLJIudCt7PLGnLb2YUqCycL7DM5SWvbKedg3mb6KXqbzhjcng6qaqxQmqfQP14vUB087WW XoR6VbsEq+FL6IzFREdS4dSQNY3M2Cy50PlRzk5C4c8uz79jAmf9aNQotrjTxFrYeVfLxbQ/renI HCYl27eHbP0yTzUEdcAP595is+6SVJcN14Sz0J61IqSUaPeTTg/VBVlGRMxKOpKBWJwUTgpmrxHs jtSnuOmausx72KeWPXeRVaI0lvxIAoJWJwMIEHSw4tMARTnlEf0zma9MQksyAY3dXaKo5UfaU6nF o4k7VZZzeeFkglSuRcNWx7w0GubTN6Skng3sEHlxUEiAxpyHMhd+Xz9WpI6VbJq5qsjCExPg1YVB ZjhJgBsiiq7GxSZkTDyd9bt6OlHPcKC8mgradRT9aHlCgWnUwHddtbS/FSghaiXD+NSHIjHaaudd 7PVrtsasopKMr2nV8y3JVb7Q2e0Bv0h5SKEQw/fevxCLUTX0rVvvd3KtRsVIiZXDP7oViUuNOBT8 u846eVq0Griww4+dqLJUXrKJT0RA2VE3WI1v1+9TIAj/97l0xTL7TVPfvT7P/ikzhBWxzh+Jpvn/ tyrheEl15NJr2PttV3SBFZd9vEHMF0DYojW0yW/X7+BlU1c5GndAU7K1di62v2uvp2kp7Fma6dYE GzVLxEq0PW5O52yLfX8/BAqN9xunw= X-QQ-XMRINFO: NS+P29fieYNw95Bth2bWPxk= From: Rong Tao To: mark.rutland@arm.com, elver@google.com, linux-kernel@vger.kernel.org, peterz@infradead.org, rongtao@cestc.cn, rtoax@foxmail.com, tglx@linutronix.de Subject: [PATCH 2/2] stop_machine: Apply smp_store_release() to multi_stop_data::state Date: Fri, 20 Oct 2023 22:43:34 +0800 X-OQ-MSGID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 20 Oct 2023 07:57:22 -0700 (PDT) From: Rong Tao Replace smp_wmb()+WRITE_ONCE() with smp_store_release() and add comment. Signed-off-by: Rong Tao --- kernel/stop_machine.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c index 268c2e581698..cdf4a3fe0348 100644 --- a/kernel/stop_machine.c +++ b/kernel/stop_machine.c @@ -183,8 +183,10 @@ static void set_state(struct multi_stop_data *msdata, { /* Reset ack counter. */ atomic_set(&msdata->thread_ack, msdata->num_threads); - smp_wmb(); - WRITE_ONCE(msdata->state, newstate); + /* This smp_store_release() pair with READ_ONCE() in multi_cpu_stop(). + * Avoid potential access multi_stop_data::state race behaviour. + */ + smp_store_release(&msdata->state, newstate); } /* Last one to ack a state moves to the next state. */ -- 2.41.0