From patchwork Fri Aug 10 06:26:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10562261 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 AD953174A for ; Fri, 10 Aug 2018 06:28:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D7A02B3C7 for ; Fri, 10 Aug 2018 06:28:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 918022B438; Fri, 10 Aug 2018 06:28:36 +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 E9B492B3C7 for ; Fri, 10 Aug 2018 06:28:35 +0000 (UTC) Received: from localhost ([::1]:54533 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fo0uZ-0006ie-5L for patchwork-qemu-devel@patchwork.kernel.org; Fri, 10 Aug 2018 02:28:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49330) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fo0tN-0006iQ-Je for qemu-devel@nongnu.org; Fri, 10 Aug 2018 02:27:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fo0tL-0001Xa-DE for qemu-devel@nongnu.org; Fri, 10 Aug 2018 02:27:21 -0400 Received: from mail-by2nam01on0121.outbound.protection.outlook.com ([104.47.34.121]:27720 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 1fo0tL-0001Up-63; Fri, 10 Aug 2018 02:27:19 -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=NieT6e4sGvEML8t1ZN3fAKC2L+NA8AiFDMne61fe0Y8=; b=hxesBY6M3CTUNz9QsQ+4gqoElLVQhY8Osy80xAGn2eilmU29Sar//OdbitjomCy6RClnbv2zfS3GD6MFcejlDPvUbZVTEe4r8SPPeod7UqLRQsYMuSMykSXIpRn4TcocIdJdOnOfYMKYe5ED4uHPqMzeCBAGwmh6ey4lt5lryk4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by SN2PR07MB2623.namprd07.prod.outlook.com (2603:10b6:804:8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.21; Fri, 10 Aug 2018 06:27:15 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Fri, 10 Aug 2018 09:26:39 +0300 Message-Id: <20180810062647.23211-2-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180810062647.23211-1-lbloch@janustech.com> References: <20180810062647.23211-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: HE1PR05CA0232.eurprd05.prod.outlook.com (2603:10a6:3:fa::32) To SN2PR07MB2623.namprd07.prod.outlook.com (2603:10b6:804:8::7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: af71daf0-8ed2-4673-52bf-08d5fe8a5218 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(7021125)(8989117)(4534165)(7022125)(4603075)(4627221)(201702281549075)(8990107)(7048125)(7024125)(7027125)(7028125)(7023125)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:SN2PR07MB2623; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2623; 3:N533G4AdWrS4OXvanLuoLWQiXjhdGavWk9oOwjZTYGJfcZtirG9CK76MyQK6I6rpZ3MuwSWM+VRZy5zLb9UXcwK6s66JuUW+25TMSW0kN9ZIoOWh4D2OGWdxHsv96WlfkFJvCxNkqg2AKDSSsuPIcCu2jqPNvE/utPV0yriR4GUzFmNIjDndVYZZRKJgoliu6LR1FmTT4wpwz7TPDVtcKg0yrwFE8pBK6p2TGKa83/d9knOXfDn8yYfdbja8lyV5; 25:5EYpz7V8OAwS64tKD6/Ex0djz2fXrbupYe4OUHp1lalHsuliK+PbdXnL+pOLwKF27ZsHSf4KoumTIjR1oolPuzZAGfjaujabUQ0poo63bnw+4X70DDnmyiC0E8gpIkh9ZOOMU9UdT7ehp75k86CF0cu3CAjS1kbUtCg4XSkVhscCS83+znPvdCvbzVyUt+iLZRmBGK6FOi04Ixy2x6SvDz6n8gEdC/XVy4axrn3j/iGP3waIKLe95LNO/1WbsSENgH5QjGt+UnOK3pQTHnsafV8cgBQ7QAceQZeD3p1Fah2QmIBulXYXimvLXNslYUzx76fx65Py3VMSbp76ROPMFg==; 31:8DrlvD55VvccfNDC9ginHIPiGXu3kS+1CRMs+9BRTe13M+QiCbrACEheMbpwLB8gNMCikNMaV/F7Q4eUqfNr8hPpum2+MqZYk7GfElJWVdHhk2Tzomw1XIDfrGwS0pi2FLphO4wbToBvlJdpUQi8OoVgmXjBKXxCocY33/zcOTadHsiIeReCdekRJn3kQEIPzliaRZHsg1EsGSHETYQXaYrDz+BO7/SH6TBVGRemV3g= X-MS-TrafficTypeDiagnostic: SN2PR07MB2623: 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)(3002001)(10201501046)(3231311)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(2016111802025)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6043046)(6072148)(201708071742011)(7699016); SRVR:SN2PR07MB2623; BCL:0; PCL:0; RULEID:; SRVR:SN2PR07MB2623; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2623; 4:SfwJ9pBL9tcMqgNhcpyWAtqOvi/XnDUFnRkh91vChqBwMlD2v5iS6F9/wqhMHoH9zfCMSg6kJR3YbCR4htKm+gqF6p56OImRpGUYNoH23dOXt4cQtz+RMCH6gUOr68EEnCei8F9uwGO4oKk3NWatEEO+AaJll0Nyo0mIIwtGfd4+jq0sQ1X8oYs4fEU8fSsjUJxbjkxaYt0VQwKQpz56QkH/eHYKwqRv1axCHj78iabg/AKGoDlWVEMIeySBVIp69Pt+8xpFWHJZrJNRDhmmzA== X-Forefront-PRVS: 07607ED19A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39830400003)(366004)(396003)(346002)(136003)(376002)(199004)(189003)(36756003)(2361001)(68736007)(47776003)(107886003)(551984002)(105586002)(4326008)(5660300001)(186003)(106356001)(16586007)(2351001)(6506007)(316002)(26005)(76176011)(16526019)(86362001)(575784001)(6916009)(54906003)(6666003)(386003)(25786009)(478600001)(11346002)(6116002)(8676002)(3846002)(81166006)(50466002)(2906002)(81156014)(2616005)(53936002)(51416003)(446003)(48376002)(6486002)(66066001)(486006)(7736002)(476003)(305945005)(52116002)(50226002)(97736004)(14444005)(1076002)(956004)(8936002)(6512007); DIR:OUT; SFP:1102; SCL:1; SRVR:SN2PR07MB2623; 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; SN2PR07MB2623; 23:f9fx5h0EZhncPp4UiSF+5eWH/gmRnTl8RjNfyv/aQ?= n08/BA74mRlwYKOzkhEz5DNf6ZIj7qtMUtdTf7n2O69Oip44j3wVGx8nel/JMO0pTV0oOEFn6D83zuHXa9VEltMhnviil/+v2QOjLOZJn307/kFnJuQav79zvPizdRo4EMYd1tyiqc5Urq7+JFmzzMafG3oeidnPox1zpvVuEK3gYl1b072p07euJxl+QPIIbS8RpdF7C8RnhwpGSQ5vptpsLYT9KGuswgqqaMop9yS16Wyymt+p8WOlK/mDuVOTdXjsk1oIHH9x6c31pUJQ0dJ18IbaIwICYNyrN+1P+5oGzd9WGfhqT7pk+2UTDixipDZf+CR6RMFBRNTQ31RVIUfewK8wu+sgAL3QQVWMP5UVya5ZT4DwBdsj11QWZTpDusjjIWIzBfUtzCLqgpjZYIoXbAyfltkMj2XZBLUj8gZG3m67feU/iXQTX01b5uMUpgifPExsodCDPwh/wZqMg1owPnahbUD08HQRIn0qHz25JGW8HTxSZXzdPyrrgjHHF8IlwVBcM6zn30tQh1n4Z77Fik7Gyz89uER6IEkGTtBalXklR0GiuZxPY00F4pja3YexWb3KYrwYgJ48nS9+sDjosAKGzhKMjKf/tdb69NZX1t0LKAz3BTiEPiIs1tWwQhP6IrT/cnIpqxmPMCoRQh7nIJKxxNer7WjfTTl+8RmWtVkvxBU4hri+xvbP/+yDyoJbdwTFaoPZuBYHx86VhChDwY1ivaU2ek8fL4JgZ82YJ7N1SY1oD7fKct1a1suHVQrXv5xJDEV/hoU2e8hFtQ1QEnzqRkgIdzHBObTTs4xvw1Y9tya+2lYQNE0lLHLRu+BxtKVUtbsFqDFNFOMWU4sK8QYi6Sw4pbaqKsvatRum3G7oe1lAzDQPfNuJVMArsmI42MSLYfW5YamQAjHDeChZZDF8sH2bH0g9GJvOL/mdiTnH0m4sysmpt8w8X6PQIU5sWezCZbua3n+iqYqDnYxSP+1qEE4zGjWahhAmqaHsXOqQfDQk1wQlBr2HePK94o5XkYAt0AXXxvjtSa+EVzW+4HxAVamy02C/vWqwAi8CjWBhN74ElNBY3RLvLaT9DUW07AdDCYc+ouoVTw2YuWdhxj9w/yCMxWzpOdbqacqQBwu6s1/mnS+O/9JicAHlaWT1PYDEKwFnw+KAEqRUFYQwpvqvkbVricUudCSwN2OmSsn0ica6fD6il1pOyei2379INzYVIYOn//f3I+6CYczDd2qhTb28KYgMsFLA8eSx5+33LXqqbqcUTK3jXwCucPuACtkku+mgTkIINGWmDxf X-Microsoft-Antispam-Message-Info: eYERMH6bSNmfZQi/+M2RDsqNZMeP6Lbp4ykWWMis2XY8MaM7zQfijyr960atcLS2KicfH1WikoA3HsIdYWC30zxxphUIuzzaGNGIwHV8QUfnEobHmBArrumxOWfkqxzBoyMMDefSHPV83KFJJVi10tDhA+Wj2pqJBxUBUtskhj7NfNEo0RyFFMByKq4s0GEZp8/jzMiP7jU7MRBMrtua164Z6yXCFt1o5ALHgWYHgboq//5XNQVcJuY3m1ZVeGOWmt1sJk4aOtPgGIvVTDJncfKuUcg2/5HsKAvkqpGMhRrEJ1nOYGpohBigd4hDZZYAB4wz54CjlHo6OoebqZNwsf7pKHv3Z0SNJMyRsm6GSKc= X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2623; 6:wbsalzCYs0fhJuJzmRmbjhy8DwHi6Iw1sySKHwhbJYGwzAuG56gLuz9R7tDZT+7kaJjfovZQyGAUncmC09JLwAS8ZeTJGObJtuyBeK4fRqacKgj1j8LGEaNsWelyIiYB0lz9n46mBBG3gUmNcALo5712GBAhx6/J6DBN5SLWTD8vK5AhxXTlZI6Q80imHbd9BbweqJWtNK0aE2fOuXOoObBvcNXH1ptQk09GzaRSk9+z3cZw9HZf9RGSq+MrTliYKLaa0ksp46LpP0EQDSn/wRQJgxfsFmIEeJE1cmNfGVzLXj1WGl5vZouRiK6ospN2P8Ix/Myn5oU8U45t1RgnkA3MgKU1AVa4O/H+Ge+YjtWNseP2uKVyJwvTdxxcxE1kpTp9P69bUwaXMioDCVTF1cX7Wf00KiTKuJ/ER2rZTEhGXjowsLu/+ueFyDjolYjfRfo4W2hCMkZbsNNNaVriAQ==; 5:qZ6GgNniN/sYO+JYVHiE/KtvFc1fTP9wt/LyEDoH9MrsmtW8WBVOyHaXWvoSrTstF34Z46n/zeUBKoDbLqCn6JM1Q4y/nMWLaCokNHhyX+sEYCQSxx3Fe5gDa+YcjErEL4YKvSsQxGh8H+I6u328oClmV48rvaR6nu2WJD1hlR4=; 7:BY9I8yVsexz7kS8aB61itXNgS2U0zS0ru1r2xBxW5UWDzjFTX7XZm247k4wJdKF4Rjtk23Mgxh8xgF6tGKblitknRN5ZcakYkI0QvMVL2Zb/TAzD+9cmRyLlcmtaYe0MJpuA2JJKx6eDTmOsIWzoa7NPMHIUNvEl2E25+nPCS3dx2Xkp8AfqeZ14EAeyWEMpr80hb98KDqOShl2Eh+CAPpnzUBqIpoV5CzJpSS1jXHMPaKmkeRV4QCKNdygRwli3 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2018 06:27:15.6248 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: af71daf0-8ed2-4673-52bf-08d5fe8a5218 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2623 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.34.121 Subject: [Qemu-devel] [PATCH v7 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 | 16 +++++++++++----- qemu-options.hx | 9 ++++++--- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/docs/qcow2-cache.txt b/docs/qcow2-cache.txt index 8a09a5cc5f..0f157d859a 100644 --- a/docs/qcow2-cache.txt +++ b/docs/qcow2-cache.txt @@ -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 +With the default cluster size, to cover each 8 GB of the virtual image +size, 1MB of L2 cache is needed: - 1048576 / 131072 = 8 GB of virtual disk covered by that cache - 262144 / 32768 = 8 GB + 65536 / 8 = 8192 = 8 GB / 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 b1bf0f485f..f6804758d3 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -752,15 +752,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.