From patchwork Thu Feb 15 23:16:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 128525 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2289861ljc; Thu, 15 Feb 2018 15:19:19 -0800 (PST) X-Google-Smtp-Source: AH8x226jFaDPvWW8JhTXmso+qWdKV1+TfI9HcDn7rN7fRDdUOv67o0o5FqVDOTlkOzo31yqcOHrP X-Received: by 10.107.173.144 with SMTP id m16mr6356265ioo.122.1518736759616; Thu, 15 Feb 2018 15:19:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518736759; cv=none; d=google.com; s=arc-20160816; b=KgCbeDrkFO5iMUH9+50XyJUvV4cyx81lOX/nUMFXOPF8kvPBHtOEAJf/bnt2ZybLJi 4kXqgqLFJwpCGnu5TyJoeGus1mXpsUWIIJeX1tGRSSrVQl01/mRVjpYP0hTQfVj/MBX7 QnP48B1k2HPO7jvU2D3SJ132odQUFzpFf3AsWn2BYtZp1N3/RxUk+NZzyVccF/4KWXnG ocWtGFgVTPuzMbKNdNccjrlgMQpEfPcl1R8jj0oYb5ExDZ3yIYXpTJ0XHSlm59AlJDnJ 6sdfIy4Zv/7M39hQWUC5d2bBozYTV9NvKqgMLv5vaRhesg0q7vZXyX3w0vTKT62tFkcJ KV5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dmarc-filter:arc-authentication-results; bh=UK2pX/rwXMrDKm6XmJCSjjyN1GTLwt5IiDSOzTydIfE=; b=jjF6/nSmhwhKxwpz/uK4XirhOror1W/zIGI9mxYUZg/0RTU5l4TkhruNE5kdMHKsOT WIDvWdq+1xNMRuz23LhkVPWDUZHEwPngOT5gQk1pkf79AtyA/hxbZJRIas3n7NM9bGh/ +MjR683fFna6EpItAiGV5wuDKl1TtRgjpREBWLFia+2S7+aqitR8T6v0RCnb+AGNyLga 6V3myXR+AIFoKrkeWIAaVwaAYIp18Kp9d8B9e2FEP68ip6iVzsx2D7cnPkMGiEZRU6sv W/p2OVR8NN4sszMtCVaC7LYOklkvB5KBbMpJKyj6w5fyj7y+mr+N8VXwEaR3eAQKV+q9 f/5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id r65si8744851ith.151.2018.02.15.15.19.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Feb 2018 15:19:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1emSm5-0005jY-F2; Thu, 15 Feb 2018 23:17:09 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1emSm4-0005hG-Bp for xen-devel@lists.xen.org; Thu, 15 Feb 2018 23:17:08 +0000 X-Inumbo-ID: 82bd78b7-12a6-11e8-b9b1-635ca7ef6cff Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-amaz-eas1.inumbo.com (Halon) with ESMTPS id 82bd78b7-12a6-11e8-b9b1-635ca7ef6cff; Thu, 15 Feb 2018 23:18:20 +0000 (UTC) Received: from localhost.localdomain (unknown [12.248.85.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5EE7421776; Thu, 15 Feb 2018 23:17:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5EE7421776 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=sstabellini@kernel.org From: Stefano Stabellini To: julien.grall@arm.com Date: Thu, 15 Feb 2018 15:16:57 -0800 Message-Id: <1518736620-13802-1-git-send-email-sstabellini@kernel.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: Cc: sstabellini@kernel.org, xen-devel@lists.xen.org Subject: [Xen-devel] [PATCH 1/4] xen/arm: Park CPUs with a MIDR different from the boot CPU. X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: Julien Grall From: Julien Grall Xen does not properly support big.LITTLE platform. All vCPUs of a guest will always have the MIDR of the boot CPU (see arch_domain_create). At best the guest may see unreliable performance (vCPU switching between big and LITTLE), at worst the guest will become unreliable or insecure. This is becoming more apparent with branch predictor hardening in Linux because they target a specific kind of CPUs and may not work on other CPUs. For the time being, park any CPUs with a MDIR different from the boot CPU. This will be revisited in the future once Xen gains understanding of big.LITTLE. [1] https://lists.xenproject.org/archives/html/xen-devel/2016-12/msg00826.html Signed-off-by: Julien Grall Reviewed-by: Oleksandr Tyshchenkko Reviewed-by: Stefano Stabellini Acked-by: Jan Beulich --- docs/misc/xen-command-line.markdown | 10 ++++++++++ xen/arch/arm/smpboot.c | 26 ++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown index 8317639..2184cb9 100644 --- a/docs/misc/xen-command-line.markdown +++ b/docs/misc/xen-command-line.markdown @@ -1000,6 +1000,16 @@ supported only when compiled with XSM on x86. Control Xens use of the APEI Hardware Error Source Table, should one be found. +### hmp-unsafe (arm) +> `= ` + +> Default : `false` + +Say yes at your own risk if you want to enable heterogenous computing +(such as big.LITTLE). This may result to an unstable and insecure +platform. When the option is disabled (default), CPUs that are not +identical to the boot CPU will be parked and not used by Xen. + ### hpetbroadcast > `= ` diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c index 1255185..7ea4e41 100644 --- a/xen/arch/arm/smpboot.c +++ b/xen/arch/arm/smpboot.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -69,6 +70,13 @@ DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_sibling_mask); /* representing HT and core siblings of each logical CPU */ DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_core_mask); +/* + * By default non-boot CPUs not identical to the boot CPU will be + * parked. + */ +static bool __read_mostly opt_hmp_unsafe = false; +boolean_param("hmp-unsafe", opt_hmp_unsafe); + static void setup_cpu_sibling_map(int cpu) { if ( !zalloc_cpumask_var(&per_cpu(cpu_sibling_mask, cpu)) || @@ -255,6 +263,9 @@ void __init smp_init_cpus(void) else acpi_smp_init_cpus(); + if ( opt_hmp_unsafe ) + warning_add("WARNING: HMP COMPUTING HAS BEEN ENABLED.\n" + "It has implications on the security and stability of the system.\n"); } int __init @@ -292,6 +303,21 @@ void start_secondary(unsigned long boot_phys_offset, init_traps(); + /* + * Currently Xen assumes the platform has only one kind of CPUs. + * This assumption does not hold on big.LITTLE platform and may + * result to instability and insecure platform. Better to park them + * for now. + */ + if ( !opt_hmp_unsafe && + current_cpu_data.midr.bits != boot_cpu_data.midr.bits ) + { + printk(XENLOG_ERR "CPU%u MIDR (0x%x) does not match boot CPU MIDR (0x%x).\n", + smp_processor_id(), current_cpu_data.midr.bits, + boot_cpu_data.midr.bits); + stop_cpu(); + } + mmu_init_secondary_cpu(); gic_init_secondary_cpu();