Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp25836752rwd; Mon, 3 Jul 2023 01:31:13 -0700 (PDT) X-Google-Smtp-Source: APBJJlGKSJgeYguRV41YRQaiGEgVkZk4SwSkIBjMXpokQAU7MYSTRj5YpsXGApk9NEBhvWuHWMLS X-Received: by 2002:a05:6358:1aa0:b0:134:edd9:8fde with SMTP id gm32-20020a0563581aa000b00134edd98fdemr6381525rwb.15.1688373073009; Mon, 03 Jul 2023 01:31:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688373072; cv=none; d=google.com; s=arc-20160816; b=VPRLSSJkG2ZVab1Vv9S4TPf4FLNDBa2SzVwN720vfTG5ZjrMvcnSqUJAtliL7YYZNp o0WM3XenKCdBYhAovtmgzWbimr9OFlbW2g7olllrn2l07yVsjQbrJAW6bNidtLongBQv kohC+FlTXqqcKPuG8Udukabecce4HqMH9t0CcYvoXZwEOUayO+/eXTBQiFwIPiGP/9QZ U2IxQEs3FtRzXZV63L99wjRLSPlayChojEjQPumyG1zI4YEb77AdlbaGGNMp4HMTyAiH pF0qbOSbJKgLRlxbgnUbIMS4oj3zUU70Y6KTo43o1mJz2OyaI7hZo8I+Q8GpNK91sHTo 8oWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=f0AIPmQjwEPFU9S6QPuv3kXAJyYa7R0ahvO9uqbNsw0=; fh=c5oaiD90ZklbOPM3ukSJZuV7+sR4s2K/TMN8imhfUx0=; b=jdVXoidkLMG4VjmXdiBEi+YeYGL87Jrt2Uc0BF5hamK9ezGn6XChuC/sRNo11ykxnd zVeD23oPdAfWGir0CqgqXgBG2DMea9zTxFmqGCwfJ9HtFUEpmp1/SdV+my8VI3TWnAtL RP1RNtkP6dyyH7KwVGNI93iJ0FjbjyoK7bj+dKQaTWBMkaANrdlIwVNvg50AS21Rr0o5 2nyXxlH6MnxDI59d54eF651JiTvE2dQfBMLG/opKVhpGdlUatZGZ999nP9PM+VDeWjaA xKuznXANHUbUfD/gNh50RxHLkV8dy0t8NoBItd6DZj0bGLQ+VgwREW1sC45qmm0xr3is ZwdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=CTXm0Evd; 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 w18-20020a634912000000b00542d69c515bsi17390313pga.533.2023.07.03.01.30.53; Mon, 03 Jul 2023 01:31:12 -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=@ventanamicro.com header.s=google header.b=CTXm0Evd; 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 S231336AbjGCISn (ORCPT + 99 others); Mon, 3 Jul 2023 04:18:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230383AbjGCISk (ORCPT ); Mon, 3 Jul 2023 04:18:40 -0400 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 969EF1BC for ; Mon, 3 Jul 2023 01:18:38 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-51d9124e1baso4793166a12.2 for ; Mon, 03 Jul 2023 01:18:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1688372317; x=1690964317; 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=f0AIPmQjwEPFU9S6QPuv3kXAJyYa7R0ahvO9uqbNsw0=; b=CTXm0Evd7f9xNERgFGe8Kgf2dIrXOUMZPOBGhEgXQdvIjRhhrv5Qh3s5ENWJ09z7ev 5wm7FiXz+iF/TvW0dDpczV2RwoT7ClRWoiG7fSddWKzNyBagcc/r7pNw84OiXN04lL4z wC0LmC5S4SY3KJKOoKwf0war+sU1MsM9XTZc+Scp7fmMYsS9QJtvuv34rKr0yMZAysn8 D2fh7In8mMCQM9+yNYsq6aVEQIOZzk4aw7h/eGK/mN535gJJ9Vny0AUFRXYlZM0dEbQr O8A0Ma5CFWhzbHzM3joBe8qmF4w64d0CQLFSC5gbL99qho7IZPwuRlOOued1WUV58MLW eK2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688372317; x=1690964317; 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=f0AIPmQjwEPFU9S6QPuv3kXAJyYa7R0ahvO9uqbNsw0=; b=UMiQOz8aWm5Vu1R0dC+//JW1cMnmhz8m3N8ksPj8bZWvrVkPIAsiGyV/imjdA/twcg atyPOJcgAd/uf54mwXV/MoKa6A9oo6x9tMBUFjYnaLUYg/1UUA64d9aESy1+UVCM16Ry 0cWiYARK9kS5iKle8mDNY4igB5BbpaoWTFlhgVg28MaHKuJBzupq3zMIJho3ay4Qjmzy OzsJfP0EvLLzz4bpSs6zlyUt0/yEspV44FsLeyMB/c4EdTGxfDeM43taO4SsIGGiG5RJ hXwv5olH0XfkL3XlbGDjGJ0ryzoRCZ3vPw8+J3hIrAqdjJ9NrhpCLGxLZ2dVwRPDTi5x 1FCg== X-Gm-Message-State: ABy/qLbT06tTvaAtu5ttkoqNn1HEvkldQVUqNrIiV615FyafqjpAt7Gy l9PszTguuOCSc5Pq5b+rTTqZZQ== X-Received: by 2002:a05:6402:4497:b0:51a:200b:d8ff with SMTP id er23-20020a056402449700b0051a200bd8ffmr6795812edb.13.1688372316835; Mon, 03 Jul 2023 01:18:36 -0700 (PDT) Received: from localhost (cst2-173-16.cust.vodafone.cz. [31.30.173.16]) by smtp.gmail.com with ESMTPSA id n22-20020a056402515600b0051e0f100c48sm1171605edd.22.2023.07.03.01.18.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jul 2023 01:18:36 -0700 (PDT) Date: Mon, 3 Jul 2023 10:18:35 +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 , Ricardo Koller , Vishal Annapurve , Vipin Sharma , David Matlack , 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 v5 10/13] KVM: selftests: Only do get/set tests on present blessed list Message-ID: <20230702-49c5545eb1ae2d0cf11c7b95@orel> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Sat, Jul 01, 2023 at 09:42:58PM +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 > Reviewed-by: Andrew Jones > --- > 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 c61090806007..74fb6f6fdd09 100644 > --- a/tools/testing/selftests/kvm/get-reg-list.c > +++ b/tools/testing/selftests/kvm/get-reg-list.c > @@ -49,6 +49,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])) I just realized this is backwards. We need 'i' to index reg_list->reg in the body of the loop. That means we need to write this as #define for_each_present_blessed_reg(i) \ for_each_reg(i) \ if (find_reg(blessed_reg, blessed_n, reg_list->reg[i])) (Which, in hindsight, makes sense since we're replacing a for_each_reg() loop.) Thanks, drew