From patchwork Tue Sep 18 15:29:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10604499 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 B7F2415A6 for ; Tue, 18 Sep 2018 15:35:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7A5C2B420 for ; Tue, 18 Sep 2018 15:35:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A58F42B718; Tue, 18 Sep 2018 15:35:41 +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 1FC312B420 for ; Tue, 18 Sep 2018 15:35:41 +0000 (UTC) Received: from localhost ([::1]:40870 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2I2O-00015w-8F for patchwork-qemu-devel@patchwork.kernel.org; Tue, 18 Sep 2018 11:35:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37326) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2HxF-00077C-9O for qemu-devel@nongnu.org; Tue, 18 Sep 2018 11:30:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g2HxC-0003y5-V7 for qemu-devel@nongnu.org; Tue, 18 Sep 2018 11:30:21 -0400 Received: from mail-sn1nam01on0107.outbound.protection.outlook.com ([104.47.32.107]:28492 helo=NAM01-SN1-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 1g2HxB-0003aG-Il; Tue, 18 Sep 2018 11:30:18 -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=K78s9jCfGlTVOjvLNoZvNYQRYxmm/0o0cgQDXvUhPRviQmDHYZGK0Kj7vlXKH0o8UpLPyjNsFJIPKIHhx6zIxrowhT5iKNvBGXjvrC7jnFs0xrcilWrwp5lPUVn8JXW8Ybrx86UE/VEX/kxzv/7vVkMMFvK2lBH7G/TQS6M16xA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CO2PR07MB2614.namprd07.prod.outlook.com (2603:10b6:102:14::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.15; Tue, 18 Sep 2018 15:29:57 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Tue, 18 Sep 2018 18:29:15 +0300 Message-Id: <20180918152923.24824-2-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180918152923.24824-1-lbloch@janustech.com> References: <20180918152923.24824-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM5PR0701CA0016.eurprd07.prod.outlook.com (2603:10a6:203:51::26) To CO2PR07MB2614.namprd07.prod.outlook.com (2603:10b6:102:14::9) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 38a38704-6fe3-4a8b-7750-08d61d7b9adc 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:CO2PR07MB2614; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2614; 3:unpUp03/4JYme+7y7N+eZ2sq3gO9jb4EEV/jwLXqAzTJ5B7JT6ctIcsg2RsH+JD2tty649TT1pT48X2/88Pv9cfsh1pnlpIS2bBDMJGJtFIXxs4AAcZQZ4yGbyDFU21pR/aQ6IdR14iJ8fIRqv4ICOHlSk9SOD9WU/e9fcphnZ8oefa5ZCbCXwUNsKnFO6oHJySaFJI9+XClY9o/elxuUMwWjbHEfQbQOBEdPoAoZ/Ll5cCwtrssQlVSU0t5ZE87; 25:kvpsEq91Up+bk0OUuH5WwxSFXENT0/4RpGr0smPuqaoIzXSRIrHxEP1V2cutMfvjSHA7/ipPMgzyg7630uZmrWkcvgSrXPiHrO1xepVoXWFp4YqDKyslZsLvvwhPw/TLwO2PRMFFrAahWcmResSDubBK+gPjc9tO/Uuo46iJYrmbM2QT8B/CFHyEFaae74E1EdqtXKtv/Odtc3gvqejProq5zOLSRxIv3OFIkd6Ukp3h9Q3b4RzRDioS7TGKTuXW/lV+q7PqvGQoLE+kEbx8bXu82vkqczqAFvL8h4SI1j+ulP6HuNNqNAhgC0+hO5t9hlAT8sav01qWSTcbzM3Myg==; 31:M+SSRGOGxdWaouS706IfNPSpLOE6tSwS7QnBlzEKo7six2qeXpk1MZgOIQAlfJBUY2IRsxBDmPi+1ZjWZtKedeoG/alOLZIHPTltvsYFhTeenNeWnuFq212M8HnJg9JcxkvTBmZGF3CnnQZcmVNC94FODkJiuDxc8Wda8mMzr23Ephruf37CXv6begm2BahVibrw73i1LjiNRB4HT4aUuWoxBYx3tzHmy84tUORviMc= X-MS-TrafficTypeDiagnostic: CO2PR07MB2614: 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)(93006095)(93001095)(3002001)(3231355)(944501410)(52105095)(10201501046)(149027)(150027)(6041310)(20161123560045)(20161123562045)(20161123558120)(2016111802025)(20161123564045)(6043046)(201708071742011)(7699050); SRVR:CO2PR07MB2614; BCL:0; PCL:0; RULEID:; SRVR:CO2PR07MB2614; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2614; 4:BthiX+t/mb1+XF7lfOUlF6xG7y9e9u0mLrh97m0bbKTkDmCMUwaFuEXkoX3RcKXA31vfV8XvIjwigOB/kcFQx73AwGjctbrwHtAXv0dfDTSAQ/o+yx89uC3F4sc1u/JNFeTCeXRCqpQakvSCy83MYNfdZUA8imDvCrzg6FOwyRleADfz42TNKFtwJHXqAAm4Xtu5wYixzX6SnZarkJTpC9mOMiD+toFnRzMImpM1AmH1TXZ4zzmJlRF2RdbtlUtH5OLO3kOqHzKZdtoHypVTdw== X-Forefront-PRVS: 0799B1B2D7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(136003)(39830400003)(366004)(376002)(396003)(346002)(199004)(189003)(386003)(956004)(47776003)(36756003)(66066001)(6666003)(14444005)(68736007)(53936002)(5660300001)(6916009)(486006)(6486002)(8676002)(305945005)(8936002)(81166006)(81156014)(16586007)(54906003)(16526019)(446003)(476003)(316002)(11346002)(2616005)(186003)(6116002)(6512007)(7736002)(105586002)(52116002)(50466002)(86362001)(76176011)(26005)(6506007)(97736004)(106356001)(50226002)(25786009)(48376002)(4326008)(551984002)(107886003)(2351001)(2361001)(3846002)(508600001)(51416003)(2906002)(1076002); DIR:OUT; SFP:1102; SCL:1; SRVR:CO2PR07MB2614; 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; CO2PR07MB2614; 23:bqXOs2XaYlXPwWlLXcwzU9KAY2co5RGsdx71n55B1?= 1utzX33fCbk4UVL7J0/8bf2GCXR/cBkG45AZ/2Nuw8pjfUxcNgFkeNEynHqaMAlntUTqxNE2dlHQjQvWNWl7NC7xbIeiw/jLd+0z1aGrt0j8YtFSb+oTwbn9yhMgM6TYasz/c2NGI4ICG8bmSNfwg6qJJAQYyREDBaN0Loch4JXhyydGd8dUGziOwdkZgzMcwEafRq+3mVx+S/x7JiK70Y0IYtUXhWduZij+nJ7N9zIxWzDuKBXb4Ae3zP4RiTB0cWinT61uYSYHbo54P6hpviOMZyEeKwG/QPtaHcwhCwZbbllTpBfK4sFOJZ4nNuXmhO2dAGSDYm/gVB6cFqAtDIhm8gu3Bu5c0/1A6znz5Qk6nwQnxOwlfr3kHboWyrP3nHiO/UhyOJrLVl8r5hopmSAjUorPuDVm+uqIZNUgGKxf2igwfWwfK4K/VWYB1PI9jwQanUESyzFiSFJHj8hkg5HZAsFh28vnhp7I5hAufydh0vBpp89r9NcRYO1HnVdR6mq+Z1R+QwgBAvYeK69Pyl6Q6nkF6aJxckyW9w3b0TtfR9CxaHgaMwQD1B6c2EGPoHcjH4ysf5eKcPb2833eSm/sQ0Y+chF0tpjQwsnOP4d8YJG1SjUFqelPmeM8K2m6jDFPNgA4HQqk/BFfn5vn0NtTLZJBOEokj/snN6SLJAgIZeRwbRGo6ceY4gKczNjwZXkHMw4AmhuyHKtFznZ5zPZd4K05FBP3wA6lUgzkhSg4E4eMroE7eZmdMKJrjUdRE7lhHudPey4urkyobo1JiJx5h5ra0zWelHlLheK2WNCBj7zITxT502/y/rn78U0ameue2Kucho7hP+vEPb0ga8uycebCxE7QwTyApD4Xu1E+zTEQqdiEtB6Sll7FFgeHWrb+xCt8Dveou19bqFexdy9yI1lYP14Rnt+69RYf0foRkJINAtstNpHmQtfvL3k9+VdmgmNVc1nFYAH90rBen31weANGXKaLwg3SnFUHKAFCc4lqrMbxbLvo+WFbdapFedXO/RE4Yv+TVHL5bIGW4YONO/1PZNPGxXmCzLu8Z+lJOx2ADIhQafvojaYARY/qLqoY4580G03Y1/Pd67VNRAvaf7qWhQqkK69cqXj/DEPTp0gduAXdV7LWpO26XrwxEOfyneHgu43xcMcZon1p3IQZuCHdldmERrJVwecgWrMyXI4hiGUC0s1d00xhXUeEFcfDllk+i+UP4L4l4CGOmFf1KZJO6fvn+uY6MTUbGq21KUSOnBdPiYtwMw5UPMpY64= X-Microsoft-Antispam-Message-Info: UQXDRmWaIXpjo3EbKagRWweEfSLk6+EeWLqulqSx09sxDv9Xb7A3RmtoBMibBWuyYWJ0KYaU5z+UNFtIenrI6ej67mNq9dwwgCLJkyfqK4dot22isV6uPkOUWOFsmNI9c6mg8/p11LQGqrPxdNcVXp1o2M044X5ttdgp4IZaAmGgVCBLgK7QmwgNqTfrKsBW6teW2yQYQeEO43e28JNlkElFom9DF2ptssERcld3HKQ2mOogvxQ7mvQB540Iw6/oRYZ0tGoON2mZaAwl7BUBPeyRzQLczK3iNnZ3608SPNnwc+b5w3cg3isrAWbYvqwZqZhipaVuf7RJF8oeWiWddZh2pYdYHXy4dnzNpJRl248= X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2614; 6:gbBK+UqJwrnQBJUVVbpld1Mo8p8tbLTHgk92fJiyeZmCfQxE9GruM3LbQeUmViHfaLlk2iUh1Jh7CftwJnsgHAs/noydFAXDR4a1AFNad1FboCv7KMAyXFJ5+oxhcfcCQ9ugYnVINO02UUfafEH+7bLJhwXTBvA2bDf4MlOwV2mi/9vPF1o5jeU57RV0GCgDtULB8Abo5acoYOPKRonysf5ZefOCKolvigtpOihWiJgBFqs2EH23aHHD7SEy4j9h5ny8QBgbA7OMN7PfC8bInfLF41vxnYV2ROgR7NKE5rU8ce0uB74LP7JmAiqfddO/q0KoZ39pDUExBIYoiCkhIcMU2nFoWYmvy1/u2zDduFW2UjbbQyjUW1o70iugg6vrWtuqjhu4yJIkeGankTWrHhMvhbrP2ZMaX59RK7Yummbi1l/87mEwFdoDDJYr/QDGHNE2016RG5CoMSWeDWYlmg==; 5:dbO8ngMkNKiFB1v8C+GEY8N8nSdtZ9K6aaNszY4U6NJazG1njK0b1VtCV378yUbj67tYR56+U0/ihzlON1nrEG6RR55dVaFcZI+wqQCtrF5PzboqVUFSa/21xDpe0peQFbdwxQOZZ2Ndm9mCt8JkriqF5ob4z+hwdyRVpRStyvw=; 7:PdH0RH9mR3HGBsNOcCKImSp2DaIUek4iBrgHYE8aownAgve502YVXoCLot68h8BJc5DWayeDA1V5MJRE9St1T+6m58t3hbKp+uy1aqtSqiLI3H+jg7zf6c5IZbOzrob+/t95iuuBxFh4cj3l1z2icpLeu9FDJtOfUX7/E2FNToFdg0dQguXzGXNj1iACZSfumrKQpvWS/j0J3swii+FPpYqc+eYxALRgYkS6SxKMYNScC5JHHaZ6INoQ/YmAu9Rf SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2018 15:29:57.3442 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 38a38704-6fe3-4a8b-7750-08d61d7b9adc X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB2614 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.32.107 Subject: [Qemu-devel] [PATCH v9 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.