From patchwork Wed Nov 13 13:53:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 11241947 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 DC99016B1 for ; Wed, 13 Nov 2019 13:55:01 +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 B6DB0207FC for ; Wed, 13 Nov 2019 13:55:01 +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="m/zioUjv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B6DB0207FC 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 1iUt5b-0003JD-UY; Wed, 13 Nov 2019 13:53:43 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iUt5Z-0003J4-Vf for xen-devel@lists.xenproject.org; Wed, 13 Nov 2019 13:53:42 +0000 X-Inumbo-ID: ffd2ad3a-061c-11ea-9631-bc764e2007e4 Received: from smtp-fw-9102.amazon.com (unknown [207.171.184.29]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id ffd2ad3a-061c-11ea-9631-bc764e2007e4; Wed, 13 Nov 2019 13:53:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1573653221; x=1605189221; h=from:to:cc:subject:date:message-id:mime-version; bh=x0qPvmJJKKo+lzfFRKT3yAkLsUMr2Z/MZkklkH7oilY=; b=m/zioUjvHJCeyr4M8jHeSV8woKgMT53d9e7kueaw2M1cGB+tWumT0V6p b2MQAclTI4zxQ5JgBbzcp1SDiQZm/LG7avFhldGtAuqunkwQxupHVUEpX l+Pu0iz0Bt2I+V2uvcI6Dgfoiir4ZpTLsgbGs5FsREcYQ9v8HMd1+rowP E=; IronPort-SDR: Gkrc2Lu72X1ILHEEWuSgHwOwqrlCEc6+w/bZxcgRCCQ3QMNG9WL4yvwh+6KEB+mbnZdlepJsvz XA9AycOK99cA== X-IronPort-AV: E=Sophos;i="5.68,300,1569283200"; d="scan'208";a="6894412" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-2c-168cbb73.us-west-2.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-9102.sea19.amazon.com with ESMTP; 13 Nov 2019 13:53:38 +0000 Received: from EX13MTAUEA001.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan2.pdx.amazon.com [10.170.41.162]) by email-inbound-relay-2c-168cbb73.us-west-2.amazon.com (Postfix) with ESMTPS id E4569A1D3D; Wed, 13 Nov 2019 13:53:37 +0000 (UTC) Received: from EX13D32EUC004.ant.amazon.com (10.43.164.121) by EX13MTAUEA001.ant.amazon.com (10.43.61.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 13 Nov 2019 13:53:37 +0000 Received: from EX13MTAUEB001.ant.amazon.com (10.43.60.96) by EX13D32EUC004.ant.amazon.com (10.43.164.121) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 13 Nov 2019 13:53:36 +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:53:34 +0000 From: Paul Durrant To: Date: Wed, 13 Nov 2019 13:53:30 +0000 Message-ID: <20191113135330.1209-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: Stefano Stabellini , Julien Grall , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Paul Durrant , Ian Jackson , Jan Beulich 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 --- Cc: Andrew Cooper Cc: George Dunlap Cc: Ian Jackson Cc: Jan Beulich Cc: Julien Grall Cc: Konrad Rzeszutek Wilk Cc: Stefano Stabellini Cc: Wei Liu 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;