Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp664849iol; Thu, 9 Jun 2022 11:12:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmFbUO04xKz4Q1mWVw+vNeY0ww4N5FGTXpo45xmwQGt5KXmcMWhtePYtiqWkx2CtGe02hy X-Received: by 2002:a17:906:3e12:b0:704:6e14:9726 with SMTP id k18-20020a1709063e1200b007046e149726mr38352980eji.457.1654798372326; Thu, 09 Jun 2022 11:12:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654798372; cv=none; d=google.com; s=arc-20160816; b=TzSKztZdnPI3UycfJKyxTHF2FGONy54sSQ5HopoRCmHd4NRStTVZ0/+op6hP8ZFGcd omPuzFb7wQiara7qlZwJclYYLcuENSIAdFM02rYcZA43p5l2DiOYAoEHYglXzSooK+Ky Kv6kH6uSNJp5wbMIFp3+QoJbWbGVRAc4jZNnBdnJIwqwvTA/WnhXsnD8GYKlVB3rAm4j smcA636L0ViWyojWSq6us43giVvgLj4WE7Lfm8S/lAe2oZEionf/iqlDC0LktvYMrlSr HuUkJ48e0gz/sCSujpDSEkBji9YVm0CarIxqEQfI+4y5e2QGsBgAWJvhftaRAKPhPGCp hW9w== 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=l1RuhhV6V3rfp5Bg8hx1s4i266VbTUWDrdyJUQ4dZ/s=; b=Cnv/+HK3APSxBZ3XIGdla032aO4tTYWlpqvWQOAGRih3mnd/nAJjwPZG7yhyDTsCKk CxUwuR8oEY+72U3I/1fQ9rt+jZCC6RjsxME5/wk5HSoqFj5CAipkux0qlmUbl9ptsYnh v/rVXUz9+iZWzo9C7MiqlJc5ydFYt0SUYYpvy4v8Gg0Q7+5zdr1DgL5f6Bu0mT5XfBn0 +HS/5JHD8M9lJCTvD39uP9nP6CzC5i2wDsD1JUlbF4KJ9k6l/cCNuMTbCmUhiIaNE1Pq 7PiCHpihwRnaE9ic2LchlsWd4fvOajPDHs35AjcI+U1vg4/y/S6LSJRJz2WOl8gpAQYo 7Azg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="K/m8QIRv"; 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 dp19-20020a170906c15300b0070a74fde173si5719929ejc.410.2022.06.09.11.12.26; Thu, 09 Jun 2022 11:12:52 -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="K/m8QIRv"; 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 S1344970AbiFIR02 (ORCPT + 99 others); Thu, 9 Jun 2022 13:26:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238037AbiFIR00 (ORCPT ); Thu, 9 Jun 2022 13:26:26 -0400 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1044E2A26A for ; Thu, 9 Jun 2022 10:26:24 -0700 (PDT) Received: by mail-pf1-x433.google.com with SMTP id bo5so21649439pfb.4 for ; Thu, 09 Jun 2022 10:26:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=l1RuhhV6V3rfp5Bg8hx1s4i266VbTUWDrdyJUQ4dZ/s=; b=K/m8QIRv7PzfZ8gR37Iz3JTnF8ld3GeHoJ+AlQsO4o4ny8OmIyTH+saZtzNDu00ypt iL+jEyTxfiPvuy54Z/rgCKnf0Yhan0vb3U+hrpkPtvOL/w2QQdJ/nCRa008IGHM+ZNYo 2FgeO3hIrQxGimQO/tFnhsQTsVV3Bk6AU5D1CKLoYFvxnAvMqk7qIgDv5mq7Q960ISPF iGonQgP4DZR5mY4g6oAXp3Rtnmacb1KUBPXXmfXkgUGiAOkqwiy/VhSjNbkynULYnqtt 1BgYc6No+/RhgJGwVhpu5Z7uTCfDFaq4U0RRKJPqjcfP/uIyvvCn6BDOdjrKyhyIkUpv 77FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=l1RuhhV6V3rfp5Bg8hx1s4i266VbTUWDrdyJUQ4dZ/s=; b=6Ga3+dmK4XzDli4+PVgjfbln7pcpNJPWidfpyElIQxD6KLuDEgcyaRxQCBTwkNt0c/ vf1SO2aEY1D2KBrRPHncpHHZhmjm5peXjPcgVhDWLwREtAVvT6lCKpxCHKjbLxCAxsWJ NtZmORMwUsK7y29laZIXToT8M145HbN3IU8TxdaMaOrDnCtPAlZoPJqi2k75ZaG7uA2L hA8jlKZ5dA9i+Ca3i8XpYljKWDfTgx+Xw2/tvQ/LW9BIt8BeV6E52uum0d+8GbYbWDtc 0XRY4thCTU6TFLvmF6HfK55K8eG1vbB7o2hvTEyYTpgpzctlbxjnNlLcQzbVBiFJ0R66 hxsA== X-Gm-Message-State: AOAM533k/qylcDhtX7Aaa4DCr6AKKCJH8AD1COhBjCQk8e0uSQ41WUYV y//qEov3o5uWBGRHppwr0mXFDQ== X-Received: by 2002:a63:5:0:b0:3fe:2558:677 with SMTP id 5-20020a630005000000b003fe25580677mr9928929pga.113.1654795584274; Thu, 09 Jun 2022 10:26:24 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id g24-20020a1709029f9800b0015e8d4eb242sm17127418plq.140.2022.06.09.10.26.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 10:26:23 -0700 (PDT) Date: Thu, 9 Jun 2022 17:26:19 +0000 From: Sean Christopherson To: Andrew Jones Cc: Marc Zyngier , Paolo Bonzini , kvm@vger.kernel.org, Vitaly Kuznetsov , David Matlack , Ben Gardon , Oliver Upton , linux-kernel@vger.kernel.org, anup@brainfault.org, Raghavendra Rao Ananta , eric.auger@redhat.com Subject: Re: [PATCH v2 000/144] KVM: selftests: Overhaul APIs, purge VCPU_ID Message-ID: References: <20220603004331.1523888-1-seanjc@google.com> <21570ac1-e684-7983-be00-ba8b3f43a9ee@redhat.com> <93b87b7b5a599c1dfa47ee025f0ae9c4@kernel.org> <20220609074027.fntbvcgac4nroy35@gator> 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, T_SCC_BODY_TEXT_LINE,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 Thu, Jun 09, 2022, Sean Christopherson wrote: > On Thu, Jun 09, 2022, Andrew Jones wrote: > > On Wed, Jun 08, 2022 at 11:20:06PM +0000, Sean Christopherson wrote: > > > diff --git a/tools/testing/selftests/kvm/aarch64/get-reg-list.c b/tools/testing/selftests/kvm/aarch64/get-reg-list.c > > > index b3116c151d1c..17f7ef975d5c 100644 > > > --- a/tools/testing/selftests/kvm/aarch64/get-reg-list.c > > > +++ b/tools/testing/selftests/kvm/aarch64/get-reg-list.c > > > @@ -419,7 +419,7 @@ static void run_test(struct vcpu_config *c) > > > > > > check_supported(c); > > > > > > - vm = vm_create_barebones(); > > > + vm = vm_create(1); > > > > Hmm, looks like something, somewhere for AArch64 needs improving to avoid > > strangeness like this. I'll look into it after we get this series merged. > > Huh, you're right, that is odd. Ah, duh, aarch64_vcpu_add() allocates a stack > for the vCPU, and that will fail if there's no memslot from which to allocate > guest memory. > > So, this is my goof in > > KVM: selftests: Rename vm_create() => vm_create_barebones(), drop param > > get-reg-list should first be converted to vm_create_without_vcpus(). I'll also > add a comment explaining that vm_create_barebones() can be used with __vm_vcpu_add(), > but not the "full" vm_vcpu_add() or vm_arch_vcpu_add() variants. Actually, I agree with your assessment. A better solution is to open code the calls to add and setup the vCPU. It's a small amount of code duplication, but I actually like the end result because it better documents the test's dependencies. Assuming it actually works, i.e. the stack setup is truly unnecessary, I'll add a patch like so before the barebones change. diff --git a/tools/testing/selftests/kvm/aarch64/get-reg-list.c b/tools/testing/selftests/kvm/aarch64/get-reg-list.c index ecfb773ec41e..7bba365b1522 100644 --- a/tools/testing/selftests/kvm/aarch64/get-reg-list.c +++ b/tools/testing/selftests/kvm/aarch64/get-reg-list.c @@ -418,7 +418,8 @@ static void run_test(struct vcpu_config *c) vm = vm_create(DEFAULT_GUEST_PHY_PAGES); prepare_vcpu_init(c, &init); - aarch64_vcpu_add_default(vm, 0, &init, NULL); + vm_vcpu_add(vm, vcpuid); + aarch64_vcpu_setup(vm, 0, &init); finalize_vcpu(vm, 0, c); reg_list = vcpu_get_reg_list(vm, 0);