Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp5188492rwi; Mon, 17 Oct 2022 17:10:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ofiCJwlreMDEFTeAVw4U3kNFpvbpxxXtYuW2bRda1nE6lgGMXY/wOmqthV5t86f+yt2Ww X-Received: by 2002:a17:907:75d8:b0:78d:3c2e:9a99 with SMTP id jl24-20020a17090775d800b0078d3c2e9a99mr199021ejc.686.1666051801754; Mon, 17 Oct 2022 17:10:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666051801; cv=none; d=google.com; s=arc-20160816; b=BReBJEeqWIyvVw6B0iio95e0SGKR9Z8L4KbDacd6lTIgpxPrJ5lQgUwQrTLNPGZdma QFX0Oo5cDdSJiyikBRV3NqlqWxnZ0ypqlmrh5jP7dIdErwCw0sn7VFu3ASVjmvncIb3l /ylQyrevJPzo8r6FHw7A95HzWKLpINQmMki033JJzI8zkwkiIP/8vDHNUxHxBnu5Ab9i yx1Sm5A/inGlMEZyoptChn2nhM/x3ORt9a4jPxNitxVG9Z65SnnZK4+EI9L78IzE5ag3 6RhKv7URa6lP9EzIuAGoqWqEcBRae0KOw3D0Loj1R1YFusjUeXeEhhevfTxi3aDPyLOx nsWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:reply-to:dkim-signature; bh=HK/sOYAOUF+Wgu2q9ChioZOCXwS8WyiwOj38FtjnWoQ=; b=H5lTThd7mrgK2Fxu+/dkCNIxne8K7jwt8gITM4Ux0YqqRuDGSdsdxBkX3PX+vTBomV bOQPFuHVOzhaYsREMVATuBWAVL9P2SOsZm6JhfxyU/uu9gZaNVefBiBkHS5S1vgD+4dw 6wNB8iGO10VtaMMz8Tkw7c9LVPbBpBjaB0vIri9yeCRsjVZLdiL6EufDj26PqGf4SuQ6 iL/S4nEqLOgFDbjd9amK2UdkALNT2+JbA7/tmIzp6QYIwuvP3tCop7wD7RvNSHE7uCJE vI1Lnf8mQp5et0V0kPLieJO7N4u3Fp/SNJvB+jL+4om7lXsEUJoKEeU2x3MWOdq2xmWC WQoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MJyTzfHW; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dz13-20020a0564021d4d00b00453a0393deasi11547449edb.368.2022.10.17.17.09.36; Mon, 17 Oct 2022 17:10:01 -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=@redhat.com header.s=mimecast20190719 header.b=MJyTzfHW; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231532AbiJQXM1 (ORCPT + 99 others); Mon, 17 Oct 2022 19:12:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231537AbiJQXMF (ORCPT ); Mon, 17 Oct 2022 19:12:05 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C34464DB7F for ; Mon, 17 Oct 2022 16:11:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666048257; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HK/sOYAOUF+Wgu2q9ChioZOCXwS8WyiwOj38FtjnWoQ=; b=MJyTzfHWlKXoD1bBQECT6V0xpR6mGtycedgOmplHeIClGSBjCNB9xircklo4LnonME7lcs 744FXdi2klleSfIp9Rn41PQ2Fd/32I7stcgMN2t9KuXcZnTttVEPu8qC0ri9A1nKLk5tzl gYxJ6vZOjl9HUWCLFQKAWbEcwxq4t1c= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-1-QxuXVbsQMOqllH4t79Mxvg-1; Mon, 17 Oct 2022 19:10:54 -0400 X-MC-Unique: QxuXVbsQMOqllH4t79Mxvg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4D745811E75; Mon, 17 Oct 2022 23:10:53 +0000 (UTC) Received: from [10.64.54.70] (vpn2-54-70.bne.redhat.com [10.64.54.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 522972027064; Mon, 17 Oct 2022 23:10:47 +0000 (UTC) Reply-To: Gavin Shan Subject: Re: [PATCH 5/6] KVM: selftests: memslot_perf_test: Consolidate memory sizes To: "Maciej S. Szmigiero" , 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> <93529fb7-f558-cc5f-d5bd-7923eb4b492c@maciej.szmigiero.name> From: Gavin Shan Message-ID: Date: Tue, 18 Oct 2022 07:10:44 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: <93529fb7-f558-cc5f-d5bd-7923eb4b492c@maciej.szmigiero.name> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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 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) >> >>      /* 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. > > [1]: https://git.qemu.org/?p=qemu.git;a=blob;f=include/qemu/units.h;hb=HEAD > Thanks, Gavin