Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4268239pxb; Mon, 8 Feb 2021 12:00:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJyNBCNgoy3A4PqdAMJS92R9WLSq104A0UosHQueQdedJXO8AaMC86Fump3yTl7Th6A4o37d X-Received: by 2002:a05:6402:16dd:: with SMTP id r29mr10088535edx.212.1612814406054; Mon, 08 Feb 2021 12:00:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612814406; cv=none; d=google.com; s=arc-20160816; b=ITQdJSNfeSeNWNDa5Yoi6v6ceAtX7KvEI+9kkdt5aODZZwtqh7q3ltXNiHy6JdOCDI sl6NmcSvskBh9ew2rb0/6W/c9U55WRM2t+oimEsT672ta31HBspumvARId/c8kBzz8/s 4CxrWwPp+1EzDzQi5eI8AsHGRYc5mAnFEVsqo61EQJONaAxOVR9JXdWS2giSJ2iNCddq TM3euWOF0yvORjqF4pEjSazAq+m6srqmDtGA8/cfcyuCUMbXPKBN0ia5uBYtFCokQfPm CRDMwpC7P0hUX+NdeFkmDnK+PqTGAixEt3++3HpKmulyCtjkoL0HYMIanh7bKkcoI3a4 L88Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=/e5PLp3RTxWM6g/qVFsn49ZO2ohirYic5f4PB4jc4ZY=; b=a2apJT3eJY6n9LQIG7fHKtu+N33z0MK5GSxBF7+2tv+RdasrUJHALfgXPVMZjcikCp GPk09ANDOJTr3ZbMcL8GXTDu3//ZdYuykipo8j3en+LwG+8nCEpVySaAtDLCoimoePEK YnHrMau4r6uiLaqk6Tzoh8+ZO1tKBQ2+zFXPl9HFo/3Y89Do6ygFluzGaUGH1mx0c8T8 dc4renw0BGg5XjRDXv8Rl4pYRns4dfxoILonsj0FCcE1wAz4f2MLX5z1P6sqtZ5C0DkD 2jSEw4cw2S0SgFChKyWJwgZPnRHSOo+wOT/EJkiB0aGaK+z8aA7V7fb+azd1TyfsrSWe v4Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=BFg1UkNZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gz25si5947653ejb.373.2021.02.08.11.59.41; Mon, 08 Feb 2021 12:00:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=BFg1UkNZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S236379AbhBHT5D (ORCPT + 99 others); Mon, 8 Feb 2021 14:57:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235358AbhBHSOK (ORCPT ); Mon, 8 Feb 2021 13:14:10 -0500 Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B175AC06178C for ; Mon, 8 Feb 2021 10:13:30 -0800 (PST) Received: by mail-il1-x129.google.com with SMTP id m20so13628279ilj.13 for ; Mon, 08 Feb 2021 10:13:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/e5PLp3RTxWM6g/qVFsn49ZO2ohirYic5f4PB4jc4ZY=; b=BFg1UkNZ9SMlhyTC6i87VjnB4xZ+DXY84WteYAKejtKFAFnYFyKbtiYDMizAWFEG0I ViJWJoUapoct5jaDBcHYqQQdfNXEXZtFalj1LtGZuOggkN3TWv8No4VxNdwVj0OvLSqj y5h0I4mpHlgQapMx2SPYQ1981oYIKbarywq2rBhscty+X4vAi44jaG4BH192+HWTQnqc OrhV4DRtqUXZTIxUqYzY9BPgs1wO8if6DKTA+R9J0p4Y+pz+2kQH6bMThBm5+T9FUBfh dXkjetwjUFTdM1oLCuHS+2a0+QtUuB+WqPydFTR9l359i4u5DbS5ECw/lLohqlD+2Xh7 leow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/e5PLp3RTxWM6g/qVFsn49ZO2ohirYic5f4PB4jc4ZY=; b=D/vbx15asJB73BronlHxRkA9u36s9GeKevN9vJdoE8oO+PYzOb98dHL35ZqWW9Zy0h g43qor8UU7P/uTgc9OraeOD7i7sFnRR91SKLWnMILLTjWH8FAWH/Z4HMYS7rLYdtxb+Z s9Mird1eE7JXniJN2YwgYcEI0CtydSI8oHCdQnHC7k/f6wDca+f+29CM+IFXpUZI2etV zBlIGxVPVNsqWLA3yABVVjpsGMd58fCH9iybcYKSzuqWgyC+eC7A0V7bCe3knBrgPjdw hnaWgUfIc3tzlUozK2mv0rfZTeNE2+pAeEpcAqZ1LPCFnO462aMcfotEzVEcRuTgbKhp t+uA== X-Gm-Message-State: AOAM5330Z+a9BpduJkFglo+e40jpJ06l45kRsHrnu83cgTYXtzRy1nkE BHg0OH7FJbEPtg30ypAD0hSTtoBXhjHSejxoPHQFIw== X-Received: by 2002:a92:3f06:: with SMTP id m6mr16244038ila.283.1612808009705; Mon, 08 Feb 2021 10:13:29 -0800 (PST) MIME-Version: 1.0 References: <20210208090841.333724-1-wangyanan55@huawei.com> <20210208090841.333724-2-wangyanan55@huawei.com> In-Reply-To: <20210208090841.333724-2-wangyanan55@huawei.com> From: Ben Gardon Date: Mon, 8 Feb 2021 10:13:18 -0800 Message-ID: Subject: Re: [RFC PATCH 1/2] KVM: selftests: Add a macro to get string of vm_mem_backing_src_type To: Yanan Wang Cc: kvm , linux-kselftest@vger.kernel.org, LKML , Paolo Bonzini , Shuah Khan , Andrew Jones , Marc Zyngier , Peter Xu , Sean Christopherson , Aaron Lewis , Vitaly Kuznetsov , wanghaibin.wang@huawei.com, yuzenghui@huawei.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 8, 2021 at 1:08 AM Yanan Wang wrote: > > Add a macro to get string of the backing source memory type, so that > application can add choices for source types in the help() function, > and users can specify which type to use for testing. Coincidentally, I sent out a change last week to do the same thing: "KVM: selftests: Add backing src parameter to dirty_log_perf_test" (https://lkml.org/lkml/2021/2/2/1430) Whichever way this ends up being implemented, I'm happy to see others interested in testing different backing source types too. > > Signed-off-by: Yanan Wang > --- > tools/testing/selftests/kvm/include/kvm_util.h | 3 +++ > tools/testing/selftests/kvm/lib/kvm_util.c | 8 ++++++++ > 2 files changed, 11 insertions(+) > > diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing/selftests/kvm/include/kvm_util.h > index 5cbb861525ed..f5fc29dc9ee6 100644 > --- a/tools/testing/selftests/kvm/include/kvm_util.h > +++ b/tools/testing/selftests/kvm/include/kvm_util.h > @@ -69,7 +69,9 @@ enum vm_guest_mode { > #define PTES_PER_MIN_PAGE ptes_per_page(MIN_PAGE_SIZE) > > #define vm_guest_mode_string(m) vm_guest_mode_string[m] > +#define vm_mem_backing_src_type_string(s) vm_mem_backing_src_type_string[s] > extern const char * const vm_guest_mode_string[]; > +extern const char * const vm_mem_backing_src_type_string[]; > > struct vm_guest_mode_params { > unsigned int pa_bits; > @@ -83,6 +85,7 @@ enum vm_mem_backing_src_type { > VM_MEM_SRC_ANONYMOUS, > VM_MEM_SRC_ANONYMOUS_THP, > VM_MEM_SRC_ANONYMOUS_HUGETLB, > + NUM_VM_BACKING_SRC_TYPES, > }; > > int kvm_check_cap(long cap); > diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c > index fa5a90e6c6f0..a9b651c7f866 100644 > --- a/tools/testing/selftests/kvm/lib/kvm_util.c > +++ b/tools/testing/selftests/kvm/lib/kvm_util.c > @@ -165,6 +165,14 @@ const struct vm_guest_mode_params vm_guest_mode_params[] = { > _Static_assert(sizeof(vm_guest_mode_params)/sizeof(struct vm_guest_mode_params) == NUM_VM_MODES, > "Missing new mode params?"); > > +const char * const vm_mem_backing_src_type_string[] = { > + "VM_MEM_SRC_ANONYMOUS ", > + "VM_MEM_SRC_ANONYMOUS_THP ", > + "VM_MEM_SRC_ANONYMOUS_HUGETLB", > +}; > +_Static_assert(sizeof(vm_mem_backing_src_type_string)/sizeof(char *) == NUM_VM_BACKING_SRC_TYPES, > + "Missing new source type strings?"); > + > /* > * VM Create > * > -- > 2.23.0 >