Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1720904ybg; Sat, 19 Oct 2019 01:04:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqzg8T97HUb0P8gk3MxbBDpu0dB/kC2Wlo6hGh3OWoL6066zZdqPJm3p5wLYUh3RjKmmABbl X-Received: by 2002:aa7:dd0f:: with SMTP id i15mr14449717edv.0.1571472249232; Sat, 19 Oct 2019 01:04:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571472249; cv=none; d=google.com; s=arc-20160816; b=s/+1nSC2dUFfPI3Wt1MULKd7DlNb69XmcgwxXd9CiRSqq5elYGZnS0S6eichnlTTwB oOJ5ANA56fSFgkixyqSf4mTQd/PT2HOrbyK3eqWnBISfbAy2+TtR+t5VQxJy+fYwXmHN YAi8ruz1ZwUuXueaF5SYIbUxyDJAKFR1t+2Kd7oZDWQkm3h8ne2WdNWFv0nQUx9g4AZO /9xv6aE51xwUURXayIsK9OEowD2dpcw81DcWC1NhXW2OEoY/o1t0xpR3gD9abosh711X psiPlRkq4vHUk1Cvuw7QlULnJN2kaiCH4nQQpj4Ob21drF9BFp5VEbYrra4eWmunkWq6 AvEA== 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=WaMygN7I6DnhJPeoGj0XjA+frnLbtmfCEshjyDvoN3I=; b=tTKtD6V6jfwUs5IBeeoq2qOABKrX51ehms8xlhH9zQKe/5Eescn/GYwQfUrEE2z9Ga kCzEgVZ6TRgc75W9rzzMdtbwgVx+8ZleZOUE3ESmXUHUoqrf5FibU8H46pmVz7U4x4xO cuKIquc9bDDxm+TAAMykWmigOZG5Br+ahNJUyXdIuNhd/UxBS8x9kEa27pgtSSJ/M124 pb+vSyncy154Gb860w416uovZHHwYNFu6D7/bJxAcuLe6VumOfDVifIKMOv4Cttqyx1t pnFJgobkrmPesNWREeNvWZQECIW+4Qu/Nkw9JGUQvY8CL2DdfXUgEaqjQJBU/DgM+pxC 7i3A== 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 d34si252499eda.268.2019.10.19.01.03.46; Sat, 19 Oct 2019 01:04: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; 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 S2442262AbfJRJBf (ORCPT + 99 others); Fri, 18 Oct 2019 05:01:35 -0400 Received: from [217.140.110.172] ([217.140.110.172]:58958 "EHLO foss.arm.com" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S2442255AbfJRJBf (ORCPT ); Fri, 18 Oct 2019 05:01:35 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8B6653E8; Fri, 18 Oct 2019 02:01:07 -0700 (PDT) Received: from arrakis.emea.arm.com (arrakis.cambridge.arm.com [10.1.197.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D87763F718; Fri, 18 Oct 2019 02:01:05 -0700 (PDT) Date: Fri, 18 Oct 2019 10:01:03 +0100 From: Catalin Marinas To: Jeremy Linton Cc: Mark Rutland , Marc Zyngier , Sai Prakash Ranjan , rnayak@codeaurora.org, suzuki.poulose@arm.com, linux-kernel@vger.kernel.org, bjorn.andersson@linaro.org, linux-arm-msm@vger.kernel.org, andrew.murray@arm.com, will@kernel.org, Dave.Martin@arm.com, linux-arm-kernel@lists.infradead.org Subject: Re: Relax CPU features sanity checking on heterogeneous architectures Message-ID: <20191018090103.GC19734@arrakis.emea.arm.com> References: <20191011105010.GA29364@lakrids.cambridge.arm.com> <20191011143343.541da66c@why> <20191011135431.GB33537@lakrids.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Thu, Oct 17, 2019 at 04:39:23PM -0500, Jeremy Linton wrote: > On 10/11/19 8:54 AM, Mark Rutland wrote: > > On Fri, Oct 11, 2019 at 02:33:43PM +0100, Marc Zyngier wrote: > > > On Fri, 11 Oct 2019 11:50:11 +0100 > > > Mark Rutland wrote: > > > > On Fri, Oct 11, 2019 at 11:19:00AM +0530, Sai Prakash Ranjan wrote: > > > > > On latest QCOM SoCs like SM8150 and SC7180 with big.LITTLE arch, below > > > > > warnings are observed during bootup of big cpu cores. > > > > > > > > For reference, which CPUs are in those SoCs? > > > > > > > > > SM8150: > > > > > > > > > > [ 0.271177] CPU features: SANITY CHECK: Unexpected variation in > > > > > SYS_ID_AA64PFR0_EL1. Boot CPU: 0x00000011112222, CPU4: 0x00000011111112 > > > > > > > > The differing fields are EL3, EL2, and EL1: the boot CPU supports > > > > AArch64 and AArch32 at those exception levels, while the secondary only > > > > supports AArch64. > > > > > > > > Do we handle this variation in KVM? > > > > > > We do, at least at vcpu creation time (see kvm_reset_vcpu). But if one > > > of the !AArch32 CPU comes in late in the game (after we've started a > > > guest), all bets are off (we'll schedule the 32bit guest on that CPU, > > > enter the guest, immediately take an Illegal Exception Return, and > > > return to userspace with KVM_EXIT_FAIL_ENTRY). > > > > Ouch. We certainly can't remove the warning untill we deal with that > > somehow, then. Luckily, qemu refuses to start a guest on two different CPU types. > > > Not sure we could do better, given the HW. My preference would be to > > > fail these CPUs if they aren't present at boot time. That's my preference as well. > > I agree; I think we need logic to check the ID register fields against > > their EXACT, {LOWER,HIGHER}_SAFE, etc rules regardless of whether we > > have an associated cap. That can then abort a late onlining of a CPU > > which violates those rules w.r.t. the finalised system value. > > Except one of the cases is the user who doesn't care about aarch32 @ el2/1 > and just wants to add another core to their 64-bit "clean" OS. > > So my $.02 is the online should only fail if someone has actually started a > 32-bit guest on the machine. I don't really think it's worth the hassle. This could even be racy (32-bit guest starting at the same time with a CPU being onlined), so it needs extra care. If you have such platform, just make sure that you don't have incompatible CPUs coming up late (during boot it should be fine). > > I suspect that we may want to split the notion of > > safe-for-{user,kernel-guest} in the feature tables, as if nothing else > > it will force us to consider those cases separately when adding new > > stuff. > > As i'm sure everyone knows, this is all going to happen again with el0 > support. I wonder if some of this more "advanced" functionality should be > buried behind EXPERT. At least on ACPI its possible to tell at early boot if > the machine is heterogeneous (not necessarily in which ways) and just > automatically sanitize away 32-bit support and some of the stickier things > when a heterogeneous machine is detected. We should improve (remove) the warnings for things we know the kernel can handled during boot. For example, 32-bit not available on all CPUs during boot should be fine as we just disable the feature. However, late onlining of a CPU that does not support the already advertised features should be blocked. -- Catalin