Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8538603imu; Tue, 4 Dec 2018 09:54:34 -0800 (PST) X-Google-Smtp-Source: AFSGD/UtKiAosf9mcT3LcK/CskfzAcI7ar0LDHZTm+1FjtXl/wSBMtv6UYynETVzDab6ceoJb3SE X-Received: by 2002:a17:902:ba8b:: with SMTP id k11mr20784071pls.177.1543946074732; Tue, 04 Dec 2018 09:54:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543946074; cv=none; d=google.com; s=arc-20160816; b=A+0Oairz6fLvEwt4eLvKevL98FxY6KogsYbKwlNh4R+TQdqedUVfO3s0u578fd4t21 Yx/rjRcjG0guEgObmiLmUP1XKXtvMj02FLaBp+A1bhmLIpK0jJ5Asw4CES9zODkz+r+g otIjB3DxRgxMplkMm8WjJS4XK7AEtdmkyKoiOzI6GWk7vt2nXxOoIxKDJB9GDyL6nwY/ 0yDImNYfx+eLMFvNnNhMNSEdEFq7yvQ1sC4NnqZ/XF8ycdWX3lKVvYnlIkqgPaenc6Ho mJpsV/ruKOMjwQMRXRbNUJNA2/FGpyEj2aW8DP6OtEPgYfF72NZ3e7mkE8SatdO2WDhs 69cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=lLLrd8GOFrzWKweaEOvNr8sTHs62SRUSCt+WvNvUPe4=; b=gSFr16jgg6Ir/Fx6sADY3CrWLw9I40ltDv4enjJeU6shFvw9Ld1g3FpI0/cvW7RPlD gxUKIZe7IdxX15SviMfMGhSlzzbBsyJW9W43n7001Fotwl8K02sPpDeDlC6uALOFx/xU ddH576CXWH5yujm5lwF57OxL7W8akJTLi9Op8ZIt4JNJHUOQHqPVuXl/OYDi3iL9VAhS r6SN0Xs7gu3Wk0kjh3nLbGVxOKLZm6csC2w8hqiTRbRYOH8l1NP5iWXwmI4L2tD8gVcz ALSDTg0Iv7mQbtv13bXGOa4zgn5IsZNErE7tB8Bb8XZTxoRvUWVH9/YipCIqHgln3iuZ AdbQ== ARC-Authentication-Results: i=1; mx.google.com; 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 v8si17904622ply.126.2018.12.04.09.54.19; Tue, 04 Dec 2018 09:54:34 -0800 (PST) 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; 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 S1727414AbeLDRvr (ORCPT + 99 others); Tue, 4 Dec 2018 12:51:47 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:38152 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726073AbeLDRvr (ORCPT ); Tue, 4 Dec 2018 12:51:47 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 232EC15BE; Tue, 4 Dec 2018 09:51:47 -0800 (PST) Received: from arrakis.emea.arm.com (arrakis.cambridge.arm.com [10.1.196.113]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7ABC73F59C; Tue, 4 Dec 2018 09:51:45 -0800 (PST) Date: Tue, 4 Dec 2018 17:51:42 +0000 From: Catalin Marinas To: Julien Thierry Cc: linux-arm-kernel@lists.infradead.org, daniel.thompson@linaro.org, marc.zyngier@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, christoffer.dall@arm.com, james.morse@arm.com, joel@joelfernandes.org Subject: Re: [PATCH v6 15/24] arm64: Switch to PMR masking when starting CPUs Message-ID: <20181204175142.GD19210@arrakis.emea.arm.com> References: <1542023835-21446-1-git-send-email-julien.thierry@arm.com> <1542023835-21446-16-git-send-email-julien.thierry@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1542023835-21446-16-git-send-email-julien.thierry@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 12, 2018 at 11:57:06AM +0000, Julien Thierry wrote: > diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c > index 8dc9dde..e495360 100644 > --- a/arch/arm64/kernel/smp.c > +++ b/arch/arm64/kernel/smp.c > @@ -35,6 +35,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -175,6 +176,25 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle) > return ret; > } > > +static void init_gic_priority_masking(void) > +{ > + u32 gic_sre = gic_read_sre(); > + u32 cpuflags; > + > + if (WARN_ON(!(gic_sre & ICC_SRE_EL1_SRE))) > + return; > + > + WARN_ON(!irqs_disabled()); > + > + gic_write_pmr(GIC_PRIO_IRQOFF); > + > + cpuflags = read_sysreg(daif); > + > + /* We can only unmask PSR.I if we can take aborts */ > + if (!(cpuflags & PSR_A_BIT)) > + write_sysreg(cpuflags & ~PSR_I_BIT, daif); I don't understand this. If you don't switch off PSR_I_BIT here, where does it happen? In which scenario do we actually have the A bit still set? At a quick look, smp_prepare_boot_cpu() would have the A bit cleared previously by setup_arch(). We have secondary_start_kernel() where you call init_gic_priority_masking() before local_daif_restore(). So what happens if you always turn off PSR_I_BIT here? -- Catalin