Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp5288557rwi; Mon, 17 Oct 2022 18:57:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6KK4gdjnhYG+/1Ub7WFOQgg8N6CvG7Nbt/IzE+y/hA+n+1qMuAd2aE/xI/ToOY73Nv677J X-Received: by 2002:a17:906:8a4a:b0:78d:5ff6:7507 with SMTP id gx10-20020a1709068a4a00b0078d5ff67507mr497458ejc.194.1666058252422; Mon, 17 Oct 2022 18:57:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666058252; cv=none; d=google.com; s=arc-20160816; b=cQNW7Ep87nTFwDpqbOfDNNch210z8ZRnFZKTrWtqzQ7yIOgsx4Qg71I3noFBArIDj7 5spjglJY1z2ku6ZK8AqCM7m2V8phuBvbvp1jqrY6SbHiHxVAmW6cICotjWWj90bU8U8g m50tVImr9ij5Yp7I2d6igVeOEl17B96R0aXyEjmAybaeh8+zxnuOo6Vamn8rgSNTQGJh qzXAeOZwDi/oQ3lo7Jos8D3ZZcEccRBqIz8rExTOQRFP24d5rACOn4ennWlbByFy/ZRz o3mGL7h6iouODQW+CCwFdduw95+6ENsVNKTFiVjfTGZPpVtXRHiK8r+KHyscmHt8lox6 gYIw== 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=PsBDvbs2M4mxVb7McFh5IYYbPQ7mymshNGX5zOJy4Eg=; b=o1plFFLioxuiNxOFoDTQLEs7Mz9OSmgCkF7lsIkUDwy/lK77QgG2Rc/1Er0RMUnMW3 2O7Yc5byz2w1B6comYJjdjtFjx5VZQ9PY3zlkzLxmAOEvarLFdMVwfWd7vgJFzyZIbB1 hEh5bmXGnDE4yatJXLh3fLfYaT02Ic7+ei9kpFghX5bBVIiQHSBZkVLVqraqajk0CT51 FEhqcZNpa5xJ98Gbj5uw0a2LZDb+4NFQ6DLM6MljqNbtPEiJG15kNBi3l+IAKHxJHvww k076gJ2Bk6NrYb41fssQJJ0QULTD2htz57j+chxV2WK5yDyFiZ5/Y6pf+b2MAuViYRY3 F4nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NVPVr9iA; 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 m4-20020a1709062b8400b0073155abc1b8si8532865ejg.154.2022.10.17.18.57.06; Mon, 17 Oct 2022 18:57:32 -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=NVPVr9iA; 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 S230404AbiJRBNg (ORCPT + 99 others); Mon, 17 Oct 2022 21:13:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230439AbiJRBNa (ORCPT ); Mon, 17 Oct 2022 21:13:30 -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 E2531491E4 for ; Mon, 17 Oct 2022 18:13:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666055609; 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=PsBDvbs2M4mxVb7McFh5IYYbPQ7mymshNGX5zOJy4Eg=; b=NVPVr9iAc8G4oiTCz0trTevtliQ+NqLUXUK5Gnst6ogK47kVQlMuUVeEnLp8sj1GPtoHSQ MHZ+5DNDOIlRBpZrLVBk0V1KTB1uwu9lDMDDzf/LxrPunNTnxetkGTX1/hR5EPamNubqDC 6Kkus7/OYMlgqRbCdjTHryIlbao1zb8= 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-497-sHvPlOf4OcC8k6B_KEyumA-1; Mon, 17 Oct 2022 21:13:24 -0400 X-MC-Unique: sHvPlOf4OcC8k6B_KEyumA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A6ACE833AEC; Tue, 18 Oct 2022 01:13:23 +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 8F5BC14657C6; Tue, 18 Oct 2022 01:13:18 +0000 (UTC) Reply-To: Gavin Shan Subject: Re: [PATCH 5/6] KVM: selftests: memslot_perf_test: Consolidate memory sizes To: "Maciej S. Szmigiero" 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, seanjc@google.com, 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> From: Gavin Shan Message-ID: Date: Tue, 18 Oct 2022 09:13:16 +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: 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.7 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 5:36 AM, Maciej S. Szmigiero wrote: > On 14.10.2022 09:19, Gavin Shan wrote: >> The addresses and sizes passed to madvise() and vm_userspace_mem_region_add() >> should be aligned to host page size, which can be 64KB on aarch64. So it's >> wrong by passing additional fixed 4KB memory area to various tests. >> >> Fix it by passing additional fixed 64KB memory area to various tests. After >> it's applied, the following command works fine on 64KB-page-size-host and >> 4KB-page-size-guest. >> >>    # ./memslot_perf_test -v -s 512 >> >> Signed-off-by: Gavin Shan >> --- >>   .../testing/selftests/kvm/memslot_perf_test.c  | 18 ++++++++++-------- >>   1 file changed, 10 insertions(+), 8 deletions(-) >> >> diff --git a/tools/testing/selftests/kvm/memslot_perf_test.c b/tools/testing/selftests/kvm/memslot_perf_test.c >> index d587bd952ff9..e6d34744b45d 100644 >> --- a/tools/testing/selftests/kvm/memslot_perf_test.c >> +++ b/tools/testing/selftests/kvm/memslot_perf_test.c >> @@ -25,12 +25,14 @@ >>   #include >>   #include >> -#define MEM_SIZE        ((512U << 20) + 4096) >> -#define MEM_GPA        0x10000000UL >> +#define MEM_EXTRA_SIZE        0x10000 > > So the biggest page size supported right now is 64 KiB - it would be > good to have an assert somewhere to explicitly check for this > (regardless of implicit checks present in other calculations). > > 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). > Yes, it makes sense to me. Lets add check in check_memory_sizes(), which was added in the previous patch, to fail early if host/guest page size exceeds 64KB. if (host_page_size > SIZE_64KiB || guest_page_size > SIZE_64KiB) { pr_info("Unsupported page size on host (0x%x) or guest (0x%x)\n", host_page_size, guest_page_size); } For the macros, I think all of us agree on KiB, MiB, GiB, TiB and their variants :) Thanks, Gavin