From patchwork Mon Feb 19 21:58:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 128847 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3975201ljc; Mon, 19 Feb 2018 14:00:56 -0800 (PST) X-Google-Smtp-Source: AH8x227Xz2+0IIwIOcBhfNAjZd+VcD7+kZNwK0BRQTIVlFmAQABQWrk9o1/s6pn5HzuWbOrOIy8N X-Received: by 10.36.210.65 with SMTP id z62mr4789864itf.49.1519077656566; Mon, 19 Feb 2018 14:00:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519077656; cv=none; d=google.com; s=arc-20160816; b=ZNFq19+5Tc55BJns+cUed8xlB4RyeEnjfWKt7tI3q7v5RfehxLdFweQMnJmAjbvl2a WRTzxCoLNGOfdINFGkC5gJh6OltRs41kbIrmtnc3oNKyfsk0oioXRSTAa8jHF2cmeb8o Xobe28QnJYQrjBWlrrtce/H8EPnMo9XE+7QNts1UbnfAvLsVvBnUe3zSiOK0mstNHst+ cD+vEU4wbloCIXoQPJyOodCX0PW3kkJ0lsIEfLQltvXfUKf8uls7vk7m0+zglv6nJZHv OvQyQuaWNHHGEf0LcbyKRV809976RuOhJDcfcnjL8UGgSwimQWfcX9PF3JHRflFIt5l7 2w0Q== 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=Td/wciPvtvMDP/Pf+cnjKCDdVuesBN02FQePTZUT4WsIXDHu+uZUARWBTPNIKQYVSX AEUv2yjyA3MT3XC/GzqXT+YAYXNHij5f8Wzb8OKeN81LzyWXxZXKakbcXYQZTC+uF7Mc IpPMy6RN2EWqvDodInrCnlrGxShRwghhq664oY3yJAJGDg4I34W81vpqqe/xfV1Is7EZ 3PE217gvI41aYclz/xdb1L1O80ISZc7BoJNS4CqkPnshqFk3lH6osrd8pX+6KTE63Yxq 67AXP5lt/uBVbqjo7XdH2ltoVZMOuJhuyaxpU0AoHWwA8r8mvyxL6xiij+dTAKF/T9vb 8W/Q== 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 p135si8034234itg.149.2018.02.19.14.00.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Feb 2018 14:00:56 -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 1entSH-0003fP-1M; Mon, 19 Feb 2018 21:58:37 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1entSE-0003eL-RE for xen-devel@lists.xen.org; Mon, 19 Feb 2018 21:58:34 +0000 X-Inumbo-ID: ec3b2f11-15bf-11e8-ba59-bc764e045a96 Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id ec3b2f11-15bf-11e8-ba59-bc764e045a96; Mon, 19 Feb 2018 22:57:48 +0100 (CET) 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 DACEB20C51; Mon, 19 Feb 2018 21:58:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DACEB20C51 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: Mon, 19 Feb 2018 13:58:25 -0800 Message-Id: <1519077510-22405-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 v2 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 Reviewed-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 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();