From patchwork Thu Mar 15 20:30:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 131877 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp1579824ljb; Thu, 15 Mar 2018 13:33:56 -0700 (PDT) X-Google-Smtp-Source: AG47ELvPiAauy0xJJU237McRU1yim8NRmDqbWK9+qZ2PX1hbma/db4e/9oIFTNxtt8FZgwN9KI6h X-Received: by 10.107.10.219 with SMTP id 88mr11040374iok.259.1521146036844; Thu, 15 Mar 2018 13:33:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521146036; cv=none; d=google.com; s=arc-20160816; b=C4hvKUGM+RXO2/KrIbAww1IecTJcgAh8cj2lMCs+7V84PF8fnDGokNTnRtQpLYxSK4 Iu9l3AYC51XfvV2bbabqrFJ/ddNW+9HskJQGke1jy2S27lyKYKFz5eWQToaDinkll4SE 3UrrrCNxN4fWDdB16XKqYWpRiNg6EhrS6ii29ug933jVU8LK+KDTiT8sHtnugEqMZJJJ 23Pc9ata32Yo6zy7rtdyuQRYjFY5wD/CKwKk0Qt/9ZKNmCVXsUXyNRp5fLj7fC3f5TwW ICa4XxFneZ8BO8p0lzGYNuOzVU4pwwTXMLYhw7IhfywK56BqxG+7iLorGFElTFMTC4uv DXOg== 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:dkim-signature:arc-authentication-results; bh=EQTuaaOS1CYQ8fxxDpHfsuscaMyIGGwRg1XzW1Qrv9Q=; b=vJf2IOiG/BtjxzpuXJDL5fyPeXwbZEY4pubNG3rdfNqPRtKlE+AfhhdK67Lsfhcl5F Pzpayr24NNN8k16cizSejEJamF8YjYHp8WNWVdDkAQIuWxH/uf7GMl09sh2U+UaIfUK7 7UsNr1kb6nY5yDtTk8aq6yJsSi86kLUOGj2Ywt/YvTt41yLFzYydqd6JX3oG//BHwyxs FmZZNaDOm8AIE3i5VMfjY+mfnWPsWkzAIjxlpcrPxpkROoM5LBbKJdBzEbc+17aIi3Hd lsQX64lXZ4SN20OjL35/zHrWe50gyECSSOmHusy4rFHUCgg1Tsn/BFdJWe6G/7/V8JzT VBMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=J9bTQpMl; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id u128si1434678itd.36.2018.03.15.13.33.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Mar 2018 13:33:56 -0700 (PDT) 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; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=J9bTQpMl; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.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 1ewZXa-0004qe-ID; Thu, 15 Mar 2018 20:31:58 +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 1ewZXY-0004kG-VQ for xen-devel@lists.xenproject.org; Thu, 15 Mar 2018 20:31:57 +0000 X-Inumbo-ID: e37db16e-288f-11e8-9728-bc764e045a96 Received: from mail-wm0-x241.google.com (unknown [2a00:1450:400c:c09::241]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id e37db16e-288f-11e8-9728-bc764e045a96; Thu, 15 Mar 2018 21:31:50 +0100 (CET) Received: by mail-wm0-x241.google.com with SMTP id x7so12911049wmc.0 for ; Thu, 15 Mar 2018 13:31:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=g6t6qa6Zgto8PdZ2FDn8SszJDZh20+D4FJb9C+fBpCI=; b=J9bTQpMl3brpaCyUjMs9bTPojmncgc3lpPPD+r4XvoNv33k2aqWwiKGvsajWwcqOYR 7L1UOnApB2dAi/CMSUvv8u2L8Qiqj0WbQMfd77NwzoMRFGX87oA5nh7cr2RVimD47mcM qME3RE92NTRnm4QLcwc7zUoAE4gT2j21CFv0Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=g6t6qa6Zgto8PdZ2FDn8SszJDZh20+D4FJb9C+fBpCI=; b=OJuAPUCo7PiheCCVqKtI4s9s3+CEsOUMnOpQKCuRZdyHue9B56H+C/Poxchqc2nGOc GwRIpJfGlO9EhXV4WfwEua48fDRZvoo5HoRULxshlbwhLb7LUzx9ILTE1Z5CokFeiJw/ 0CjIzT9cz46iZJQ0d9329KEo1jkUw8jrbza6vMy2c/4ZqavhAPz/MP2EyP87OxXXynzU lmmHfU9fj9x4CQpvzX8gcaJ147raabHMx2HCrhY6v0mGxV1+BY24auqoNvvHNN8qkP5w xtbq06wFMHg/eRNG9RiFhW3FjbeK51PGfeEpeWlo5T1kOmhh9Qtakm9of2JshJLxpxZD J03Q== X-Gm-Message-State: AElRT7GNdU99dLWvdi7zPq0wdoqKv3nd+D1lh1njA5QbcpmwMtGmvBwc oI/Uap7LwK3KftAwF5WhcuIcEQ== X-Received: by 10.28.207.201 with SMTP id f192mr5648183wmg.81.1521145914722; Thu, 15 Mar 2018 13:31:54 -0700 (PDT) Received: from e104803-lin.lan (mail.andrep.de. [217.160.17.100]) by smtp.gmail.com with ESMTPSA id w125sm3217102wmw.20.2018.03.15.13.31.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Mar 2018 13:31:54 -0700 (PDT) From: Andre Przywara To: Stefano Stabellini , Julien Grall Date: Thu, 15 Mar 2018 20:30:49 +0000 Message-Id: <20180315203050.19791-45-andre.przywara@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180315203050.19791-1-andre.przywara@linaro.org> References: <20180315203050.19791-1-andre.przywara@linaro.org> Cc: xen-devel@lists.xenproject.org Subject: [Xen-devel] [PATCH v2 44/45] ARM: new VGIC: Allocate two pages for struct vcpu 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" At the moment we allocate exactly one page for struct vcpu on ARM, also have a check in place to prevent it growing beyond 4KB. As the struct includes the state of all 32 private (per-VCPU) interrupts, we are at 3840 bytes on arm64 at the moment already. Growing the per-IRQ VGIC structure even slightly makes the VCPU quickly exceed the 4K limit. The new VGIC will need more space per virtual IRQ. I spent a few hours trying to trim this down, but couldn't get it below 4KB, even with the nasty hacks piling up to save some bytes here and there. It turns out that beyond efficiency, maybe, there is no real technical reason this struct has to fit in one page, so lifting the limit to two pages seems like the most pragmatic solution. Restrict this to compiling with the new VGIC and for ARM64 only. Signed-off-by: Andre Przywara --- Changelog v1 ... v2: - confine change to new VGIC and ARM64 only xen/arch/arm/domain.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 18b915d2e9..3fba05bda5 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -508,10 +508,25 @@ void dump_pageframe_info(struct domain *d) struct vcpu *alloc_vcpu_struct(void) { struct vcpu *v; + + /* + * The new VGIC has a bigger per-IRQ structure, so we need more than one + * page on ARM64. Cowardly increase the limit in this case. + */ +#if defined(CONFIG_NEW_VGIC) && defined(CONFIG_ARM_64) + BUILD_BUG_ON(sizeof(*v) > 2 * PAGE_SIZE); + v = alloc_xenheap_pages(1, 0); + if ( v != NULL ) { + clear_page(v); + clear_page((void *)v + PAGE_SIZE); + } +#else BUILD_BUG_ON(sizeof(*v) > PAGE_SIZE); v = alloc_xenheap_pages(0, 0); if ( v != NULL ) clear_page(v); +#endif + return v; }