From nobody Wed Nov 5 05:08:43 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1532529309752531.2713101964131; Wed, 25 Jul 2018 07:35:09 -0700 (PDT) Received: from localhost ([::1]:51567 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiKsZ-00019g-5H for importer@patchew.org; Wed, 25 Jul 2018 10:35:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47534) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fiKmP-00058u-1B for qemu-devel@nongnu.org; Wed, 25 Jul 2018 10:28:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fiKmM-0000Go-0V for qemu-devel@nongnu.org; Wed, 25 Jul 2018 10:28:41 -0400 Received: from mail-by2nam01on0099.outbound.protection.outlook.com ([104.47.34.99]:45281 helo=NAM01-BY2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fiKmL-0000EQ-JK; Wed, 25 Jul 2018 10:28:37 -0400 Received: from Jupiter.local (141.226.29.227) by SN2PR07MB2622.namprd07.prod.outlook.com (2603:10b6:804:8::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.16; Wed, 25 Jul 2018 14:28:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janustech.onmicrosoft.com; s=selector1-janustech-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oHhwlf2eFrXs5XRabfOFZiDazu7VPVvaYvjG2kVRxQw=; b=MZa1QHL8dCH/bQMTcE7/F6gvIRnzD1+GuSmfACTxT28RQgeyw0usOlZ03uHViWvM7KqHTgTc9tgobGPROuPFRn25AA5oXa6A2WiD6VxrVZrQDLPSxYCDExhhfFRv/YDouR4iK5dwuTB/XOkEXhna2eWtrSqhvAOlf+NheCf0XEA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; From: Leonid Bloch To: qemu-devel@nongnu.org Date: Wed, 25 Jul 2018 17:27:57 +0300 Message-Id: <20180725142758.9980-4-lbloch@janustech.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180725142758.9980-1-lbloch@janustech.com> References: <20180725142758.9980-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: HE1PR05CA0386.eurprd05.prod.outlook.com (2603:10a6:7:94::45) To SN2PR07MB2622.namprd07.prod.outlook.com (2603:10b6:804:8::6) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fae0b1cd-0822-4125-b0e9-08d5f23ae76f X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(7021125)(8989117)(5600073)(711020)(4534165)(7022125)(4603075)(4627221)(201702281549075)(8990107)(7048125)(7024125)(7027125)(7028125)(7023125)(2017052603328)(7153060)(7193020); SRVR:SN2PR07MB2622; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2622; 3:tD/9pREH8zewxSkWYLsfmm5bJwnd/x48gHYvHyHXGja98a7+pHZ7yLnEKh7h1EpclUVdnRfS9tJPBRSffUpeN0CdNloiWFUfym1LPNOKaCyN+DvPfESJI5dXMnbzuoUm+gwo+KJb5ROJOKwre1lBuF4+86rTgH3c5ftldYm0DTyXYhucjVRLEN8/6dyJx1UApoh0O9KEaRaITShdVZbrZ+JRUVYtM1JKzvUkRVgIYBf0fqrktA3+OmdM6J8ZLkiX; 25:Iuo0rjWGzRZFnV6A3TLfCslkv7LI53r1ri5uLnVGAZGfmi5Qw0WfFaU26xdGkflT0QOTbT1NVUekeVlwY2PnppcOaqOEOik7TZWLsKXCXj3eeI1WfM/+o9qX/d1KAw6EmFeX1AVLsXn9jH6shXVHU2+WcjtPsNOQ6KP/jLIyVuEhe8t0dOGpSJhYKvw3fecb50KBPbjbyu8PAVTz6S+CxsTlL+OuFhm4yH6Hty37ncpxmqfVzQ7SEaYgeK9twCu3x+syQ9f4vpvG7z8C6tbTXP2q+3aQBbkbQiJSqkvgo4cWV6B1aK78VXeBttNdbQgs9zAugvs1mRhBkbpHSg18Bw==; 31:kvEcTSFipWBGYGZQodYJyYgO6Ocrn6yfeR19FxNX1TKUQFkXpKsaVNcidJ8bEleOWxJXTvuSqT0tAoreipnhjyrwfJY1MwIVhBjVqgFruPJ+kKltGGg+AhfgM4RuKOLka70vjEdb3wrMn2llVD5UQ1fBTTjn/HCRpLYDVko3VM2o+PVmuWecq+JrXpUbWwaSaGgL5KNbrseZ4DDo2U2wDggN0RXvIl0cpkhn/0D49JY= X-MS-TrafficTypeDiagnostic: SN2PR07MB2622: X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231311)(944501410)(52105095)(10201501046)(3002001)(149027)(150027)(6041310)(20161123560045)(2016111802025)(20161123558120)(20161123562045)(20161123564045)(6072148)(6043046)(201708071742011)(7699016); SRVR:SN2PR07MB2622; BCL:0; PCL:0; RULEID:; SRVR:SN2PR07MB2622; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2622; 4:Ok2CEIeRomJYhGGivsl+hvXRFI7XJ1GuWITmPJfpic1Cy9S6AJPVSc2Vr4afmkY1w3+lxBjk+S4FbcxxhpL2u8W++18d7t6dP6f73p3qwW1xh2Yug/HWzSu/9xUNQwJwkx1x4QfvHrvMas37uk/KAwpNZT4Ww6nuKgWuW/Yd+DXJPoRT24QlnjCfACkucXSSCQOIafX9o1jUY4EgERlQwop3EsHtnBCbmrX2EU2L3uhsimbo9CzUF8uWg9VUbgqW1Q1xv4TEHWhptUmgQ94ZGQ== X-Forefront-PRVS: 0744CFB5E8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(376002)(366004)(346002)(39830400003)(396003)(136003)(189003)(199004)(446003)(11346002)(2616005)(476003)(486006)(54906003)(956004)(316002)(52116002)(51416003)(76176011)(16586007)(1076002)(3846002)(6116002)(2351001)(186003)(16526019)(36756003)(26005)(97736004)(48376002)(106356001)(105586002)(86362001)(575784001)(8936002)(68736007)(50226002)(53936002)(6512007)(7736002)(6916009)(6666003)(478600001)(6486002)(2361001)(305945005)(25786009)(14444005)(2906002)(386003)(50466002)(6506007)(47776003)(4326008)(8676002)(107886003)(66066001)(5660300001)(81166006)(81156014); DIR:OUT; SFP:1102; SCL:1; SRVR:SN2PR07MB2622; H:Jupiter.local; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: None (protection.outlook.com: janustech.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR07MB2622; 23:0ap3ErjMHZ5iDLFAJBXY4fgU1VqhXZPOH62w3aaUk?= =?us-ascii?Q?3Sj/1a5qnX3Bq5O6kPwiVaXaI5m1YEWez1sThO9oQU2XV5Au7Kf8Cr//mV0l?= =?us-ascii?Q?Z5SPs8h1BFgVDEPg3919p2qD5E1MRdFJaD8u/41A578wdwyt5Rzs3eO29bBP?= =?us-ascii?Q?SwpFpBWrIu/gEbFLnxcWCEBStzdtgs4UNUTzVPn1fsWSub9QRrBgHa/rFm24?= =?us-ascii?Q?QGxF2BwMN+Tj2655HXPQWQtxzR7tY/Tot+KERk/gPBK6PgklZt8gV7TaKG3I?= =?us-ascii?Q?I1bImAExBOi7IbKRySSn4kfiNBrClG2r9K3n94rJ0NpX+UAU12UhSwlrQdzv?= =?us-ascii?Q?7TgQF0SmFpBRUtS6KcFe03EknNTqTBne4EXB0ZyUM+/Dr97CjJ9SJkH8vTYC?= =?us-ascii?Q?nymwBLSedncjpzlBSlX+OPCSuyKGoD5FF179wmE/UzyxswFEoRiDA1a9KsrT?= =?us-ascii?Q?5H9gUoJ5opx129uY0HWj3TPDE60JqlJBgaWloRxsgpcwCzoJ0/C7ygOBpZ1R?= =?us-ascii?Q?9xnKwhRCjFwbOeViqp4tq2COA0UtnhHtwkv3HQUAI24Xxzs/BWXNXNnb1tSZ?= =?us-ascii?Q?sKREZAxckTorOngBNtJ57lt9JXeja76EVnqal9MEX9vQ5u4tH28DAyPiweID?= =?us-ascii?Q?giwigDFSE9rncQMPWKKL16j2iRXDzCcYO3PHeh2+0trm4eQAuyvair7nchLX?= =?us-ascii?Q?ifyw/hHwi9bqoKMDfTCiFpMvfFlAHAQs5rPzeSXcLYiFwbgs148om1bEMTfZ?= =?us-ascii?Q?YOZ3XBxuzpSm7fRJht3mlhFOTULIKH8kCcOWhJfD+sWLKMTTfstU9B8yak1T?= =?us-ascii?Q?n0DwcD9Iy8mZ/9NKOqTRuY60+04N7XBdL/sPorkdIXfFMDI0bcLL26BF7+1k?= =?us-ascii?Q?5DwNICHNnGWBnHi+OuXbEXdJFXYNkVy1Lyc91cIEFnOOFS2bvDJmT+fIG7yL?= =?us-ascii?Q?f1/nNWZr3bfVwdRlXXZlD92ViwqZbVHJOOwZxcsHgi2LyUwO7vm4YqSTx9QW?= =?us-ascii?Q?u02w6AF1jgoqGK1jSxSYaVDMxOmUTroEI5D8TqWilUeC6GRf7yy0y30CRPfq?= =?us-ascii?Q?fV4fuzhC6oKPUzqqCp1pEl6LS0c4ql92oxK8/n+PcOIwe7kllDHyn1FnXq7Y?= =?us-ascii?Q?ezJtksYxPyi9/UP6sUYr6SSFqlXjJLjfQpNmMILJj2XYgEk7eJlx+Fu6sgs5?= =?us-ascii?Q?dTHqF7dDwPsirCdl9J5lGie1rNwFabc2Q/MX33ON84CDqFIkBsLD7yqEs27A?= =?us-ascii?Q?Ancx5+B4CfnZiQEchNMB+7Niurbl4enp3raMAaaoSFhM1zupfHfAAVXVFfcb?= =?us-ascii?Q?ZumbqHwPP0LJErUP+obWmk=3D?= X-Microsoft-Antispam-Message-Info: RurM0NZ20lbDbpHxqIvPo+s88gslTiIWarWNYnDOjGvDVlH8sSSfA8atrydpXWYLu86tIxdUORL2klcW2tMwP5V1k4RFn085evrPSpBgRX7Xv3UWLN3RwQ+rtGofj7oyvVwE645v7DeDb23jVrEeIdxcterC2sMIjnXCM+22Pt0RwP0RwMMrJCV3ypLO5YgRlJsRJdLiLSQbN9FvnXF0P2ndBaDMC+KVM90uaB+PRjGA43jlQy//pbkcwUmqa/hZdZxhzEiClFi9feIGl+9tOrffh4dKJ7xKG3Qh6Kj/1gi2fWOKZkGo+hzkmrQ9J4efiKcb20m2dAVrOn7V8moQmBSGhqu0nOsJ2eab7zKDX8E= X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2622; 6:YQHr4IcHeK5Vx9wan34DKdQhudir571k1phkUyInY4Z3rCQ4Cbmlet7aFVUCNctBw/um95CMzWskj/oQW36b82LCMvEYvBaXg5LBYcFLd+ort5hlsWh9g42gS5hCwQNqIiDe4WTA4/pjIqj3SFvYB1GWYomD49/IJt0oAEJcfe0mM4x3jqpzfQiZbiY3ZDL72/slAeyocbQBcMJ1GGV2YLlQpvBf3V2EnBkkyLXanFB+9ctG3Z8EP64ehDBSy/uNpFF4+yHswLMRwitja1qJAl1jRLxMYwjsBrLFc51VecswKMGxERCd78/YXA14xRTqUZfnauF4yqeenqjqDOvVKDf5sc+jxG1TIlCc4oNVE/Wzdf28yh778BJLAakK/mRvH8kx4lFv35Ry69P5suIjVvvOEhQiW+tRBDRRq62IBZU2odDuGNZTorD5DnYOxpHt5GFQAYBdjoVE5NPsoS+bIw==; 5:p5X7OJtoV6EQlDejsH642YBzglCE/jKVLAiFm65zL/LvCbcLtydjzOGP9rFccOAwx8ehB7obL8bjH/rnWeOqktLefwrVieogA5ir7CU/sZSGmcI0FCd5glta4UKh2FQGgX4qHlXuBVSbo4O0VP5c4BxjpK9SZXn+rrKNVdecxdU=; 7:ETQtr0o5RwoZZLo0MqmD8hcSMueafbHi50mHQ0rSDW/82kr+B2lRLCRa9BBHPhx91LHJ/1eKx6oM27YejooaDrbkFcAM99a14ESi5Rwp+3LWx6ce7oJ2rSKHZ27dD2AhCb4YyT8WM4k05IdXon7ctvvJndR5HsyXdAKdckxLzGNgPWOqUmbhy3b6Tz4xyV5Bx93vLZ0J1v9FVc1foMum0zBpiDfHlE4bqm90h/GuOhJTStKfNv5zH4NQ4XFGvqxT SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2018 14:28:32.8299 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fae0b1cd-0822-4125-b0e9-08d5f23ae76f X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2622 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.34.99 Subject: [Qemu-devel] [PATCH v5 3/4] qcow2: Introduce an option for sufficient L2 cache for the entire image X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Leonid Bloch , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" An option "l2-cache-full" is introduced to automatically set the qcow2 L2 cache to a sufficient value for covering the entire image. The memory overhead when using this option is not big (1 MB for each 8 GB of virtual image size with the default cluster size) and it can noticeably improve performance when using large images with frequent I/O. Previously, for this functionality the correct L2 cache size needed to be calculated manually or with a script, and then this size needed to be passed to the "l2-cache-size" option. Now it is sufficient to just pass the boolean "l2-cache-full" option. Signed-off-by: Leonid Bloch --- block/qcow2.c | 35 ++++++++++++++++++++++++++++------- block/qcow2.h | 1 + docs/qcow2-cache.txt | 15 +++++++++++---- qapi/block-core.json | 8 +++++++- qemu-options.hx | 6 +++++- 5 files changed, 52 insertions(+), 13 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index ec9e6238a0..d8de9be3cd 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -695,6 +695,11 @@ static QemuOptsList qcow2_runtime_opts =3D { .type =3D QEMU_OPT_SIZE, .help =3D "Maximum L2 table cache size", }, + { + .name =3D QCOW2_OPT_L2_CACHE_FULL, + .type =3D QEMU_OPT_BOOL, + .help =3D "Create full coverage of the image with the L2 cache= ", + }, { .name =3D QCOW2_OPT_L2_CACHE_ENTRY_SIZE, .type =3D QEMU_OPT_SIZE, @@ -779,10 +784,12 @@ static void read_cache_sizes(BlockDriverState *bs, Qe= muOpts *opts, BDRVQcow2State *s =3D bs->opaque; uint64_t combined_cache_size; bool l2_cache_size_set, refcount_cache_size_set, combined_cache_size_s= et; + bool l2_cache_full_set; int min_refcount_cache =3D MIN_REFCOUNT_CACHE_SIZE * s->cluster_size; =20 combined_cache_size_set =3D qemu_opt_get(opts, QCOW2_OPT_CACHE_SIZE); l2_cache_size_set =3D qemu_opt_get(opts, QCOW2_OPT_L2_CACHE_SIZE); + l2_cache_full_set =3D qemu_opt_get_bool(opts, QCOW2_OPT_L2_CACHE_FULL,= 0); refcount_cache_size_set =3D qemu_opt_get(opts, QCOW2_OPT_REFCOUNT_CACH= E_SIZE); =20 combined_cache_size =3D qemu_opt_get_size(opts, QCOW2_OPT_CACHE_SIZE, = 0); @@ -793,6 +800,17 @@ static void read_cache_sizes(BlockDriverState *bs, Qem= uOpts *opts, *l2_cache_entry_size =3D qemu_opt_get_size( opts, QCOW2_OPT_L2_CACHE_ENTRY_SIZE, s->cluster_size); =20 + uint64_t virtual_disk_size =3D bs->total_sectors * BDRV_SECTOR_SIZE; + uint64_t max_l2_cache =3D virtual_disk_size / (s->cluster_size / 8); + + if (l2_cache_size_set && l2_cache_full_set) { + error_setg(errp, QCOW2_OPT_L2_CACHE_SIZE " and " + QCOW2_OPT_L2_CACHE_FULL " may not be set at the same ti= me"); + return; + } else if (l2_cache_full_set) { + *l2_cache_size =3D max_l2_cache; + } + if (combined_cache_size_set) { if (l2_cache_size_set && refcount_cache_size_set) { error_setg(errp, QCOW2_OPT_CACHE_SIZE ", " QCOW2_OPT_L2_CACHE_= SIZE @@ -800,8 +818,14 @@ static void read_cache_sizes(BlockDriverState *bs, Qem= uOpts *opts, "at the same time"); return; } else if (*l2_cache_size > combined_cache_size) { - error_setg(errp, QCOW2_OPT_L2_CACHE_SIZE " may not exceed " - QCOW2_OPT_CACHE_SIZE); + if (l2_cache_full_set) { + error_setg(errp, QCOW2_OPT_CACHE_SIZE " must be greater th= an " + "the full L2 cache if " QCOW2_OPT_L2_CACHE_FULL + " is used"); + } else { + error_setg(errp, QCOW2_OPT_L2_CACHE_SIZE " may not exceed " + QCOW2_OPT_CACHE_SIZE); + } return; } else if (*refcount_cache_size > combined_cache_size) { error_setg(errp, QCOW2_OPT_REFCOUNT_CACHE_SIZE " may not excee= d " @@ -809,14 +833,11 @@ static void read_cache_sizes(BlockDriverState *bs, Qe= muOpts *opts, return; } =20 - if (l2_cache_size_set) { + if (l2_cache_size_set || l2_cache_full_set) { *refcount_cache_size =3D combined_cache_size - *l2_cache_size; } else if (refcount_cache_size_set) { *l2_cache_size =3D combined_cache_size - *refcount_cache_size; } else { - uint64_t virtual_disk_size =3D bs->total_sectors * BDRV_SECTOR= _SIZE; - uint64_t max_l2_cache =3D virtual_disk_size / (s->cluster_size= / 8); - /* Assign as much memory as possible to the L2 cache, and * use the remainder for the refcount cache */ if (combined_cache_size >=3D max_l2_cache + min_refcount_cache= ) { @@ -829,7 +850,7 @@ static void read_cache_sizes(BlockDriverState *bs, Qemu= Opts *opts, } } } else { - if (!l2_cache_size_set) { + if (!l2_cache_size_set && !l2_cache_full_set) { *l2_cache_size =3D MAX(DEFAULT_L2_CACHE_BYTE_SIZE, (uint64_t)DEFAULT_L2_CACHE_CLUSTERS * s->cluster_size); diff --git a/block/qcow2.h b/block/qcow2.h index 81b844e936..151e014bd8 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -97,6 +97,7 @@ #define QCOW2_OPT_OVERLAP_BITMAP_DIRECTORY "overlap-check.bitmap-directory" #define QCOW2_OPT_CACHE_SIZE "cache-size" #define QCOW2_OPT_L2_CACHE_SIZE "l2-cache-size" +#define QCOW2_OPT_L2_CACHE_FULL "l2-cache-full" #define QCOW2_OPT_L2_CACHE_ENTRY_SIZE "l2-cache-entry-size" #define QCOW2_OPT_REFCOUNT_CACHE_SIZE "refcount-cache-size" #define QCOW2_OPT_CACHE_CLEAN_INTERVAL "cache-clean-interval" diff --git a/docs/qcow2-cache.txt b/docs/qcow2-cache.txt index 3673f2be0e..bae21061f3 100644 --- a/docs/qcow2-cache.txt +++ b/docs/qcow2-cache.txt @@ -110,11 +110,12 @@ How to configure the cache sizes Cache sizes can be configured using the -drive option in the command-line, or the 'blockdev-add' QMP command. =20 -There are three options available, and all of them take bytes: +There are four options available: =20 -"l2-cache-size": maximum size of the L2 table cache -"refcount-cache-size": maximum size of the refcount block cache -"cache-size": maximum size of both caches combined +"l2-cache-size": maximum size of the L2 table cache (bytes, K, M) +"refcount-cache-size": maximum size of the refcount block cache (bytes, = K, M) +"cache-size": maximum size of both caches combined (bytes, K, M) +"l2-cache-full": make the L2 cache cover the full image (boolean) =20 There are a few things that need to be taken into account: =20 @@ -130,6 +131,12 @@ There are a few things that need to be taken into acco= unt: memory as possible to the L2 cache before increasing the refcount cache size. =20 +- If "l2-cache-full" is specified, QEMU will assign enough memory + to the L2 cache to cover the entire size of the image. + +- "l2-cache-size" and "l2-cache-full" can not be set simultaneously, as + setting "l2-cache-full" already implies a specific size for the L2 cache. + - At most two of "l2-cache-size", "refcount-cache-size", and "cache-size" can be set simultaneously. =20 diff --git a/qapi/block-core.json b/qapi/block-core.json index d40d5ecc3b..c584059e23 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -2812,7 +2812,12 @@ # refcount block caches in bytes (since 2.2) # # @l2-cache-size: the maximum size of the L2 table cache in -# bytes (since 2.2) +# bytes (mutually exclusive with l2-cache-full) +# (since 2.2) +# +# @l2-cache-full: make the L2 table cache large enough to cover the +# entire image (mutually exclusive with l2-cache-s= ize) +# (since 3.1) # # @l2-cache-entry-size: the size of each entry in the L2 cache in # bytes. It must be a power of two between 512 @@ -2840,6 +2845,7 @@ '*overlap-check': 'Qcow2OverlapChecks', '*cache-size': 'int', '*l2-cache-size': 'int', + '*l2-cache-full': 'bool', '*l2-cache-entry-size': 'int', '*refcount-cache-size': 'int', '*cache-clean-interval': 'int', diff --git a/qemu-options.hx b/qemu-options.hx index 13ece21cb6..b493371704 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -754,11 +754,15 @@ image file) The maximum total size of the L2 table and refcount block caches in bytes =20 @item l2-cache-size -The maximum size of the L2 table cache. +The maximum size of the L2 table cache. (Mutually exclusive with l2-cache-= full) (default: if cache-size is not defined - 1048576 bytes or 8 clusters, whic= hever is larger; otherwise, as large as possible or needed within the cache-size, while permitting the requested or the minimal refcount cache size) =20 +@item l2-cache-full +Make the L2 table cache large enough to cover the entire image (mutually +exclusive with l2-cache-size) (on/off; default: off) + @item refcount-cache-size The maximum size of the refcount block cache in bytes (default: 4 times the cluster size, or any portion of the cache-size, if i= t is --=20 2.14.1