Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp5171820rwi; Mon, 17 Oct 2022 16:54:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4igFPZitrzxXh3Ck1c8hhmv9RXCpKXfMq/NK7Xr0hfzYv2Ro7/6c9IBxSBjrK6n1yVjd8t X-Received: by 2002:a17:906:730e:b0:78d:94ab:77c2 with SMTP id di14-20020a170906730e00b0078d94ab77c2mr144621ejc.639.1666050883668; Mon, 17 Oct 2022 16:54:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666050883; cv=none; d=google.com; s=arc-20160816; b=Z4LLhqTTJhwShhm2MJZpSjYJUQf/0YQYUlvx7aSDlRiyq8QQ/zDHUWnkZ/HxyQyZZ/ ktLfLj51NUhAEKWjlrg68mUqa7+k0FEy4U1o/k9/LvbvXO2xImvxkYeOJrq4JttMnAEA LOu/6cwlkh9IHegGF5K6uaX+SS5MS8qvv/ErvJoJ2mFCEOEQAS+yyGcikvkaNbwBVU6Y hEIyKiYYlQ2gFqfpPYqDu1Op8jJGVkaMXOIfZM+m64x4Wfpl4HTbeHOSmEmTuidOg31v 4zFffholUrcpep5KZfSTd7xhVuxfMiL+6267cDxuI4rIGqlX6G/uydToyTFcNdKCSwBJ 6GOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=yiFrNuPRLUt6X6xjKV68iAAf2ofz98aq5uXkbPkmdVk=; b=NSoPIO3RLlhi1JclvsWOfmedEF5CBuW1lCJr64Lq49V4/uMctSYtxQ/uUZx8Cjmyb/ FrorkvkQl2M5B/hw8vIm+Y4SXl0opNne6zlJPZ+wx709tF1cr7DWgBCUZd+Eue+DELzE UFT+purU/1nXhRHffpN02EwFcYqrwJepjhJZJR2DdDDUPaLFnbpes5S8NPFYli0+HXiF ikN2YSnq/sIqI98IMJrecCM6jNHfQbOk1S60VcjN8DTy+ZeR2HXZ/Hmpb7yqAKU8lc2k uIDLg87CnbwSUc1UKplgeF0QYhlpFnEofuvN1Mxi3jHLkEs93fSvzLfNVgiyUAUE5+lx gBDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=eT3nz9X6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l15-20020a170906644f00b00771d781fb88si8828298ejn.411.2022.10.17.16.54.18; Mon, 17 Oct 2022 16:54:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=eT3nz9X6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230364AbiJQXcT (ORCPT + 99 others); Mon, 17 Oct 2022 19:32:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230119AbiJQXcQ (ORCPT ); Mon, 17 Oct 2022 19:32:16 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A1016F552 for ; Mon, 17 Oct 2022 16:32:16 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id c24so12191228pls.9 for ; Mon, 17 Oct 2022 16:32:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=yiFrNuPRLUt6X6xjKV68iAAf2ofz98aq5uXkbPkmdVk=; b=eT3nz9X6K4lR28izSZqgJLzSis/D5+BWPs1OkKQffM8Wy32Rm9GqE2SOwSMPx04Cfr OMWNKwL0D8G3pxScE3+PGWFfsT3zOh+BqzjBtvO7EEzy5RFMDRVpg8XgWSndERImRzzu vAvuBeZgTD9Xfqmv7dh3BB4iYCzbXeiOcBklgM9VG5nQilAZdRxOsaZojDOXksxYyEw9 +e52fzM+t+ipCJ2Te/D2uf7AUaYDY9Sne7nvrR757h8hvFmSnXV77N/B5k1RSkYKVcLP 00Mmhjn8/Dd0lznVbkTJaZJZsmM/hdSDugo6JEY2h3efQc65xD2HiMYC0a3shGPvSHZt nznQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yiFrNuPRLUt6X6xjKV68iAAf2ofz98aq5uXkbPkmdVk=; b=LmWeFHA+W3Za22Gt6o7iRlQU66CmH/x8CF/I3Z8tIzvFTBMwTZwzYzHIM+c8bSilXi 59795Mnt0NSi0NtXR1FY5dg8sNSeExmea6bp5U+LXE9xZHDMIj4hLGDw3yLIXo/EAT2K zutUrd4p9wIvjP43kTmMmOnq9dQsMIBPp/hN8aio7Y8+Rk5uhknL1foB6xNAgvLWTd0U lprd35FoWODleSFFDee4GdPPbxekbwWvSjLUHHdljUib3eljg/QzoXlzYDF8qW7hQKZZ ZVSMUH0zwrLNL5w/kGrpjfNYBOfHDoXayz3LkX2RMOd/xDrg4QWNUWwgetrp+pj4ov3z PHgw== X-Gm-Message-State: ACrzQf0hDMlILZ8bd4N/y1cueWlrm59zrZuN22JMCm9rXZkwHH1y2XNp bLpNo4SgOMoGW8N6md3O+qBbKA== X-Received: by 2002:a17:902:bd47:b0:17f:685b:27ee with SMTP id b7-20020a170902bd4700b0017f685b27eemr87911plx.22.1666049535619; Mon, 17 Oct 2022 16:32:15 -0700 (PDT) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id g186-20020a6252c3000000b0055f98a2c64bsm7948994pfb.142.2022.10.17.16.32.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Oct 2022 16:32:14 -0700 (PDT) Date: Mon, 17 Oct 2022 23:32:10 +0000 From: Sean Christopherson To: Gavin Shan Cc: "Maciej S. Szmigiero" , kvmarm@lists.cs.columbia.edu, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, ajones@ventanamicro.com, pbonzini@redhat.com, maz@kernel.org, shuah@kernel.org, oliver.upton@linux.dev, peterx@redhat.com, ricarkol@google.com, zhenyzha@redhat.com, shan.gavin@gmail.com Subject: Re: [PATCH 5/6] KVM: selftests: memslot_perf_test: Consolidate memory sizes Message-ID: References: <20221014071914.227134-1-gshan@redhat.com> <20221014071914.227134-6-gshan@redhat.com> <9781c88f-06f9-4d17-8fa6-3cd82a739ccb@redhat.com> <93529fb7-f558-cc5f-d5bd-7923eb4b492c@maciej.szmigiero.name> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 18, 2022, Gavin Shan wrote: > On 10/18/22 6:56 AM, Maciej S. Szmigiero wrote: > > On 18.10.2022 00:51, Gavin Shan wrote: > > > On 10/18/22 6:08 AM, Sean Christopherson wrote: > > > > On Mon, Oct 17, 2022, Maciej S. Szmigiero wrote: > > > > > > +#define MEM_EXTRA_SIZE??????? 0x10000 > > > > > > > > > > Also, an expression like "(64 << 10)" is more readable than a "1" > > > > > with a tail of zeroes (it's easy to add one zero too many or be one > > > > > zero short). > > > > > > > > +1 to not open coding raw numbers. > > > > > > > > I think it's high time KVM selftests add #defines for the common sizes, e.g. SIZE_4KB, > > > > 16KB, 64K, 2MB, 1GB, etc... > > > > > > > > Alternatively (or in addition), just #define 1KB, 1MB, 1GB, and 1TB, and then do > > > > math off of those. > > > > > > > > > > Ok. I will have one separate patch to define those sizes in kvm_util_base.h, > > > right after '#define NSEC_PER_SEC 1000000000L'. Sean, could you let me know > > > if it looks good to you? > > > > > > ???? #define KB???????? (1UL << 10) > > > ???? #define MB???????? (1UL << 20) > > > ???? #define GB???????? (1UL << 30) > > > ???? #define TB???????? (1UL << 40) Any objection to prefixing these with SIZE_ as well? IMO it's worth burning the extra five characters to make it all but impossible to misinterpret code. > > > ???? /* Base page and huge page size */ > > > ???? #define SIZE_4KB?? (? 4 * KB) > > > ???? #define SIZE_16KB? ( 16 * KB) > > > ???? #define SIZE_64KB? ( 64 * KB) > > > ???? #define SIZE_2MB?? (? 2 * MB) > > > ???? #define SIZE_32MB? ( 32 * MB) > > > ???? #define SIZE_512MB (512 * MB) > > > ???? #define SIZE_1GB?? (? 1 * GB) > > > ???? #define SIZE_16GB? ( 16 * GB) > > > > FYI, QEMU uses KiB, MiB, GiB, etc., see [1]. > > > > Right. I checked QEMU's definitions and it makes sense to use > KiB, MiB, GiB, TiB. I don't think we need PiB and EiB because > our tests don't use that large memory. Ha! I had typed out KiB, etc... but then thought, "nah, I'm being silly". KiB and friends work for me.