Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752298AbbBRJdI (ORCPT ); Wed, 18 Feb 2015 04:33:08 -0500 Received: from mail-bl2on0129.outbound.protection.outlook.com ([65.55.169.129]:64704 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751165AbbBRJdE (ORCPT ); Wed, 18 Feb 2015 04:33:04 -0500 From: Bogdan Purcareata To: , , , , CC: , , , Bogdan Purcareata Subject: [PATCH 2/2] powerpc/kvm: Limit MAX_VCPUS for guests running on RT Linux Date: Wed, 18 Feb 2015 09:32:35 +0000 Message-ID: <1424251955-308-3-git-send-email-bogdan.purcareata@freescale.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1424251955-308-1-git-send-email-bogdan.purcareata@freescale.com> References: <1424251955-308-1-git-send-email-bogdan.purcareata@freescale.com> X-EOPAttributedMessage: 0 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=bogdan.purcareata@freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; X-Forefront-Antispam-Report: CIP:192.88.168.50;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(339900001)(77096005)(6806004)(19580405001)(19580395003)(2201001)(2950100001)(50226001)(36756003)(229853001)(76176999)(105606002)(49486002)(106466001)(104016003)(50986999)(62966003)(47776003)(48376002)(50466002)(46102003)(77156002)(92566002)(85426001)(33646002)(87936001)(2101003);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2PR03MB191;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;MLV:sfv;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:BY2PR03MB191; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005003);SRVR:BY2PR03MB191; X-Forefront-PRVS: 04916EA04C X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:;SRVR:BY2PR03MB191; X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2015 09:33:00.4504 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d;Ip=[192.88.168.50] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR03MB191 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1729 Lines: 45 Due to the introduction of the raw_spinlock for the KVM openpic, guests with a high number of VCPUs may induce great latencies on the underlying RT Linux system (e.g. cyclictest reports latencies of ~15ms for guests with 24 VCPUs). This can be further aggravated by sending a lot of external interrupts to the guest. A malicious app can abuse this scenario, causing a DoS of the host Linux. Until the KVM openpic code is refactored to use finer lock granularity, impose a limitation on the number of VCPUs a guest can have when running on a PREEMPT_RT_FULL system with KVM_MPIC emulation. Signed-off-by: Mihai Caraman Signed-off-by: Bogdan Purcareata Reviewed-by: Scott Wood --- arch/powerpc/include/asm/kvm_host.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h index 8ef0512..6f6b928 100644 --- a/arch/powerpc/include/asm/kvm_host.h +++ b/arch/powerpc/include/asm/kvm_host.h @@ -36,8 +36,14 @@ #include #include +#if defined(CONFIG_PREEMPT_RT_FULL) && defined(CONFIG_KVM_MPIC) +/* Limit the number of vcpus due to in-kernel mpic concurrency */ +#define KVM_MAX_VCPUS 4 +#define KVM_MAX_VCORES 4 +#else #define KVM_MAX_VCPUS NR_CPUS #define KVM_MAX_VCORES NR_CPUS +#endif #define KVM_USER_MEM_SLOTS 32 #define KVM_MEM_SLOTS_NUM KVM_USER_MEM_SLOTS -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/