Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1689586imm; Tue, 2 Oct 2018 12:16:09 -0700 (PDT) X-Google-Smtp-Source: ACcGV60AF2Mj0eeK9ZEMUto8mhGJBD9RX1pP/TM7pNnmuaNAwO/TWVHmzhUYqOadpypvat/6x85E X-Received: by 2002:a62:cc0e:: with SMTP id a14-v6mr17643733pfg.131.1538507769618; Tue, 02 Oct 2018 12:16:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538507769; cv=none; d=google.com; s=arc-20160816; b=IhUi80qEMUDycio9GBtsIY0TlC+z32b3AyFn2qUG0Ne4u8FjfWkpbjqTK1H8o9JvAw OuACqrtDRH2jjbATV+ajcExSMDUWQ4GQgHyNMjscPNoO9b8fmzL7avXMZGbLUOROU61h Du86hqGQNFhlcVd9nVnDJX4SfYfErWSfRm4tT5zfLL+hKM+YIjadeHCmFN6XpKkG1Iqj S7ROEZN3ROYFNRsMFcDi/OIaF3sXO21+bc87BLY6HaWUAJw3Bbs1aDEU2DKZZbw9mY9t U53fc/toH9t0b8x37nkLi9cFneXgK3YgahuxLzxRejBlGbSP0utoeiP3/au/NhWbzQNX ezZQ== 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=M0eMr5lGIDQ4okweCJXi6aEcF2orTP2nOvlpsKVa8WX4NrEJ6jr+H499TpNWrxzVqy bUblxBL8X1RwD4TmDZFtEOUtd8oAp/yiLlnLN3RmVCGHIgKhySg7Rk+pcQ9OEmoeBm1X odvJen7qLiI5OWKZ9d5CmSwvTGr2Hy5N2cFto8l2EW3XsEcqTMlU0q2dUONrR9ijwBIs 69323W0sjBtIygi8K0Z8hMl1PNk8bDaIqWrdl5HDeggILtUZ+sNdRnBScJBkkY+RjHhL IyBgNMj2abgnvhLhXu4f0zoy0Rgytjk0hJknjSbVWQhH6vg/u69YyR68d70Z+9jxRnCT w81w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=XEOBl6Ik; 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 y83-v6si17639968pff.117.2018.10.02.12.15.53; Tue, 02 Oct 2018 12:16:09 -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=XEOBl6Ik; 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 S1728067AbeJCCAF (ORCPT + 99 others); Tue, 2 Oct 2018 22:00:05 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:61582 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727945AbeJCCAC (ORCPT ); Tue, 2 Oct 2018 22:00:02 -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=1538507711; x=1570043711; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=jQTZ23SgNKhmVMpyXw8suw05ppQjTGFZ9dEM3MSqxbk=; b=XEOBl6IkwYWOwBb7ILhglHimPzYhhLMsEefpK9UG1SJ6BkoQcgoOeypI 7GOeeSYpdgdxbkThLmfu3xGGQe6YaESZM2hCg0ofJZjU0ZL2WTPL6OZfZ OktFLJIDbg4iLMjw8ppFJRBAj4+vW5A1dDMUnHqTXR05fQG5vKh6x9zGz dxL8S6j2u+eGAGSwiwnw5JevaDsbEB1q+LVEV138I8nPPjbBnyjLgF7kx X4jmJIQJTd819Fx/pTHpA+17/63enAWz/26WOb/BtQ3T8oouMwmUwIEXx seCMS15HL6wgCgqNRIljMqSEpBFJDKiB9nuIi7jlCR4nq40NNsULIGG3X w==; X-IronPort-AV: E=Sophos;i="5.54,332,1534780800"; d="scan'208";a="91076752" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 03 Oct 2018 03:15:10 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 02 Oct 2018 12:00:51 -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; 02 Oct 2018 12:15:11 -0700 From: Atish Patra To: linux-riscv@lists.infradead.org, palmer@sifive.com Cc: anup@brainfault.org, hch@infradead.org, linux-kernel@vger.kernel.org, atish.patra@wdc.com Subject: [PATCH v6 10/14] RISC-V: Use WRITE_ONCE instead of direct access Date: Tue, 2 Oct 2018 12:15:03 -0700 Message-Id: <1538507707-22299-11-git-send-email-atish.patra@wdc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1538507707-22299-1-git-send-email-atish.patra@wdc.com> References: <1538507707-22299-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