From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CADE2C0015E for ; Tue, 27 Jun 2023 09:11:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232033AbjF0JLm (ORCPT ); Tue, 27 Jun 2023 05:11:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232049AbjF0JL2 (ORCPT ); Tue, 27 Jun 2023 05:11:28 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2033F1BCE for ; Tue, 27 Jun 2023 02:11:08 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-9920a6a6cb0so85335566b.3 for ; Tue, 27 Jun 2023 02:11:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1687857066; x=1690449066; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=MpzTw3E7Z1hiaRKO3mrWVuNDi99XvZiDXNO0HWAlUSI=; b=QSbolgKuWBtTP13NnqwJj/MLdAunJIZ6gtz5oOH0Gk/6uu5TXD3aDKDtckngzeGNaE 1divA1wajXFvZ959P2P+ecVS56HtJWwKO5XYGX0JXEuYv6O05YsmkbaJIdCG/KL7/D10 uHEgJAb7XNFWgRbEDEIIJ4I4sZ9N739G6DGlqAlMaT5P42qCLKyHgYCbKoqfG4iTAKAx bI1OoTRkfyOhA46nTLx7ebwlkZpdnr8u5LXchC20fCpLld228zc/vEqpWyQD9aAoB47D lerSIo0JkhbQ8MVSsOZDGbfhT7fNhyaPuOcCJRfbgyLEzvbkW+Le68KX/VsjoMKN7tK9 YR3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687857066; x=1690449066; h=in-reply-to: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=MpzTw3E7Z1hiaRKO3mrWVuNDi99XvZiDXNO0HWAlUSI=; b=K2Hvz8HFbup4daVAXTRLXBH9YcuHitRIiGmoZpyfvLz6T5x9mynWnJUAuFuAMzzZTd bfzwx3r27gAhTGaRnTUBRaeUhQ5/QnnpSwfD5TNLkvJzxQ+v1D6/io17BfDCa1oy4wUw iSzGXuEjaxTjXmI5FflcL9MVFtgxqSTSN/h4cvlKUzqcF56n1TK7Xq8s51wEeCim+URv ctjzfZyZnWEXZoiofDQDWWB5VPLvnuDY9c3l/l8IgZFqx+uHhiOcIHj4A4L4sX4qVU/9 oOE7JyOO3vXviAfK6/6KSeTCL4ZyTbVo6kUn+ys2sPSu2Qa+NaZom8U+FfOifdnBivyK pnqw== X-Gm-Message-State: AC+VfDzsc/sVoWrM5TUopkij0fgXMfisRHnH4W3IjB6945970IGJouNN wx56ZQYbUEwPVjvgE8K5DXPZug== X-Google-Smtp-Source: ACHHUZ450s4E0+V1ZLBeLohB3/YHAZdFg1IWiV0LH2NrGhbm/Wxox9eaLfHNxRxcEpnc0aueIWf7OQ== X-Received: by 2002:a17:906:5a59:b0:98d:f11e:4816 with SMTP id my25-20020a1709065a5900b0098df11e4816mr7286613ejc.29.1687857066569; Tue, 27 Jun 2023 02:11:06 -0700 (PDT) Received: from localhost (2001-1ae9-1c2-4c00-20f-c6b4-1e57-7965.ip6.tmcz.cz. [2001:1ae9:1c2:4c00:20f:c6b4:1e57:7965]) by smtp.gmail.com with ESMTPSA id ox27-20020a170907101b00b00988e81e1638sm4328436ejb.92.2023.06.27.02.11.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 02:11:06 -0700 (PDT) Date: Tue, 27 Jun 2023 11:11:05 +0200 From: Andrew Jones To: Haibo Xu Cc: xiaobo55x@gmail.com, maz@kernel.org, oliver.upton@linux.dev, seanjc@google.com, Paolo Bonzini , Jonathan Corbet , Anup Patel , Atish Patra , Paul Walmsley , Palmer Dabbelt , Albert Ou , Shuah Khan , James Morse , Suzuki K Poulose , Zenghui Yu , Ben Gardon , David Matlack , Ricardo Koller , Vishal Annapurve , Vipin Sharma , Colton Lewis , kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev Subject: Re: [PATCH v4 09/12] KVM: selftests: Only do get/set tests on present blessed list Message-ID: <20230627-adcb173b3ee813e2e16353bd@orel> References: <47f0502d076c071260a87953cbabadfc85d278cf.1687515463.git.haibo1.xu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <47f0502d076c071260a87953cbabadfc85d278cf.1687515463.git.haibo1.xu@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org On Fri, Jun 23, 2023 at 06:40:11PM +0800, Haibo Xu wrote: > Only do the get/set tests on present and blessed registers > since we don't know the capabilities of any new ones. > > Suggested-by: Andrew Jones > Signed-off-by: Haibo Xu > --- > tools/testing/selftests/kvm/get-reg-list.c | 29 ++++++++++++++-------- > 1 file changed, 18 insertions(+), 11 deletions(-) > > diff --git a/tools/testing/selftests/kvm/get-reg-list.c b/tools/testing/selftests/kvm/get-reg-list.c > index b956ee410996..3beb6b62de0a 100644 > --- a/tools/testing/selftests/kvm/get-reg-list.c > +++ b/tools/testing/selftests/kvm/get-reg-list.c > @@ -52,6 +52,10 @@ extern int vcpu_configs_n; > for_each_reg_filtered(i) \ > if (!find_reg(blessed_reg, blessed_n, reg_list->reg[i])) > > +#define for_each_present_blessed_reg(i) \ > + for ((i) = 0; (i) < blessed_n; ++(i)) \ > + if (find_reg(reg_list->reg, reg_list->n, blessed_reg[i])) > + > static const char *config_name(struct vcpu_reg_list *c) > { > struct vcpu_reg_sublist *s; > @@ -189,6 +193,16 @@ static void run_test(struct vcpu_reg_list *c) > return; > } > > + for_each_sublist(c, s) > + blessed_n += s->regs_n; > + blessed_reg = calloc(blessed_n, sizeof(__u64)); > + > + n = 0; > + for_each_sublist(c, s) { > + for (i = 0; i < s->regs_n; ++i) > + blessed_reg[n++] = s->regs[i]; > + } > + > /* > * We only test that we can get the register and then write back the > * same value. Some registers may allow other values to be written > @@ -198,8 +212,11 @@ static void run_test(struct vcpu_reg_list *c) > * be written need to have the other values tested, then we should > * create a new set of tests for those in a new independent test > * executable. > + * > + * Only do the get/set tests on present, blessed list registers, > + * since we don't know the capabilities of any new registers. > */ > - for_each_reg(i) { > + for_each_present_blessed_reg(i) { > uint8_t addr[2048 / 8]; > struct kvm_one_reg reg = { > .id = reg_list->reg[i], > @@ -242,16 +259,6 @@ static void run_test(struct vcpu_reg_list *c) > } > } > > - for_each_sublist(c, s) > - blessed_n += s->regs_n; > - blessed_reg = calloc(blessed_n, sizeof(__u64)); > - > - n = 0; > - for_each_sublist(c, s) { > - for (i = 0; i < s->regs_n; ++i) > - blessed_reg[n++] = s->regs[i]; > - } > - > for_each_new_reg(i) > ++new_regs; > > -- > 2.34.1 > Reviewed-by: Andrew Jones Thanks, drew