Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp6232466imm; Mon, 27 Aug 2018 12:00:51 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYrWGn9+yEkuefdlEeOpx1w9W4pOnOBtRuIMKU4egsESsuEf0tnr26aUoxdzq0jb/8lx8Q4 X-Received: by 2002:a63:291:: with SMTP id 139-v6mr12971233pgc.365.1535396451096; Mon, 27 Aug 2018 12:00:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535396451; cv=none; d=google.com; s=arc-20160816; b=cCE2af7WETpc4QoB5P7yzonmi3Sl5Tzil+l6eKjvMJpTIhdxm7DCyo2RTTLVXyNR+8 H96Ou8+y7S0edRIocjvYjTdeQOf4DXuTLGK/n1a98m4qYvTtrlQ4Hl2PaHwu2K4iQr9y UEOtCyMFRqxoZ84kPqX/3nWngXL/tSF6Fo2hLiN50ovrHAxBW+xSuFSKjlxKthrP4NpS 1LNOo3RtoOOX4/A4qYBLX83ppo6NEwjcsFp5uqc4zcBwrthHuh2xVqW7rJMSn3141FoP GNLcHTgR/KnIQeq3Fk/U3fLVnQIgQuvMuEnKG6zUTAIzKj3eCJO84v+dptWdZqRwS5Mg ceoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:from:cc:references:in-reply-to :message-id:date:subject:dkim-signature:arc-authentication-results; bh=tS7zRWdd15kfyiSebAWS3VyxqqXFazZi8cIkgiYuQkM=; b=X7pRdss00J7ui7V2+frVMjhPD5rKESspYHQ58LOQ2FpyHUXwqnzz0K1UoYzcUrP+Yh BdDdWJd93gD//rBGHSdQtPCsLo/9kekvU6aAcBPIokRfVobIAnoT4xLN9ic0TexbJsen hiYxmtzc1TxzMrxVES7pMV/ojlJenUyqE67NwM+Ta3xirzI0AuCUJ/j0kKpWjcbXR+vv y8utfIjrm+meh22HdW/PZh2W+E3uT2PhL56KKiZ1xvS5wErMiN2Ho7pZi+omAl4hJHU4 iF02r+gUQDXVubSh8u+zIbu5+bh2SCA1gMTYtrCn3QyFn99ZQ2JVMrtd5TL01WEKxTa2 a8tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=DMaigmw+; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b11-v6si9452pgj.228.2018.08.27.12.00.35; Mon, 27 Aug 2018 12:00:51 -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=pass header.i=@sifive.com header.s=google header.b=DMaigmw+; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728058AbeH0Wqq (ORCPT + 99 others); Mon, 27 Aug 2018 18:46:46 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:38207 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726958AbeH0Wqo (ORCPT ); Mon, 27 Aug 2018 18:46:44 -0400 Received: by mail-pf1-f195.google.com with SMTP id x17-v6so7398pfh.5 for ; Mon, 27 Aug 2018 11:58:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=subject:date:message-id:in-reply-to:references:cc:from:to; bh=tS7zRWdd15kfyiSebAWS3VyxqqXFazZi8cIkgiYuQkM=; b=DMaigmw+gldRTyWzc5XtnrIFwyUPt/e5ENmvbhsNckqNKQxfIHZbRUDaq1PEdrbvNt NOPdvYtuvQGqnfFDgA0pBM55pnVQC80z+BVHgLRKkEOGxy4NbXYoSoacgZm5/hdChjv/ Ear6xEOIv7exsWXtsi05oBtKeAgEPj/MfYVRHLLEamQgKaQJxqoF5aptCMsmyljFv/g7 +B2P6YZHDctdahbBlf2+UfJSAFqnT+w6yvGJabzAHKU2Ph4nhb9AwbsZfbo6aGWoQMUW vF2LnVKRj8hC7heCFAvE2eoctqxiblxlZPXm9+JXeEsVhkanxAGkc0a8x+W9+IQ4mVdL J3kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:date:message-id:in-reply-to:references :cc:from:to; bh=tS7zRWdd15kfyiSebAWS3VyxqqXFazZi8cIkgiYuQkM=; b=kXDWnUiJLqW0Oy0tg1JKLIw0xLeGmskmmtBV7DhbfPicO3LFU0eHA/psAeUhFhZdjF n7g5dMPcqejBYxIt7s5egSkLp8v4lfKBmOXGDViwYH0bdvrj+1r2lTc9iwpPBANgNFfu dD2NJJ3VMVlDJHTHSzCADwd9uzDmj7YriuRKoLahhR8g093SYo1prFnYICY6MEJqqnE4 VHQvoc9N2dD6UU5JYa5A75uCv5YIFCFgR5HlAtu+XXjbldzQwx3zFbiVz0kj0havckXM 6R5KpIP1TQVRX5XURVtn2dbh+UqRQsuKtjMd6aodJwxwMu0DpiwcGFmzulF/inweGRAT RDEA== X-Gm-Message-State: APzg51AeObVFjSGt7+cPCab7n5iRmGbJkTloAOkVkh1N8niCxZpqPICU MRc3iXZ0O9n8aB0ay8CzRdlcRA== X-Received: by 2002:a62:444d:: with SMTP id r74-v6mr15448674pfa.96.1535396334633; Mon, 27 Aug 2018 11:58:54 -0700 (PDT) Received: from localhost ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id f19-v6sm24629000pfd.147.2018.08.27.11.58.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Aug 2018 11:58:53 -0700 (PDT) Subject: [PATCH 8/8] RISC-V: Disable preemption before enabling interrupts when booting secondary harts Date: Mon, 27 Aug 2018 11:42:43 -0700 Message-Id: <20180827184243.25344-9-palmer@sifive.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180827184243.25344-1-palmer@sifive.com> References: <20180827184243.25344-1-palmer@sifive.com> Cc: Palmer Dabbelt , aou@eecs.berkeley.edu, daniel.lezcano@linaro.org, tglx@linutronix.de, jason@lakedaemon.net, marc.zyngier@arm.com, atish.patra@wdc.com, dmitriy@oss-tech.org, catalin.marinas@arm.com, ard.biesheuvel@linaro.org, Greg KH , jeremy.linton@arm.com, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org From: Palmer Dabbelt To: linux-riscv@lists.infradead.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I'm not sure, but I think this was a bug: if the scheduler fired right here then I believe it would blow up. Signed-off-by: Palmer Dabbelt --- arch/riscv/kernel/smpboot.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c index 953bc540207d..45515cc70181 100644 --- a/arch/riscv/kernel/smpboot.c +++ b/arch/riscv/kernel/smpboot.c @@ -110,7 +110,9 @@ asmlinkage void __init smp_callin(void) /* Remote TLB flushes are ignored while the CPU is offline, so emit 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.16.4