From patchwork Mon Sep 24 22:53:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10613025 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 81F376CB for ; Mon, 24 Sep 2018 23:14:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9200F2A083 for ; Mon, 24 Sep 2018 23:14:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 847042A086; Mon, 24 Sep 2018 23:14:01 +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 BD8A72A083 for ; Mon, 24 Sep 2018 23:14:00 +0000 (UTC) Received: from localhost ([::1]:49186 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g4a3E-0007nn-0U for patchwork-qemu-devel@patchwork.kernel.org; Mon, 24 Sep 2018 19:14:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43852) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g4ZwP-0002gG-Tn for qemu-devel@nongnu.org; Mon, 24 Sep 2018 19:07:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g4ZkS-0003GU-T1 for qemu-devel@nongnu.org; Mon, 24 Sep 2018 18:54:39 -0400 Received: from mail-by2nam01on0105.outbound.protection.outlook.com ([104.47.34.105]:58176 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 1g4ZkS-0003Fy-Lo; Mon, 24 Sep 2018 18:54:36 -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=M+7FDkKLPZ0KFsA1JYajgKxV/cED3oemhA/ZKv2hFPo=; b=jAlZly/9H0JBCJOKrFtr5UecRbzcgA7rc8Xl1DKNkQ2HPu/xhqD1LvPelnOAsR7HPWliAMQl8W8srY8SWcGGsjCknT8p9uroRn+Aw8jwZxPmT7dTVmESmDzX2rpkqSSHvkoSgC+CGsts4rlDfaHGpsfKr8sD5NXayjCjqJLp5Rg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CY1PR07MB2617.namprd07.prod.outlook.com (2a01:111:e400:c637::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.25; Mon, 24 Sep 2018 22:54:32 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Tue, 25 Sep 2018 01:53:49 +0300 Message-Id: <20180924225357.24245-2-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180924225357.24245-1-lbloch@janustech.com> References: <20180924225357.24245-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: LO2P265CA0063.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:60::27) To CY1PR07MB2617.namprd07.prod.outlook.com (2a01:111:e400:c637::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4754f6b2-9249-495e-930b-08d62270b28c 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:CY1PR07MB2617; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2617; 3:jKCZI0Sb8nm/zB8ScvCBgDjJLJjkfbBtSCGZ5yji7xwQWn34Gwn+joYPNRHot8bx7D+xSZentpwUohIJMl+zjZaFnw8/OPtlgSGCRZZlipn3Mp00PBot+OtRAUi9FZVU4RNVgEBRdMS6lgBxGTkgucOOKU0nwEoCEvw9ko3bKXHEClFk5icv9bgEJK4km0JIfY9fkl5/OSBVqcRbfOn77h/Nk54i2en7wf1jRQ8uz2vPjXRZOh8cAEEmncA0exu/; 25:WLotAs09gcrJqAFda1Yow7O+5o5mKhtSSQZDpz+5JUsVrK0CeqQ2tlthKaHaqS10kzsRmTtCKARuaMfga4ygveXNWytpSF6F9USrOpGxZKF4QkgoqnfQr/cB/Mt58iCnMs/Cb0ZmCmYybMbTo+M2iLXGIkzNW2RQFYsfhmJJ4I4psuDMB2J20efzSLDtkEDGa/6bRVWYEb5k6HxBFACIwFlLIiO8yaK8m1wgDZlGm6i3+4VKEUk5T7N4/ciGvJ0/jhZxRxYQefsW2alcTQUAZo2lMEo7twBF8QifjCz1c6+rSQhlIcfPoDNdSdl1cWlndnbsIIAwlQkNG6HAKQhrEg==; 31:JSpcW1+Z1fxyT+6HJaXLGuTUsfCDm5xbvE6kAGpiV4pk+izQVdI1Zd9g7rOdm63rQktiT9UGQXegu4UamdFmTIIW7eRONrn9Tu2+a/K9/ymFU2zdqjLF/2YfYFF1ccrzHqECdgLhUKhiGVKl+1YpFG6j3GA1JPhdanMcl7b7mxOBIzMtuK2BjHGI388iEvZfTgdFyWFcCmpI0eUpkK+b23jVEkluaMsOxjTcGninWj8= X-MS-TrafficTypeDiagnostic: CY1PR07MB2617: 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)(10201501046)(3231355)(944501410)(52105095)(93006095)(93001095)(3002001)(149066)(150027)(6041310)(2016111802025)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6043046)(201708071742011)(7699051); SRVR:CY1PR07MB2617; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2617; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2617; 4:cj54A9QEXxgULXEst203AzKJYqb8mGBUMhZVLCKSyrgpFzYfWVeTn1+Z2E1bXDT2M6IdyGmxfTTm/Piysxm8LvgYXFfSzF9bk5zkLyQABynQqO9vmu3EvjTtBfjp27TRtJANaz5D1B5+efdr9G64rlS9xUh8yiLCSGi1wbIqpWP8LWo8T1beZaEJXeGX0R67hN8NnxgMGSe22eo5JZfgXzu8qJs4zEIoVGUeVRUF/9yAW9zKyQ/tDJuaDHDWbWHZo32dXZQARHIb8q4GVDGJxg== X-Forefront-PRVS: 0805EC9467 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(396003)(346002)(136003)(39830400003)(376002)(366004)(189003)(199004)(476003)(54906003)(68736007)(14444005)(956004)(2616005)(16586007)(105586002)(86362001)(66066001)(6666003)(7736002)(551984002)(486006)(47776003)(106356001)(51416003)(11346002)(76176011)(36756003)(446003)(6506007)(2361001)(316002)(52116002)(386003)(97736004)(186003)(5660300001)(8936002)(16526019)(1076002)(2351001)(81166006)(8676002)(81156014)(26005)(50226002)(6512007)(4326008)(6916009)(53936002)(3846002)(25786009)(107886003)(6486002)(6116002)(50466002)(305945005)(2906002)(508600001)(48376002); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR07MB2617; H:Jupiter.local; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: janustech.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2617; 23:BLklBcI2jjy76ciIEm/PqNlbjVOXJbS2R6TSx67cG?= 2nKTWtFKUuHgDgb+tT49mu+qD5IrGeAlyD7uyGhqKkjvrIu0q200FOIJJYDjG6wR+yArLPgS/lDnKZvB6KtxPWpsOfwM3IJ3YpspEfEoZVb3CJ6TCJH1+4F4Ma4cyewP23ZinW6fcHwfNAdswg2U7wSPvoRLLTuv57FYGyhkwJXc0uGzBITcbOB+HJX4pFMqQAjjqrHvlHN7D6s+G0x6mujf6AuREhEiQljaElurcMrh0Ew/+PuTGpiuR/wGByNlzk8Q2GqYdsoTzqKtzndxdKSz2eohBE8rNl1sRapXU2QJ10QXqNRsx90dgpgets8z1akgwl01rqz6lLBwiBmh9iWtK8MgyaBuC1dWdgyhCbn+BDgDlsx413d/8EhSANLGMx/RwDRK1l1vfH7nh+O4gpH+6+EueFXE/ml6JMNPFOeGs6xaAP7x5HmuRcXZgxX695C3DvvjilmY2Vaw6/W1uXvqZYIJmU8p+Q2zKhGskqrgkgWF0hpvwGKu5HFELaqzTOhY6dIMYxDvP7/1pRr9v3gdV8yLpXW/rfvNBKnhB/CeT0Hem0qbBVcKVh2S/OK9tPEk8SRABDgXXITvk9ZtNNGDkH+bCfm405qdmCHrE9X7gEfVAqK4TgCK6HNxp9pJo9Ubd/0wQQSXz0mpVR5eRzNq2eMrT3JItoHUBV9o1tMwJToolgE3sjJeGxMdMdxmNWNL1ZrTARsMysqrbVAXaCi+B/bkTiFdjgu+F6UlnYtvSr2GiziJJgeBf1z+iJH3KSzPPJq/b9Fby9fPXwpq/ihaAFP7Vim3Q3tt7ZhTrcRGlef8fQDN6SPxtoux4jPpuiojSJ5Ecqsqs/MWYPlpwx2KmDm6kA50sNGb2Mjj9VqIx/E+hraw2FIKCv5JGpmvsFwanN3BK+uvb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34uj47N/4R2Yai2N1rF/EXZmebKihgA74nlfvjv5Wo3MKscQOuCsy0+yL+EcNhGSLUdh9V3KXs/ynX4HL1lCQSjUUFJo6avBphS+okCaBIrBpdxoVgVMGPjButSbR9egNgcpvFRPry/rVbxpzh2xChNF3XTS9kKC0EBO3Glr6xD5Ws4VNvg==; 5:avj1sZR7fskw6M8XPLJ+Kzfio5oV6jYxdnGZa7OtsxwDflDatvch5VRZ45tqsXM8mK6eJEPdijRfMCPalAX72cVJmWvv+OOMHDPo2/A4tLjmhyFBGMrCfJPp9wCmAyHyaW2v6f/k1CuGExvW1y/d57ElL5CQBGvaotySV9JquPw=; 7:ogAjE1z0LNrTI8o1UKMp91SraIxEcbDre/NEwnWSdIITwD2eg73KOUvnjE/8JYLsOZA6wU1W+lyTiJpJlfX6jFC1eRzUOdv9q1PmC3EDWIvOUlVx6qOL4ruzkrFyBsnE66xQTquVoRQsyNP49PWQvF3ytbsOwiXHKjl9DXPLeVCeoiRrRn84p+lu9ctdE5eHJmiBd9jb7vyDdZOBGMf9I69YTE/JvH87W+9yD2rR4cv5/PnJw+JaWqdxk7qtqzrb SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2018 22:54:32.9191 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4754f6b2-9249-495e-930b-08d62270b28c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2617 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.34.105 Subject: [Qemu-devel] [PATCH v11 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 Reviewed-by: Alberto Garcia --- docs/qcow2-cache.txt | 21 ++++++++++++++------- qemu-options.hx | 9 ++++++--- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/docs/qcow2-cache.txt b/docs/qcow2-cache.txt index 8a09a5cc5f..7e28b41bd3 100644 --- a/docs/qcow2-cache.txt +++ b/docs/qcow2-cache.txt @@ -79,14 +79,14 @@ 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 virtual disk that can be mapped by the L2 and refcount +The part of the virtual disk that can be mapped by the L2 and refcount caches (in bytes) is: disk_size = l2_cache_size * cluster_size / 8 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,16 @@ 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 + +The refcount cache is 4 times the cluster size by default. With the default +cluster size of 64 KB, it is 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 +134,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 a642ad297f..2db6247eff 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -732,15 +732,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.