Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp23808083rwd; Sat, 1 Jul 2023 07:37:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4ZO1qVRerNGqJ6n13xAA+Y41zbrzH6LxIjFrrF4Zsj44i18WIA+auVWML7CFBd6mNHV12i X-Received: by 2002:a9d:6c44:0:b0:6b8:8489:a915 with SMTP id g4-20020a9d6c44000000b006b88489a915mr6342256otq.27.1688222225269; Sat, 01 Jul 2023 07:37:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688222225; cv=none; d=google.com; s=arc-20160816; b=V+YttdnqEUxX39kWXgmb5RaaJy4et4v/1S9p84vlTkmLce7ZSxRgsGzeOE7sqECc54 LWPRuwt/o81aLQtp3pVLLxJNj0L9/M4TFfSoTJjTFL9rauSxfpkz2NI70SI+1dR1uHec +d3s8tmnwza/GEKIgtQZV/IpgFtwaquR2na3lC97dRTASDBYPXlXUBcz+9e05IFIq5Bs nXUfxl1Ihj/eu1fQWjYE7BMa7vdpsscLVvWcBMSOlG1nNEAZNPiVcDXsHzcM155feup3 hu+hmZbC6Knkqkdsva49sHpQ5tJY/mcULgrkTz1HhYmOvYL55z7QkyWT9Ifr4ZAgOWWZ aMOA== 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=Nw6L3iecsaCHUkBPU5RXg0XPBqr03epBdZqP9RT9erM=; fh=c5oaiD90ZklbOPM3ukSJZuV7+sR4s2K/TMN8imhfUx0=; b=xebo97yvPUsbftznCW5Q4eI0R/ykbYg7D9yXPzGFdSnrF1idVpYh4390DvQmflazIq /+B4JPHaWWtntpFdxbYPvphymYR0k56WF2k2Z8agAhlUxTJ5bvGXvaA7kntxRInSFety qvaPOebiMmZRYvm+wEIpwklaWJUsO/dg8tK8Ylc+7PPQjqDt7kOlZaDjHlvaotXs3lqU eHYL1MJVWZg0j1FleVvNaGRhRMa39HtcKLU0CH9j42+1BaQ7akU4Lj9LXAAI7bVNXSGu t0QTNjn7ctEo8FK+lsH1AhvvLKgDTx3EZsMaz6/p8HvsE2l5jtApi5gld/mCe2HsQemh y5og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=SEjhRB1Z; 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 r20-20020a6560d4000000b0055b0c720e92si8233498pgv.488.2023.07.01.07.36.50; Sat, 01 Jul 2023 07:37:05 -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=SEjhRB1Z; 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 S230263AbjGAO2u (ORCPT + 99 others); Sat, 1 Jul 2023 10:28:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229572AbjGAO2t (ORCPT ); Sat, 1 Jul 2023 10:28:49 -0400 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D42E135AB for ; Sat, 1 Jul 2023 07:28:47 -0700 (PDT) Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2b698371937so47348801fa.3 for ; Sat, 01 Jul 2023 07:28:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1688221726; x=1690813726; 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=Nw6L3iecsaCHUkBPU5RXg0XPBqr03epBdZqP9RT9erM=; b=SEjhRB1Z/veXvWxjUBHdLcwTje8hQss7D2GARjcPTW6LyYt9be7tMUY0+aJv5FX8d6 WN/IafFrpna99BKEss4ZEakuEqvPrr6jxvYicXyxhd9gki78+V6ZtrpXO7KDyY0LdunP wF+BIzAGDimhr5pUbfOSVBCdwpO2gAJq+H9oMydEoOX4/yBqliuqlSGq7I6UPlTkDlqc Ie8Ghz4fDCBz8V386sK5acwN5hWNX867hbR7NDNaZzi79fiWs1LvQaSE3LA2SeplH7AO msFZOPYU8Lpc/KeJfHlTxl1wDJ5tIMB/r0Hr/41wnEKrCOw+bWh9f8QNwaIhh3zufJYc Z3Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688221726; x=1690813726; 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=Nw6L3iecsaCHUkBPU5RXg0XPBqr03epBdZqP9RT9erM=; b=ao1eJK6VtYh2xkE0Esat0qfw9IcJB8/vdyqCp1YWopUDd1eXjZolQQ7fAxY4JWz7wP xqUeAXyeAtha4DE66Z5EFsI4zhicMusRBSgEQjr5JFhQ9d0+yromiOKU3blHcNDvi+bQ tOZgxwESaezTsyVsoyHlke7IzeLvwyZRcF89jmBeuu08w3s9dtN5GE9ETUQ2O+2fD+sM KEkvxUNLwuA1FdsfeI4wbJHv20TREaG4ffpaAFOW+Qjr4yoGQV39/m/nxthCd6Na8ev/ SvnK174hegCmbBpZEN8fhyp373fWHkhwpHhnN0KElfYPMEwcY7h5ZejhsivHiZjwJf4K flLg== X-Gm-Message-State: ABy/qLaNJAQCqxe2G+Y3NY1oAH/tWQy6idjx4wE/KjCx1VoGQBVRlSfP Hu5NDgKfQeDjwTN6JtIoI9XRTA== X-Received: by 2002:ac2:4db5:0:b0:4f8:6a29:b59b with SMTP id h21-20020ac24db5000000b004f86a29b59bmr3767983lfe.64.1688221725981; Sat, 01 Jul 2023 07:28:45 -0700 (PDT) Received: from localhost (cst2-173-16.cust.vodafone.cz. [31.30.173.16]) by smtp.gmail.com with ESMTPSA id z15-20020aa7c64f000000b0051de52f8adesm2357555edr.32.2023.07.01.07.28.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Jul 2023 07:28:45 -0700 (PDT) Date: Sat, 1 Jul 2023 16:28:43 +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 11/13] KVM: selftests: Add skip_set facility to get_reg_list test Message-ID: <20230701-2da2a0ffa7c1ccd3a549acea@orel> References: <0a418f26388e744b6ae2f17639bea08a05643549.1688010022.git.haibo1.xu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0a418f26388e744b6ae2f17639bea08a05643549.1688010022.git.haibo1.xu@intel.com> 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,URIBL_BLOCKED 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 Sat, Jul 01, 2023 at 09:42:59PM +0800, Haibo Xu wrote: > Add new skips_set members to vcpu_reg_sublist so as to skip > set operation on some registers. > > Suggested-by: Andrew Jones > Signed-off-by: Haibo Xu > --- > tools/testing/selftests/kvm/get-reg-list.c | 20 +++++++++++++------ > .../selftests/kvm/include/kvm_util_base.h | 2 ++ > 2 files changed, 16 insertions(+), 6 deletions(-) > > diff --git a/tools/testing/selftests/kvm/get-reg-list.c b/tools/testing/selftests/kvm/get-reg-list.c > index 74fb6f6fdd09..1a32a900aeea 100644 > --- a/tools/testing/selftests/kvm/get-reg-list.c > +++ b/tools/testing/selftests/kvm/get-reg-list.c > @@ -157,6 +157,7 @@ static void run_test(struct vcpu_reg_list *c) > { > int new_regs = 0, missing_regs = 0, i, n; > int failed_get = 0, failed_set = 0, failed_reject = 0; > + int skipped_set = 0; > struct kvm_vcpu *vcpu; > struct kvm_vm *vm; > struct vcpu_reg_sublist *s; > @@ -210,7 +211,7 @@ static void run_test(struct vcpu_reg_list *c) > .id = reg_list->reg[i], > .addr = (__u64)&addr, > }; > - bool reject_reg = false; > + bool reject_reg = false, skip_reg = false; > int ret; > > ret = __vcpu_get_reg(vcpu, reg_list->reg[i], &addr); > @@ -221,8 +222,8 @@ static void run_test(struct vcpu_reg_list *c) > ++failed_get; > } > > - /* rejects_set registers are rejected after KVM_ARM_VCPU_FINALIZE */ > for_each_sublist(c, s) { > + /* rejects_set registers are rejected for set operation */ > if (s->rejects_set && find_reg(s->rejects_set, s->rejects_set_n, reg.id)) { > reject_reg = true; > ret = __vcpu_ioctl(vcpu, KVM_SET_ONE_REG, ®); > @@ -234,9 +235,16 @@ static void run_test(struct vcpu_reg_list *c) > } > break; > } > + > + /* skips_set registers are skipped for set operation */ > + if (s->skips_set && find_reg(s->skips_set, s->skips_set_n, reg.id)) { > + skip_reg = true; > + ++skipped_set; > + break; > + } > } > > - if (!reject_reg) { > + if (!reject_reg && !skip_reg) { > ret = __vcpu_ioctl(vcpu, KVM_SET_ONE_REG, ®); > if (ret) { > printf("%s: Failed to set ", config_name(c)); > @@ -281,9 +289,9 @@ static void run_test(struct vcpu_reg_list *c) > } > > TEST_ASSERT(!missing_regs && !failed_get && !failed_set && !failed_reject, > - "%s: There are %d missing registers; " > - "%d registers failed get; %d registers failed set; %d registers failed reject", > - config_name(c), missing_regs, failed_get, failed_set, failed_reject); > + "%s: There are %d missing registers; %d registers failed get; " > + "%d registers failed set; %d registers failed reject; %d registers skipped set", > + config_name(c), missing_regs, failed_get, failed_set, failed_reject, skipped_set); > > pr_info("%s: PASS\n", config_name(c)); > blessed_n = 0; > diff --git a/tools/testing/selftests/kvm/include/kvm_util_base.h b/tools/testing/selftests/kvm/include/kvm_util_base.h > index e4480049000d..67c031fe89a1 100644 > --- a/tools/testing/selftests/kvm/include/kvm_util_base.h > +++ b/tools/testing/selftests/kvm/include/kvm_util_base.h > @@ -134,6 +134,8 @@ struct vcpu_reg_sublist { > __u64 regs_n; > __u64 *rejects_set; > __u64 rejects_set_n; > + __u64 *skips_set; > + __u64 skips_set_n; > }; > > struct vcpu_reg_list { > -- > 2.34.1 > Reviewed-by: Andrew Jones