From patchwork Wed Nov 13 13:47:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 11241931 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2614D1747 for ; Wed, 13 Nov 2019 13:48:52 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 02195222BD for ; Wed, 13 Nov 2019 13:48:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="SmdVTsXc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 02195222BD Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amazon.com Authentication-Results: mail.kernel.org; spf=none 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.89) (envelope-from ) id 1iUszg-0002Bg-BW; Wed, 13 Nov 2019 13:47:36 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iUsze-0002BU-N1 for xen-devel@lists.xenproject.org; Wed, 13 Nov 2019 13:47:34 +0000 X-Inumbo-ID: 255f5a90-061c-11ea-a230-12813bfff9fa Received: from smtp-fw-4101.amazon.com (unknown [72.21.198.25]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 255f5a90-061c-11ea-a230-12813bfff9fa; Wed, 13 Nov 2019 13:47:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1573652854; x=1605188854; h=from:to:cc:subject:date:message-id:mime-version; bh=gRORxlqk4UPl2Q1cABjRJe3672NGCKyCe+lafu9Z3Wo=; b=SmdVTsXcVmiDSB/XG2Tu8V/49YabXIGSrejxma4ch6D5jC66kzUa7VPz gD3ILuEpcaY5sfwHP23zklqBflQUjW0OUOOAM6Mz/NVgxCYh0gZdXaZ6l tlaA1Gr3q5NlLqlcHvo/Fv9F3SIyCEpuBPlXEuaPXivXfFlGeYfBLni3D g=; IronPort-SDR: sWD26fuw45xmQw6EkdmlG7MnihHbHuQaP5QkxwjCo2F2sPwTqQl5nrehZZjj5lXyj/QW26d5zG dym9Huwnf9dA== X-IronPort-AV: E=Sophos;i="5.68,300,1569283200"; d="scan'208";a="3678586" Received: from iad6-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-1d-38ae4ad2.us-east-1.amazon.com) ([10.124.125.6]) by smtp-border-fw-out-4101.iad4.amazon.com with ESMTP; 13 Nov 2019 13:47:34 +0000 Received: from EX13MTAUEA001.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan2.iad.amazon.com [10.40.159.162]) by email-inbound-relay-1d-38ae4ad2.us-east-1.amazon.com (Postfix) with ESMTPS id EFFF5A2057 for ; Wed, 13 Nov 2019 13:47:33 +0000 (UTC) Received: from EX13D32EUC001.ant.amazon.com (10.43.164.159) by EX13MTAUEA001.ant.amazon.com (10.43.61.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 13 Nov 2019 13:47:33 +0000 Received: from EX13MTAUEB001.ant.amazon.com (10.43.60.96) by EX13D32EUC001.ant.amazon.com (10.43.164.159) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 13 Nov 2019 13:47:32 +0000 Received: from CBG-5CG9341D0C.cbg10.amazon.com (10.55.227.12) by mail-relay.amazon.com (10.43.60.129) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Wed, 13 Nov 2019 13:47:31 +0000 From: Paul Durrant To: Date: Wed, 13 Nov 2019 13:47:29 +0000 Message-ID: <20191113134729.1121-1-pdurrant@amazon.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Precedence: Bulk Subject: [Xen-devel] [PATCH] domain_create: honour global grant/maptrack frame limits... X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Paul Durrant Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" ...when their values are larger than the per-domain configured limits. Signed-off-by: Paul Durrant --- After mining through commits it is still unclear to me exactly when Xen stopped honouring the global values, but I really think this commit should be back-ported to stable trees as it was a behavioural change that can cause domUs to fail in non-obvious ways. --- xen/common/domain.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/xen/common/domain.c b/xen/common/domain.c index 611116c7fc..aad6d55b82 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -335,6 +335,7 @@ struct domain *domain_create(domid_t domid, enum { INIT_watchdog = 1u<<1, INIT_evtchn = 1u<<3, INIT_gnttab = 1u<<4, INIT_arch = 1u<<5 }; int err, init_status = 0; + unsigned int max_grant_frames, max_maptrack_frames; if ( config && (err = sanitise_domain_config(config)) ) return ERR_PTR(err); @@ -456,8 +457,17 @@ struct domain *domain_create(domid_t domid, goto fail; init_status |= INIT_evtchn; - if ( (err = grant_table_init(d, config->max_grant_frames, - config->max_maptrack_frames)) != 0 ) + /* + * Make sure that the configured values don't reduce any + * global command line override. + */ + max_grant_frames = max(config->max_grant_frames, + opt_max_grant_frames); + max_maptrack_frames = max(config->max_maptrack_frames, + opt_max_maptrack_frames); + + if ( (err = grant_table_init(d, max_grant_frames, + max_maptrack_frames)) != 0 ) goto fail; init_status |= INIT_gnttab;