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 BF85FC7EE25 for ; Fri, 9 Jun 2023 12:31:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240615AbjFIMba (ORCPT ); Fri, 9 Jun 2023 08:31:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239186AbjFIMb0 (ORCPT ); Fri, 9 Jun 2023 08:31:26 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 226D430FD for ; Fri, 9 Jun 2023 05:30:49 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-4f63ab1ac4aso2115227e87.0 for ; Fri, 09 Jun 2023 05:30:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1686313843; x=1688905843; 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=8h26DQt30aCyEhPT/ooAbXH6FQid93QFBSmTC7V6R+4=; b=A1lJFrFXashPyOVE6TwjfXwLaFl61XNjBlCsCbs7HxXdXlscKu2aQeb9jnMUEWsnFP Gqa4zxdJoUevS4rlfUKzeXGooNKBl4E8McMllHfEube1l2jxq71XlpYKaEuc/AZTzZGU FsJEx0y3rWxOwbP1p8DZ4JU1y29iK9r7H2K4jK3YiLEIbADb92nGDzMy8FKbGTP1EjBu 3917iiGGQ3TOwK7VW37L0tpiNLdcO/xRJYaSVn899cvVXqbC0NpJnY27H3fNnzr7Hp3R YkdzhR8Zn3sKS5jyM7PVZnwGzGYfrvHrwJrvRUDWtwkbk8efwrHQ7bTVrSq6sPp2DS0N OEaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686313843; x=1688905843; 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=8h26DQt30aCyEhPT/ooAbXH6FQid93QFBSmTC7V6R+4=; b=k1c4I2d88xz8Qldr0AzkoijIYI8ev3BTCT6IbZigJnbgDSVBaJPuGdjIEY4ObGfXnM SHNb21bFi3vzgH2JBXUo6NEhCt4MrJV6ZDaZzJXKz4ebaLN9DFo6Wtu6l920P19hPV6k RENOF5fty08bfN6E5pQhXTnaSSwFMzI2PNr6qN6pqnYhIionSwluA/h6/OdIrq8TiEHR kaJmZIpIwRIa00yjVxCsLV/HJDgTRC5rcsQBbT5/FdkWY5ju/MRwb7UM25OV6HyiBWr9 HHse3LoZVDg9teLSh6ilO9KK7hfbAqKfzYajb8zVGQNUXn+YIVFqnwSvhRmqW3oqwZMu QumQ== X-Gm-Message-State: AC+VfDw7fTdnp7Ts7foOLnVvs2IbQBOkbXYo2yFqdbuAeax5RRdk0/wq RY+nOgq8luum2fx9Sj77sreQUA== X-Google-Smtp-Source: ACHHUZ7LLidgDgGdihFdLBcYHtdurgJJ/J4UsIY+yeDDqqFfP2vMmCiYedKW6YkV6nfEzVsYqhM/Ow== X-Received: by 2002:ac2:5bd0:0:b0:4f2:40dd:e2cf with SMTP id u16-20020ac25bd0000000b004f240dde2cfmr773184lfn.55.1686313843048; Fri, 09 Jun 2023 05:30:43 -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 v26-20020aa7dbda000000b0050cc4461fc5sm1703120edt.92.2023.06.09.05.30.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jun 2023 05:30:42 -0700 (PDT) Date: Fri, 9 Jun 2023 14:30:41 +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 , David Matlack , Ben Gardon , 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 v3 07/10] KVM: arm64: selftests: Finish generalizing get-reg-list Message-ID: <20230609-b900162a66c26a004b751b1f@orel> References: <450cb59db52ebeaa68f3d77f1bd995618f3612b8.1686275310.git.haibo1.xu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <450cb59db52ebeaa68f3d77f1bd995618f3612b8.1686275310.git.haibo1.xu@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 09, 2023 at 10:12:15AM +0800, Haibo Xu wrote: > From: Andrew Jones > > Add some unfortunate #ifdeffery to ensure the common get-reg-list.c > can be compiled and run with other architectures. The next > architecture to support get-reg-list should now only need to provide > $(ARCH_DIR)/get-reg-list.c where arch-specific print_reg() and > vcpu_configs[] get defined. > > Signed-off-by: Andrew Jones > Signed-off-by: Haibo Xu > --- > tools/testing/selftests/kvm/get-reg-list.c | 24 ++++++++++++++++++---- > 1 file changed, 20 insertions(+), 4 deletions(-) > > diff --git a/tools/testing/selftests/kvm/get-reg-list.c b/tools/testing/selftests/kvm/get-reg-list.c > index 69bb91087081..c4bd5a5259da 100644 > --- a/tools/testing/selftests/kvm/get-reg-list.c > +++ b/tools/testing/selftests/kvm/get-reg-list.c > @@ -98,6 +98,7 @@ void __weak print_reg(const char *prefix, __u64 id) > printf("\t0x%llx,\n", id); > } > > +#ifdef __aarch64__ > static void prepare_vcpu_init(struct vcpu_reg_list *c, struct kvm_vcpu_init *init) > { > struct vcpu_reg_sublist *s; > @@ -120,6 +121,24 @@ static void finalize_vcpu(struct kvm_vcpu *vcpu, struct vcpu_reg_list *c) > } > } > > +static struct kvm_vcpu *vcpu_config_get_vcpu(struct vcpu_reg_list *c, struct kvm_vm *vm) > +{ > + struct kvm_vcpu_init init = { .target = -1, }; > + struct kvm_vcpu *vcpu; > + > + prepare_vcpu_init(c, &init); > + vcpu = __vm_vcpu_add(vm, 0); > + aarch64_vcpu_setup(vcpu, &init); > + > + return vcpu; > +} > +#else > +static struct kvm_vcpu *vcpu_config_get_vcpu(struct vcpu_reg_list *c, struct kvm_vm *vm) > +{ > + return __vm_vcpu_add(vm, 0); > +} > +#endif > + > static void check_supported(struct vcpu_reg_list *c) > { > struct vcpu_reg_sublist *s; > @@ -139,7 +158,6 @@ static bool print_filtered; > > static void run_test(struct vcpu_reg_list *c) > { > - struct kvm_vcpu_init init = { .target = -1, }; > int new_regs = 0, missing_regs = 0, i, n; > int failed_get = 0, failed_set = 0, failed_reject = 0; > struct kvm_vcpu *vcpu; > @@ -149,9 +167,7 @@ static void run_test(struct vcpu_reg_list *c) > check_supported(c); > > vm = vm_create_barebones(); > - prepare_vcpu_init(c, &init); > - vcpu = __vm_vcpu_add(vm, 0); > - aarch64_vcpu_setup(vcpu, &init); > + vcpu = vcpu_config_get_vcpu(c, vm); > finalize_vcpu(vcpu, c); I just noticed that this has been modified from what I posted to leave the finalize_vcpu() call here, despite it now being inside the #ifdef __aarch64__. That breaks the purpose of the patch. Please make sure this file compiles for other architectures without requiring additional patches, which would keep the commit message honest. You can either revert this to what I posted, and then readd the finalize_vcpu() call in another patch, or you can add a finalize_vcpu() stub to the #else part of the ifdef in this patch. Also please don't modify patches authored by others without calling out the modifications somewhere, either the commit message or under the --- of the patch or in the cover letter. Thanks, drew