From patchwork Fri Sep 21 17:23:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10610737 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E444D5A4 for ; Fri, 21 Sep 2018 17:27:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C83E52DEB7 for ; Fri, 21 Sep 2018 17:27:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BAA372E35E; Fri, 21 Sep 2018 17:27:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 322302DEB7 for ; Fri, 21 Sep 2018 17:27:57 +0000 (UTC) Received: from localhost ([::1]:56721 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g3PDg-0002wg-GE for patchwork-qemu-devel@patchwork.kernel.org; Fri, 21 Sep 2018 13:27:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57450) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g3P9g-0007nk-Ku for qemu-devel@nongnu.org; Fri, 21 Sep 2018 13:23:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g3P9d-0003zA-Ov for qemu-devel@nongnu.org; Fri, 21 Sep 2018 13:23:48 -0400 Received: from mail-eopbgr730137.outbound.protection.outlook.com ([40.107.73.137]:65493 helo=NAM05-DM3-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 1g3P9d-0003yr-Hz; Fri, 21 Sep 2018 13:23:45 -0400 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=l4jjVIBsevaP9knH/Dsm9mY+61Ao2JPKnEmZt7Jyl5o=; b=TY5xz3P6fdhgiOSgE4ooQHARtPcFhfOoBSn9qWx9ERJ34kMkMwt5F382xNmVPhFiKsu6ObAXGaxazzs43tfMCnPpXdH8wQR6OfbdbRKojEwAubTCJTPR0ZdIDdoHorXGE4DCV2WZJ0RUvqXx1qk0hsV9uPvovV28h2mhI878B6M= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CY1PR07MB2618.namprd07.prod.outlook.com (2a01:111:e400:c637::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.18; Fri, 21 Sep 2018 17:23:41 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Fri, 21 Sep 2018 20:23:02 +0300 Message-Id: <20180921172310.10068-2-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180921172310.10068-1-lbloch@janustech.com> References: <20180921172310.10068-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: HE1PR08CA0065.eurprd08.prod.outlook.com (2603:10a6:7:2a::36) To CY1PR07MB2618.namprd07.prod.outlook.com (2a01:111:e400:c637::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 55a78682-5fb4-4751-f347-08d61fe6fb64 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(7021125)(8989299)(4534165)(7022125)(4603075)(4627221)(201702281549075)(8990200)(7048125)(7024125)(7027125)(7023125)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:CY1PR07MB2618; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2618; 3:WhG/RzVnR9N07QiKIXdqxnWCi4ah8Azm+I2CrGIuOOQmSXMV7kbVEe8hhEz3OIeSKyDAmADScWwALV8l/evOxxBKjZRJ6yAL8HU/e0HTD0CoYX6XekNpwnONolH5utYDCR1gLOWjzJvR5Sxw3U1BToXa3Llw71C5j3lU45sBiAjPfIPlec1FVPAXaGJsZDNTeryFc4xaaoydXP7E2LvExGkYqmxcKZNyANrVZj1woZ9/wbg6ndJFe1Og3j1FYUJt; 25:7sKvf1VzeNdo3El9N/FfAYT+FdJmJhfLauzPeGekfbaEatQ0E+nwgJY88HDXyoSMPZiHU9Z5aLoF34wBmvvrtUtQoc7mHjyRofAYc9HXMPS8Uw5j4pWMBCMYNbSq3veHT88nGmnCuJtFqoyCacqHuO1wXqr/Dscuy7mWKWdXI7XnCDlF6wWoXL5z7ErfpnhaAHMTsiM+SLE8XkRe67q/x0OFS3aS1BlDFkvJdDvfMesvme6iXLwxuRCEd7LNZ9IgtahYsvgC85uxteE3+x1PNbG6KqOg3t/+eem5L4CEQv9ghHw1uOSR1qQ2U+xJQYOSq5Gj88X2tLiOukzRW9FXjA==; 31:klo+37K/0GHjbM6SKh4h/73SsodATQFylXx2bAJgeDo7uHvTSK5hqBhQHxr6BSBu5+f6iygNdcCUwF6UDSY2J4wZWJjr/sNV+UoMqx3fKtorzntbN+Ud6wPg1YFngQtSwuGW+ExgZamcg5mgtFzf6UKRXtxqepYPoG7S9JwAFUPFHgBd5homVArrzShCGyJv+vdU9bdoySzBJrDuwcDBpkG0EGyeYHfYBwmr9v61N6c= X-MS-TrafficTypeDiagnostic: CY1PR07MB2618: 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)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3231355)(944501410)(52105095)(3002001)(149027)(150027)(6041310)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(2016111802025)(6043046)(201708071742011)(7699051); SRVR:CY1PR07MB2618; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2618; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2618; 4:VY+LgxlSdDem7zbRDc59T8MTF1xHdDXHqNRo/lAYqVXOZgdqP2+XkggqFW2tOfxGRmGXOs5MqWMx0n5pLKlNvoiEaNbUXRbh5dVa5MZSsYLnVErCxdRaarfLDk4C6p5ZOYSvR9j2fBva37Lxtuh7TFqZXv4LwISybkvSe+lNgrRROYNoBg31Ol0d+LI0Shd70pyDYwiXEuykMS/90k6n9e8+ceXkb7h6TTFJARGqWQIy+cOyQY6/ph/8R4E/sVBMdK24M0OtIRSWiFKtdFySOQ== X-Forefront-PRVS: 0802ADD973 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(396003)(136003)(366004)(39830400003)(346002)(376002)(199004)(189003)(86362001)(68736007)(50226002)(106356001)(8936002)(1076002)(2906002)(6116002)(4326008)(53936002)(305945005)(8676002)(7736002)(5660300001)(81156014)(25786009)(3846002)(6486002)(36756003)(6666003)(107886003)(551984002)(6512007)(14444005)(11346002)(81166006)(97736004)(508600001)(47776003)(105586002)(2361001)(186003)(51416003)(48376002)(6916009)(50466002)(486006)(54906003)(476003)(956004)(66066001)(6506007)(2351001)(16526019)(2616005)(386003)(316002)(16586007)(76176011)(52116002)(446003)(26005); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR07MB2618; H:Jupiter.local; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: janustech.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2618; 23:wn4B3IIzh4pN9BxmYilBDgwCmSowTNnlpvbRXteq4?= 34ZrB53oxdKT+9FlzqpYBwMGRB0J1lz4JJbDm3eLJ8x7UYQ5sd5SrE2FWMTST10Njqm4XtoOFXNm/G0I/8IuDkwYTKQ3fIFLPmNY9EholKgpqg2r7K3DUv1L1nlHnQPBuJ4RnQCANbcEQEF/jiQl21nkPzijPy0ovx5VmMZ14fLiiRqFQG1G+DA1vOouyTA1+Dz15/+zdTLAkyfVssLmuhEd+aOhVrlWJbtXZfFqEJIDhE8z98Il1/00A+b8/05mvbVByyTkX6ZoakEYsEMQjbuy3jQ2PzIfF3gqDThJei0ZVr07RgcUi1ZrNGjU1cKwfgaIYUCNTgOrhmntrOHkTVo1eb5Rz9ALfHmxvlfK2uGaz8eiZK8ZbFS3avjCmxhDFbgFqvgJct+3D4HajHtCwXH+a8xT23M2cxb7/EZmipmL3DNbdpaUgvj7S6Ev59Q/WjiqGb0dtP38p0TpIPdAQsDwU34Czq234qrkNlKeirNApMKpwe/0kt3z3dmzL1PvJpHfOPLS2BkhAY1/IGKGuA+xzzjTGAJ6Loy1ody8LMV3DRXx7dfaQI8eFmHFNJVuQ/B8qv/e/CaiYHdHJVoQW5PpnV/jOG1C6vj6YA0O5MZYo/yJa309LwLIfLAeIoheggp7vNfqEbCrKA4tlaDBIFmtvwX21dcZOtXt1/8okuivg9CRtvBRjjqgCn6aSFoMDNjUYFqmsrd2Uw1wllNlCLLdcqGYsqrCD+SHCjPt2ODN+fZ/6LVjjNaZhc3CLLpkAVodQrwsu1ZsLbXLU5ux9ypX1e8C65hQtWIbKqf1qI21/5KxiK/H0lSgf8mNjc5UnXDZBGlv4xoQ4j+NbSqQ+hdQjOrijRD+1byAj/7nGRtuMgHPr1TeUY7jIhiRYQUreBTg2YazR1j0Z6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iNiLm4xiI/pARhIR7rPdklwdl1eFv5IRP45BqjR1nJg8ToZa0m/njniRLB2PstrMzGKCMLZgJuuymuYuronC2yZFAT24R/t8aMRUvkOwjWdJh9VGKagBxaDLwdRzYXAVgFDsJcgZgXqUwFjto1sUafGy0UA9O5aVu7V3Gs+dZrgvBhEw==; 5:WGZfGaA9eOrPeDYe1n0Pm17a5JCbFqzvTS0KtVtRw//uxdVu6qG9yryGlrVN1Gv28tnJP0T6eyrZOKMWtsRTOnTsL6Btx+W9OjVgQl4TPQCvEC4hF7KSSVoU1wRSWUwCMY+Osk6/zwcojFfS+TC63MBctcXxq2MrYu0Bz8w0IOg=; 7:LRATAOITI2gjVQGDVOheoq8b+YB4CqJU1GMSBbSDsNjx7D3UmgrtDaAgFf1quGVcN1FbjkwQvYXzB+kr69rOrTW0xvekh6e2wk+1iZ+fpRadxRRsccu8uDKTsS26IZ/YYv8cFzzEeOWbq9XyQoagjyczoSVI8rKyxeaOJuA+h4OdcW4PCuiOk3xXcLptURNwsQJmwNI+hYjSYzJF0zP12wXHdPrKxZipU9+5LoYEL0ew8BtoJNKu7Uzm7HKIxEox SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2018 17:23:41.7796 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 55a78682-5fb4-4751-f347-08d61fe6fb64 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2618 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.73.137 Subject: [Qemu-devel] [PATCH v10 1/9] qcow2: Options' documentation fixes 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 , Alberto Garcia , qemu-block@nongnu.org, Max Reitz , Leonid Bloch Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Leonid Bloch --- docs/qcow2-cache.txt | 20 +++++++++++++------- qemu-options.hx | 9 ++++++--- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/docs/qcow2-cache.txt b/docs/qcow2-cache.txt index 8a09a5cc5f..013991e21c 100644 --- a/docs/qcow2-cache.txt +++ b/docs/qcow2-cache.txt @@ -77,7 +77,7 @@ aforementioned L2 cache, and its size can also be configured. Choosing the right cache sizes ------------------------------ In order to choose the cache sizes we need to know how they relate to -the amount of allocated space. +the amount of the allocated space. The amount of virtual disk that can be mapped by the L2 and refcount caches (in bytes) is: @@ -86,7 +86,7 @@ caches (in bytes) is: disk_size = refcount_cache_size * cluster_size * 8 / refcount_bits With the default values for cluster_size (64KB) and refcount_bits -(16), that is +(16), this becomes: disk_size = l2_cache_size * 8192 disk_size = refcount_cache_size * 32768 @@ -97,12 +97,15 @@ need: l2_cache_size = disk_size_GB * 131072 refcount_cache_size = disk_size_GB * 32768 -QEMU has a default L2 cache of 1MB (1048576 bytes) and a refcount -cache of 256KB (262144 bytes), so using the formulas we've just seen -we have +For example, 1MB of L2 cache is needed to cover every 8 GB of the virtual +image size (given that the default cluster size is used): - 1048576 / 131072 = 8 GB of virtual disk covered by that cache - 262144 / 32768 = 8 GB + 8 GB / 8192 = 1 MB + +A default refcount cache is 4 times the cluster size, which defaults to +256 KB (262144 bytes). This is sufficient for 8 GB of image size: + + 262144 * 32768 = 8 GB How to configure the cache sizes @@ -130,6 +133,9 @@ There are a few things that need to be taken into account: memory as possible to the L2 cache before increasing the refcount cache size. + - At most two of "l2-cache-size", "refcount-cache-size", and "cache-size" + can be set simultaneously. + Unlike L2 tables, refcount blocks are not used during normal I/O but only during allocations and internal snapshots. In most cases they are accessed sequentially (even during random guest I/O) so increasing the diff --git a/qemu-options.hx b/qemu-options.hx index 654ef484d9..ab1a3b240e 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -742,15 +742,18 @@ image file) @item cache-size The maximum total size of the L2 table and refcount block caches in bytes -(default: 1048576 bytes or 8 clusters, whichever is larger) +(default: the sum of l2-cache-size and refcount-cache-size) @item l2-cache-size The maximum size of the L2 table cache in bytes -(default: 4/5 of the total cache size) +(default: if cache-size is not defined - 1048576 bytes or 8 clusters, whichever +is larger; otherwise, as large as possible or needed within the cache-size, +while permitting the requested or the minimal refcount cache size) @item refcount-cache-size The maximum size of the refcount block cache in bytes -(default: 1/5 of the total cache size) +(default: 4 times the cluster size; or if cache-size is specified, the part of +it which is not used for the L2 cache) @item cache-clean-interval Clean unused entries in the L2 and refcount caches. The interval is in seconds.