Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1038114imm; Thu, 13 Sep 2018 11:38:13 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZZlqa1adNVhPRH+8ey5mWbdjPpQ54VfQRyp8H+zKzG0/AGd3jqQmRKBw5BFPBfrJxjP+xJ X-Received: by 2002:a63:f849:: with SMTP id v9-v6mr8230322pgj.71.1536863893222; Thu, 13 Sep 2018 11:38:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536863893; cv=none; d=google.com; s=arc-20160816; b=A9tRNEefkCKNefFUbOP6gPowMQ1fgndIwL1I3CON3g4Jdn7TnznNGLBQ124M9TNlts 4esaedPdHrOI1FA7NON039QP4sFd+ufvmdX7r+up3LF5OZnMxn+Tm+mqxQKDedO84BDL wQho2zOzREDUMkI5UqC5ARlhD2X4pU3XWVGIWkVDc3Q/6ErPQagX3JimpEe1dlIa6XOI dzrQyulT57O8lfhYUM22F03edqx94dR84elgkIMir9I6sMVYIQ0Hxg2R9SVopSJAyWJq /gy7v8/5YppbxkvmtPxP7S0anBC1XC4eAROTPxTaCcY1hihuGBuB+/gnPht+ykg2w7od lgSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=12bWM5xbpcE8wvot7dKTA+v6C3IW0HvRqixeaZZGs1A=; b=H7BMJVX3tS42q/YZf67uKasWoG7OlPRI5cI9ViAwIBWOa555C41mLzID8fMwtDmhzs 2RlZSRgizhFweiPllyMCEksoBC0x51v1LJYB56c/wz2t1Cl/otJaU/bUAU3RAlpN4N0l WSzi3oL2ClMgOGeJGuf2KDyaaplIN/IdioKBE1DUweAOhQPSeCBswGdEInJNPTw6PTd6 fEYSF4BQ8XNK5miNNqu30tKAAah4z/KE0aWSDdepkhAT6UWxSSkW90yZ8yj1nYGgeKj6 f+zssW/7Mvab3S/Dt5NbMBo5DOCkYiV6DuzgE04d4YaWGm51ye9Y7qgXHbV1gXtrA9gV U7bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=hSJ7vXwl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c2-v6si4773900pgm.236.2018.09.13.11.37.56; Thu, 13 Sep 2018 11:38:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=hSJ7vXwl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728204AbeIMXrv (ORCPT + 99 others); Thu, 13 Sep 2018 19:47:51 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:26981 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728187AbeIMXrv (ORCPT ); Thu, 13 Sep 2018 19:47:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1536863830; x=1568399830; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=jQTZ23SgNKhmVMpyXw8suw05ppQjTGFZ9dEM3MSqxbk=; b=hSJ7vXwlKds0sG0stJSiEV29oz8e+lBlCbJ5w2tspcQu6LuLw09/G1XH cdGhs6qF/auVNjRmLHKrL8wbaMUB6bYhwxaDkULU5bTExWB+T8cpATQsW Ex6I/DT8FL4jaz/6MRzc8ftW/ZuL/ZwrEDESmzNa2GG2veI/uYTyAjoxL PQMiKqEP85vmnazwnuM23wYx4M8ryYdzM/CuOkBLlTKgkiP3T32FYsqR4 mA94sMImbhwTo/b0fDCXLmuDdn8zMHykCfnh6Ft6BfjkowRk2WHKCU2IW 7HAmU285qmBilMrbjfU0I7JL9MPYEQDVoQrTq1IfIRO5fk3vFs/b99EtY g==; X-IronPort-AV: E=Sophos;i="5.53,370,1531756800"; d="scan'208";a="89712029" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 14 Sep 2018 02:37:10 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 13 Sep 2018 11:23:40 -0700 Received: from jedi-01.sdcorp.global.sandisk.com (HELO jedi-01.int.fusionio.com) ([10.11.143.218]) by uls-op-cesaip02.wdc.com with ESMTP; 13 Sep 2018 11:37:09 -0700 From: Atish Patra To: palmer@sifive.com, linux-riscv@lists.infradead.org, hch@infradead.org, anup@brainfault.org Cc: mark.rutland@arm.com, atish.patra@wdc.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, Damien.LeMoal@wdc.com, marc.zyngier@arm.com, jeremy.linton@arm.com, gregkh@linuxfoundation.org, jason@lakedaemon.net, catalin.marinas@arm.com, dmitriy@oss-tech.org, ard.biesheuvel@linaro.org, schwab@linux-m68k.org Subject: [PATCH v5 10/12] RISC-V: Use WRITE_ONCE instead of direct access Date: Thu, 13 Sep 2018 11:37:03 -0700 Message-Id: <1536863825-66808-11-git-send-email-atish.patra@wdc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536863825-66808-1-git-send-email-atish.patra@wdc.com> References: <1536863825-66808-1-git-send-email-atish.patra@wdc.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The secondary harts spin on couple of per cpu variables until both of these are non-zero so it's not necessary to have any ordering here. However, WRITE_ONCE should be used to avoid tearing. Signed-off-by: Atish Patra Reviewed-by: Christoph Hellwig --- arch/riscv/kernel/smpboot.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c index 17e74831..1e478615 100644 --- a/arch/riscv/kernel/smpboot.c +++ b/arch/riscv/kernel/smpboot.c @@ -81,8 +81,9 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle) * the spinning harts that they can continue the boot process. */ smp_mb(); - __cpu_up_stack_pointer[cpu] = task_stack_page(tidle) + THREAD_SIZE; - __cpu_up_task_pointer[cpu] = tidle; + WRITE_ONCE(__cpu_up_stack_pointer[cpu], + task_stack_page(tidle) + THREAD_SIZE); + WRITE_ONCE(__cpu_up_task_pointer[cpu], tidle); while (!cpu_online(cpu)) cpu_relax(); -- 2.7.4