From patchwork Thu Mar 1 23:26:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 130432 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp644839lja; Thu, 1 Mar 2018 15:29:01 -0800 (PST) X-Google-Smtp-Source: AG47ELsMZuAYXOMn3lGD6U59cNB46uTxvD70Pq3O1ktOmyn4iUeRVI7m+qL55iIPNbNvN0cTjM2j X-Received: by 10.107.8.2 with SMTP id 2mr4036031ioi.167.1519946941559; Thu, 01 Mar 2018 15:29:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519946941; cv=none; d=google.com; s=arc-20160816; b=HtFDeggSyT/HLyV2TIkzheAyNrpM02STDNvvotl7NbyIDV8TcxwkAjznlCyPZvgTXG EM1td14OmiDTW6MfDJ4v+y9+97U0lpa5JntDA6COU0SKZRQVIXEqajxnC0IVykqg4FvT 2zXUvhaCV4W77BwvmU3SQwzNvKzIZPT0L9OQ5E7pOgvwIMSUjHbpPOXvM80Whmd23IH1 Sx6DkBuLeJLhVNz54rgBiCNBEdHN2gPEYbYpoVxjUJGtoOOTtvSmYM2MHu/gkzU/CR7K XFJwg9+UZuoqyO0DIEXGpfRNN9gYH6ecA2jFg4d+q7hi+PFdrqaPERPc+Jr/lWKrSFXT VNuA== 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=0wkZVH0x9DLbDEMjBlSOIarKAoqrzKV8ylrwC8ewRW4=; b=jLnG0uSwSt36NRQy4r8RDl/xK36X7KZ+qvytHh0FzDvGJEe+SZIVy5QPxGEKU7VJMy xP2xycx7INsEkKUGJr8O0sUBgK8orpfS+yI73uOfMZVx6EIpdtvwB3K/FBn72aLXefhs 2B2DeC+zzUn7DcM+p9b+C/9INnguGi7sk4e0t2fGpk0nEhgXXD0bgpXkRP26mdyHfnBt Z0FGYVNVzrICUQoj+CUWBr0I2DkTY5BZJ1XckUe6z/Mc6/enNn67FzQN7WOeKC0JvcJ4 fD547kNMt93bej9UPIPjPIJ11uK2oHG5trc9H8mSMAgaMdw/CE+HabJGTMj7+Gwb4Zqw BTgA== 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 v127si40879itc.61.2018.03.01.15.29.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Mar 2018 15:29:01 -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 1erXb5-0008IK-Go; Thu, 01 Mar 2018 23:26:47 +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 1erXb3-0008Ed-TM for xen-devel@lists.xen.org; Thu, 01 Mar 2018 23:26:45 +0000 X-Inumbo-ID: 4697186c-1da8-11e8-b9b1-635ca7ef6cff Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-amaz-eas1.inumbo.com (Halon) with ESMTPS id 4697186c-1da8-11e8-b9b1-635ca7ef6cff; Thu, 01 Mar 2018 23:28:41 +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 D182521771; Thu, 1 Mar 2018 23:26:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D182521771 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, 1 Mar 2018 15:26:30 -0800 Message-Id: <1519946795-7191-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 v3 1/6] 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 Reviewed-by: Julien Grall Acked-by: Julien Grall --- 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 f73990f..7b80119 100644 --- a/docs/misc/xen-command-line.markdown +++ b/docs/misc/xen-command-line.markdown @@ -985,6 +985,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();