Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3074809rwb; Mon, 3 Oct 2022 09:18:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6iSi71ap4/pd8ThohFlkwAZF1EUg8iJnHQq2q/XA1R7syxJ1MNq+BCdXH3Dh08mWEALwFb X-Received: by 2002:a17:902:f60c:b0:17c:163f:c0a8 with SMTP id n12-20020a170902f60c00b0017c163fc0a8mr18020772plg.38.1664813896136; Mon, 03 Oct 2022 09:18:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664813896; cv=none; d=google.com; s=arc-20160816; b=xgdiaQU2E2m7ardRwpngNC0gNUr4Rvx2grWqXVh+DX1A/OiAdkogXruQhJBqtkR0hm D0zsH8hcqdYjUdlJdG+iQozj/uQBIWao6+ZU3/JjI4t/PLhQccKOtdEzjasbvc0csdqy IO7tdQOoxUgxEcKWfxc53mSkscfKQNNi3Ue0WBeitiVgEDVH61DIPKmA2zR7YzHUbsO4 ryVReMv2/CMlV0UFCPbnFeRyfUsw3F9SLk5fv+Q2r9bFSKx1Pg1wgHktPLbucRKDEUbz yfU1TEJuN9BYkN1eHWPOvH4q5TCUUpcAtHKTR49/jCxICzpGdUguMx4g+pS0gfSvdzwt XXFQ== 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=QuA2nOD/g6wO4fWfuOSK3kZxzasuklXfklg/Thl42UI=; b=yr/ASL8dUmJ3L4bdoZ06++qyBvdUI4ef0jb7poL6OAUkD0BSTutBnCzWR6RwEJeBWJ vFM8F342TEg0oHRHgvAMkvgzLn6XMzdiFL9LDpemkQJElttxaS74OLV/vCimcLKJp1N0 g3CXNRULEccTvNTF/URIH5d295NaiUpGnBIZU9ooziArVTKrbxsiFjxoyl3GkTsufuRJ 7mttzCAogw+pNFlTsPPJdmMle/eSTn1tq2AToBXug4lF16I6INqh/yME3UyMNq/o4uJS L+Gr14nR649ATgQAjqEDpTPuOeEe3xwMbcTpHendC2TJrt/5sKwWHxlTwafqT9L9bMh8 Fe6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=iauC8CGp; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jj21-20020a170903049500b0017ea636c490si4663121plb.189.2022.10.03.09.18.04; Mon, 03 Oct 2022 09:18:16 -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=@google.com header.s=20210112 header.b=iauC8CGp; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229587AbiJCPmf (ORCPT + 99 others); Mon, 3 Oct 2022 11:42:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229550AbiJCPmc (ORCPT ); Mon, 3 Oct 2022 11:42:32 -0400 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6C0424BFF for ; Mon, 3 Oct 2022 08:42:30 -0700 (PDT) Received: by mail-pl1-x634.google.com with SMTP id n7so10032064plp.1 for ; Mon, 03 Oct 2022 08:42:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=QuA2nOD/g6wO4fWfuOSK3kZxzasuklXfklg/Thl42UI=; b=iauC8CGpndM0cJg51qRBrKbHzQVrXOt5ulqjoPDFRlqkkRjLECvBZjNBSbhtx3y0Y/ wPkdvkD3l4OPZNXW1whw1m8MM6+Q4l67VnlPtsmtJEGyHf9kvlK20Usg27F9QDelf3lw YA8HRaGQSiuayuaFnwTOB9ZIIX5IgI00N1pAWS9DyP5GINXwsCx6m2C8jFrM+hN4CTUq P5VfYnDHSxZQizG+BjetkQUuy5Rgknd2hhMxkXSbJBazfSZvf8xNdzeENrj9Vpg/nDQp A91IDrn7aL1OTwxUGm4UeXUbXxMBin2vWChfbyOebTwDSRPDWjbLQW9QUDHOYQDnkL2Z KmDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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; bh=QuA2nOD/g6wO4fWfuOSK3kZxzasuklXfklg/Thl42UI=; b=eTlZPpow4/LLyv9PP9SsLjjrcVJU1vRQ3rpdzQP7PjVLyetbnsrCo2297UVTuoPyJz 2WMCG9Dx0/gKirddjX/I6EdT7V02+OmQZSbmERpzHgOuZooF8DibX/dXFGtvJBpzy4R7 k7HtIw7Ql9nB0YNfVGhK0j2YDD+1s/VepZUrPxknDAZNKCsHgJAD1cFa3O32H0kceBPA ZJRWUuUSNm4UaAgX8sE3nFRh5XNvwP15YmvQ8McJEWXLi51CkkvCngF8hngjITBCvVzL fPbA0nQEr80HeNWoqisWey69COKlSpRPOhaMKq3550tSd5YwDFocpqkMLz3L22SdYKuz Irww== X-Gm-Message-State: ACrzQf3o0jhOMQ3v3Q9EOEWrYtG6ZsQ+irUQitIXTvWaV4Zb3hXVR1so A7oEiiSi2wVsiNplO3TnzMj68A== X-Received: by 2002:a17:90a:a21:b0:20a:6fd6:f66d with SMTP id o30-20020a17090a0a2100b0020a6fd6f66dmr12967873pjo.70.1664811750230; Mon, 03 Oct 2022 08:42:30 -0700 (PDT) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id v5-20020a622f05000000b0053b2681b0e0sm7594949pfv.39.2022.10.03.08.42.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Oct 2022 08:42:29 -0700 (PDT) Date: Mon, 3 Oct 2022 15:42:26 +0000 From: Sean Christopherson To: Vishal Annapurve Cc: David Matlack , x86 , kvm list , LKML , linux-kselftest@vger.kernel.org, Paolo Bonzini , shuah , Ben Gardon , Oliver Upton , peterx@redhat.com, Vitaly Kuznetsov Subject: Re: [V2 PATCH 3/8] KVM: selftests: Add arch specific post vm load setup Message-ID: References: <20220915000448.1674802-1-vannapurve@google.com> <20220915000448.1674802-4-vannapurve@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 Mon, Sep 26, 2022, Vishal Annapurve wrote: > On Wed, Sep 21, 2022 at 1:54 PM David Matlack wrote: > > > > On Thu, Sep 15, 2022 at 12:04:43AM +0000, Vishal Annapurve wrote: > > > diff --git a/tools/testing/selftests/kvm/include/kvm_util_base.h b/tools/testing/selftests/kvm/include/kvm_util_base.h > > > index 98edbbda9f97..73cfee3ebd76 100644 > > > --- a/tools/testing/selftests/kvm/include/kvm_util_base.h > > > +++ b/tools/testing/selftests/kvm/include/kvm_util_base.h > > > @@ -839,4 +839,8 @@ static inline int __vm_disable_nx_huge_pages(struct kvm_vm *vm) > > > */ > > > void kvm_selftest_arch_init(void); > > > > > > +/* > > > + * API to execute architecture specific setup after loading the vm elf. > > > > It's not a "vm elf" per-se, it's "loading the elf into the VM". How > > about: > > > > /* > > * API to execute arch-specific logic after loading the selftest ELF image > > * into the VM. > > */ > > > > Ack. Will update this in the next series. Even better, call it from __vm_create() and name it something like kvm_arch_vm_post_create(). Like David said, while the hook has a dependency on being called after loading the ELF image, the action that arch code is expected to take doesn't have anything to do with loading the ELF image. And then instead of introducing an arch hook with no implementation, the patch that adds the hook can instead use it to replace the x86-64 #ifdef in __vm_create(). diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c index dafe4471a6c7..593dfadb662e 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -298,9 +298,8 @@ struct kvm_vm *__vm_create(enum vm_guest_mode mode, uint32_t nr_runnable_vcpus, kvm_vm_elf_load(vm, program_invocation_name); -#ifdef __x86_64__ - vm_create_irqchip(vm); -#endif + kvm_arch_vm_post_create(vm); + return vm; }