Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp222929imm; Thu, 6 Sep 2018 01:07:45 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbrwHj8taC5ZMnIC6l8Gwh4deHoYyzsK+vfZ3cOWpLG30zovq/pE28PsHQGbtzh2xG6vP4y X-Received: by 2002:a63:fc07:: with SMTP id j7-v6mr1543978pgi.1.1536221265474; Thu, 06 Sep 2018 01:07:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536221265; cv=none; d=google.com; s=arc-20160816; b=TWKkAvV3Vx9ywHykZ0110tMFgfgGc+rIwSKC4gkStTUcL9c8bv6wWDuOMsFWX2UrYr WsMcY6fbGp6KSXzTo1gTx6pC2sRgSG8R1odhiqRCsEsTq6MkZ3BC7s6UzJojy+OwO3bj DV+nrlK4hte366pcPyKIeQ9IzCKxmu/huyLhFv+qDN1sD1WU1wYx4rny715asYJttM/o cmr5IZlhWKjhuH5FAmFgok+kTj/izkUBwh5CjQBiC5VY0VfjsO8nWhoyDzpsP4VLpjff xJ5fhLX61Efv9yWWl9WWNPBGrwn1ln1q0xDNxjGFynPS92YCgrWSl3M/GxlxCJc8Gr6/ J91Q== 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=DyyfKDqkQWOovHXp5Ok7Zf3kQZF1sno9A4fVbjHg70U=; b=JDuj6bYgt1kdOAFjEDkEs//sKnTdfzgJjxNfaarNc7X3+Et4iak2CwS0diD5o8Owbk YFWXifJTCRHYxAqC1bA+RNSNUhjb934Iuzu6+fqyfCLk4BdnrrpLGrrwGqlaFg7OCh2d S2sNBCxlSnUWpjD/nvxVUEIUX5x6pmp1Js7c6WrGm1Lh4C7NUKnKHs+HKks30WWWeU+B OMpq1JlaUk41MuDWeo67ZO5/rU2sOp6iMqmqZOmc5EOjK4aU1w0pZYsqEGVK4jWr2NFw utKQmTF82rwkUe70CCkPL93OkVJlz9JjH8ooG5Suw2Zy7asSN/cp9unPYCQ/bT6EBQA1 p08A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=Ew8tQPwV; 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 f73-v6si4757692pfk.97.2018.09.06.01.07.29; Thu, 06 Sep 2018 01:07:45 -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=Ew8tQPwV; 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 S1728097AbeIFMju (ORCPT + 99 others); Thu, 6 Sep 2018 08:39:50 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:53554 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727963AbeIFMjt (ORCPT ); Thu, 6 Sep 2018 08:39:49 -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=1536221194; x=1567757194; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=3URSFYsJax7UkaII6ZOeVesKAM7iOZNRlQ3kLGYzuro=; b=Ew8tQPwVJggnEPvDIqtly03H5sWICY9tyX3Mfh0HTUmJIldF9QJ2I7mr ivfXdf5gE6/GvfOItNxLYEcUOSj700RbatGD01k8DVqfS1m40RqOEpQxM TMQWMTYrNn05XqRFlTNjSudo0/42gzaeHvfjT/vaOfYNMAMz9bnMCK82K pdBz073YUrkFZVe9Wh1U1IHcZ/cx2+HoLW5hPcFE4TysF4oyBTUW/gbm8 dNFARRY3NYowQUVWaYlg/tT7FwuSIkJ3frjE+lB7hItaYLBimkfH81x7M IlwLKr795oPWuJcpn89H5HF3jNVWMulqTPQUVbaxr+LkrBiKl1C9ogiPH A==; X-IronPort-AV: E=Sophos;i="5.53,337,1531756800"; d="scan'208";a="186673946" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 06 Sep 2018 16:06:33 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 06 Sep 2018 00:52:12 -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; 06 Sep 2018 01:05:37 -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 Subject: [PATCH v3 04/12] RISC-V: Disable preemption before enabling interrupts Date: Thu, 6 Sep 2018 01:05:27 -0700 Message-Id: <1536221135-182613-5-git-send-email-atish.patra@wdc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536221135-182613-1-git-send-email-atish.patra@wdc.com> References: <1536221135-182613-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 Currently, irq is enabled before preemption disabling happens. If the scheduler fired right here and cpu is scheduled then it may blow up. Signed-off-by: Palmer Dabbelt [Atish: Commit text and code comment formatting update] Signed-off-by: Atish Patra --- arch/riscv/kernel/smpboot.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c index 712e9ca8..670749ec 100644 --- a/arch/riscv/kernel/smpboot.c +++ b/arch/riscv/kernel/smpboot.c @@ -111,7 +111,11 @@ asmlinkage void __init smp_callin(void) * a local TLB flush right now just in case. */ local_flush_tlb_all(); - local_irq_enable(); + /* + * Disable preemption before enabling interrupts, so we don't try to + * schedule a CPU that hasn't actually started yet. + */ preempt_disable(); + local_irq_enable(); cpu_startup_entry(CPUHP_AP_ONLINE_IDLE); } -- 2.7.4