From patchwork Thu Aug 9 21:53:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10562059 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 D67C715A6 for ; Thu, 9 Aug 2018 22:09:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C389E2BAF0 for ; Thu, 9 Aug 2018 22:09:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6F932BAF3; Thu, 9 Aug 2018 22:09:00 +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 00CD72BAF0 for ; Thu, 9 Aug 2018 22:08:59 +0000 (UTC) Received: from localhost ([::1]:53086 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnt75-0001ZU-5B for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 18:08:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48128) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnst2-0004GL-5Y for qemu-devel@nongnu.org; Thu, 09 Aug 2018 17:54:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnssy-0006Vo-HT for qemu-devel@nongnu.org; Thu, 09 Aug 2018 17:54:28 -0400 Received: from mail-eopbgr700109.outbound.protection.outlook.com ([40.107.70.109]:22016 helo=NAM04-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 1fnssy-0006UJ-7f; Thu, 09 Aug 2018 17:54:24 -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=XacanyZ1IA8n+FCEmn3SsTFa0TykxqjE5NexHwvM0rX1ywIUrl4Jecyvil7G7/qhyP/dCH0HpGOdyB6hvZUsL513co6VcxIVVtswwP/6vA6NoVcYk9Xpk0HS8z1gxsq9mNqosJKJDzSV/GEnKBfmYc7Mv4mJLx1Cc6+Q1Ca6i0o= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CO2PR07MB2615.namprd07.prod.outlook.com (2603:10b6:102:14::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.23; Thu, 9 Aug 2018 21:54:20 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Fri, 10 Aug 2018 00:53:00 +0300 Message-Id: <20180809215307.18241-2-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180809215307.18241-1-lbloch@janustech.com> References: <20180809215307.18241-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM4PR0101CA0050.eurprd01.prod.exchangelabs.com (2603:10a6:200:41::18) To CO2PR07MB2615.namprd07.prod.outlook.com (2603:10b6:102:14::10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 81fe516e-5bda-4654-07ba-08d5fe42aa47 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:CO2PR07MB2615; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2615; 3:DXZMe46NUnYaVHlGzRJJX7cTlPwYwyfflFGa/diYnOaA/Q9OfAu4jCKNvHdByF0XDge7BFkGwpvhjfbVllCqctXgoeEJhgeBkOnMoB+5bKL/EbFQHadjcQcNuvV0c2kukvHCFvIsAtmGafGzMDtybw8QT+SDLyDbEPEVAJ0FJk+gpYz8VGfDRpSq9lP+PRqYcf5Wl0xjihJhnjx1X9KznWS7eI9OcBuy5ySU+xF9Fvu7YE9zmraoBgRoH8f6iTRL; 25:UqN1WmgzEyXFmUbWLFlCvw0VD7qVwrn458kUYRreLDmwkb1vlRLPklQb2JWpeP+Dp0kq/qxc/s0y8HN20ZaiApWdMhxsDE2E1uoR2viPRCIjSH9JvNUBdvTG4obRU6HdYV/PZP9NvaL7lloP5Zol7+Zav0Xr7GtNbIAvo/ZXKpAU6/sNlt4BOdjvoVAlgqNnq3zglaDlVfjBUqDd27x4taDEW76qiAX86NyJ2koJU7B0E3GVIQRLLAzjh1JAhUct1Qi7vk/gZUwFMF90VHkfQKXlQ+gTm0VnB3LfhDdwhRJ7B/2HGT7mLeBHP+7ISuUPk3e3lqRPE4Wp9iMBkx4P0w==; 31:82qakJX6epHfFBU+pTRG2NP8Jc6Isk0SXgZepWd23ifWctdcDS0U/fTm7SNpsprG5r0SAcaGPmj08Lrp/5n0Igq/b5rgYQ/PUxjx+RInt9qA/F5bp9kHyn2LRbWUfWO/OgU5IMhY3FA/kdkuvzvLrmP0fF4LdSzpt+kbCtS1Lodrzwz8eP+Vp/uPjq3ALgGS3CNg6yIm/nxnxdbyP3TbGWpXupYsSN1bC/juNTYiJW8= X-MS-TrafficTypeDiagnostic: CO2PR07MB2615: 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)(3002001)(3231311)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(20161123558120)(20161123564045)(2016111802025)(20161123560045)(20161123562045)(6043046)(6072148)(201708071742011)(7699016); SRVR:CO2PR07MB2615; BCL:0; PCL:0; RULEID:; SRVR:CO2PR07MB2615; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2615; 4:KzS/3u8dbbg8KXH+wucKi5miwOY4wEmAWuqfFFFTWA7abCshLC5xnl7uOt5HO7DbfE5hmf71mg2hi23NpzLhgdQnuXGFl9b0IUiCIA9kaR4oXBZSAJqOZF3MZUhObhlWdVq3GKOBNELYbKfdlkBnYZzf82xJ1/w8J0w1ffZDWNhFsF65E+QTUqVh+9qSe/ysZ7DZSNF5fdf6z4YNCjsCL9n9tLO7wQd6/0gZEQB6+k7mdA4X0H5tD0M9VIsMP/Edi5We2nCIzRcOCbk/k9MzrA== X-Forefront-PRVS: 0759F7A50A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(376002)(346002)(396003)(136003)(39830400003)(366004)(199004)(189003)(486006)(2616005)(16526019)(86362001)(6486002)(7736002)(8936002)(16586007)(48376002)(575784001)(551984002)(478600001)(446003)(81156014)(68736007)(81166006)(186003)(476003)(26005)(305945005)(386003)(2906002)(8676002)(50466002)(50226002)(14444005)(956004)(11346002)(25786009)(316002)(52116002)(51416003)(6116002)(6506007)(1076002)(3846002)(5660300001)(105586002)(6512007)(106356001)(6916009)(47776003)(36756003)(2351001)(4326008)(97736004)(53936002)(107886003)(66066001)(54906003)(2361001)(6666003)(76176011); DIR:OUT; SFP:1102; SCL:1; SRVR:CO2PR07MB2615; 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; CO2PR07MB2615; 23:hNrCR9LVTorqzOcpq5nH8MhE47aDVP8U1ieLrEsgh?= qYKj/hWQOV9nU+8CYBisUJH0P5mFwbOSfwMCnvmv31iGjUhKXGRNRNj6drZ+/TQHfzMtpocBWxkfvfHt+SEhgVFqW9fJ/eKokpwwTd02fkhDWL8LII97equDwlpLDy0omiNy7KdL+dWCOItAeU0wGWqtJyiR+QZhCnCAqO4VQAJqZoamq5fN0/oxqmWw46oOx1bFClEblYg/03AKqCHfHAFKrnYe/VYcRyMdIV4MpRV1Qsx0qsRAPvCbp24jGGyFe+UNh7551B063OAVl0Mver8RDr7oDa9/V1JieeeFGDnrWezXNikTMM85NuiGlp42BoXMAueWdlgh3XnKvC/niqACiDauNhKVmtfo1HG/hg23jzGhQducuAMA8M/k9UtKimVNQ8DVzHgTX1DKpRvLHWYqh7O3JIx+3d+RdFlar+fDGmMBtojNYjVTTS9FnM4KUBo5P/bFfse5g8UPc0Hs0AhMJ0aY8ihooSpL9ScuSSSfLGwu9wEigINN74YNC3VYEZRbJGCD3vNftkyk1zwI5Id2OhLD1uDgQmeFuCwFFgY7kNrKr6Wgb7SI/rA8mWkzS//e/xSaUzi5PprF9gH0QMxEfll6Sysw/z1eQg0E8+HjC0+k6iTUwGuF3YNfvAgQkln029ZORUHHC6UYv9+OWh1TzPKh3wHIyoTsRQf9CEDcaXTFmNBMF5g7PvhXpaFYELuFR5eoVLm7Pd+nvt7PDQ9QzTeTeGncSUF8E+b+SbanhrZqUQ46NenuZT8WcZAIX0VgApRU+bTu7tJXuIiC++m1n8ZuE1PvZepOxGT9QbIga/ikmuikRKgYpL5B9ZoTKGB3EzW6xHNd/iJXf7hoxsHQmWndTJAbqlJ8fX039Q+Y4iH8ru4XFtf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bx84QQsYJLVmnfMzt8qG+6M59rAe/93gr5nNjPlR03//bi03NnEWQyq5mKBToAn4clsju+Ke5/qaNDd3kVVFWRXuSr6e2DKvf9XhYot45HCy6P2MjJpRLJBkjKT5RSeMzexh20+JU3UeRm1nPG4mHvUUB2Dt3H6ZcHIZCYN/BtZoxknuKl8DlA+SDazuqWfVSbvTH/M1tdiWxxkWKqb7WqehBFfBW8UFiuvZw==; 5:Dl3HjEtxo/0fssFJDp16Zo7Ks0G3+TKzKTuBTJd21QNNWFxFe+ByfdGXA7dM+JN8N/+pdR2XF6WaL4YS44ahXSLtTjBesHtwgxEE57o4M2o4wR+ySsYieLbQiVHU6PT+B7yV+adyfnAGHByGPMtIY/XJtLZIpsQar7zs55PWeAQ=; 7:91tMhx2ZnmdrZJKYyYOWX2j5gopBIPxe/EKT2HR3Ne48fgVxeN6ma43SkufXj7LwZlJOTIPBUfl5M7rNzMUuM8pJOdymRUej2MYAC4QOsi6RqCvRStmx3RbIAKGZ5NdXtm1Xd3G3e+DNUmwfNXB1iFw5W7T/JAjfL861FPu+KGicEoimpLYrJl3X/1NmWYnGY8RyxasomD9JvK9aRZ1WScxDpMD4WZuHAWpdryMcEhf5TKvd+QOXqaRXfxdYTkxM SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2018 21:54:20.0623 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81fe516e-5bda-4654-07ba-08d5fe42aa47 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB2615 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.70.109 Subject: [Qemu-devel] [PATCH v6 1/8] 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.