Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp5121495rwi; Mon, 17 Oct 2022 16:03:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM55/3p1mM68jKHABGkpUO7uLEXPshDInpUX9wj84riS3oHlKde9UFrobmqlrG6WvpvFku+0 X-Received: by 2002:a05:6402:540d:b0:450:bda7:f76e with SMTP id ev13-20020a056402540d00b00450bda7f76emr22461edb.249.1666047803153; Mon, 17 Oct 2022 16:03:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666047803; cv=none; d=google.com; s=arc-20160816; b=tDtKIxSysmNW3xmUl3y6J5hEQdqvpepxzfmt6SG2BeRzcb9CDpcYw6pmzUSLCPmtgX UjMq0L7jPLoHn8k1amgJpTfMjPimk2M6Wf+Po8FjysPGboQPF7YkGbSR8wXmtCNOUyqo 6MrHZRW3ufMpwvLnQMHi5HPKOO2m3MlCYgucQGVTc3S1xJ4hRkEzoSjIun+evtgbJQS1 UI8bmVoWHxiH3tDAROCQcYXcPYqBLTMdhjebrKsBHaihtnMzhVsMLx3MF8VNTlpqtavL 0kF9KmXwyrw2x1yOiAe53tRfyh5WE3UdeWa75on7nBw8YTwPdW7S0/zaj9/S06gzxZty IylQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=I4KpnDtcT9cD9Jq+dzuNE+dz++5CJoZ3Z4DPq1F0/8I=; b=LVre249UmYSCEGFMQf/+V8b9q8r5gyeZOrm2qmg1KRnjqUeyzIMTXSUgiFCK1/Dw6X jAinWoGnA7w4WfXESPLglZzdvniUNfp87PsqMEzuPGMO6g5l6/YmnAxm5DP95CSQhT+C PXphNVPSojHIcmY+znhWgufcDGWf0OdGJNhJ+JaOMYXnVqMzp33wfRYzWCwJ/CvorqPx UAkEPG60QHFJS0kHDNfNgnFIJuVt6aN7UgqQxbV0rUxiSLswwYglBNgulXfrT2tP2Hkb CXOrjFnw4HXzMF0iy0R3KynkF/H8fvENGRPooh7cQ9xSwRvP9OG3xWkCfkJRQ0CIL8bi 41cw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n16-20020aa7c450000000b0043be542b956si8823897edr.262.2022.10.17.16.02.56; Mon, 17 Oct 2022 16:03:23 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230408AbiJQW5P (ORCPT + 99 others); Mon, 17 Oct 2022 18:57:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229822AbiJQW5M (ORCPT ); Mon, 17 Oct 2022 18:57:12 -0400 Received: from vps-vb.mhejs.net (vps-vb.mhejs.net [37.28.154.113]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 874C180518; Mon, 17 Oct 2022 15:57:08 -0700 (PDT) Received: from MUA by vps-vb.mhejs.net with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1okZ2Z-00024i-Nz; Tue, 18 Oct 2022 00:56:59 +0200 Message-ID: <93529fb7-f558-cc5f-d5bd-7923eb4b492c@maciej.szmigiero.name> Date: Tue, 18 Oct 2022 00:56:53 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 Subject: Re: [PATCH 5/6] KVM: selftests: memslot_perf_test: Consolidate memory sizes Content-Language: en-US, pl-PL To: Gavin Shan , Sean Christopherson Cc: 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 References: <20221014071914.227134-1-gshan@redhat.com> <20221014071914.227134-6-gshan@redhat.com> <9781c88f-06f9-4d17-8fa6-3cd82a739ccb@redhat.com> From: "Maciej S. Szmigiero" In-Reply-To: <9781c88f-06f9-4d17-8fa6-3cd82a739ccb@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS 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 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) > >     /* 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]. > Thanks, > Gavin > Thanks, Maciej [1]: https://git.qemu.org/?p=qemu.git;a=blob;f=include/qemu/units.h;hb=HEAD