Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp43490pxp; Tue, 15 Mar 2022 23:16:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrbqKPr4Q3I13QpqnuvYqPEYqxZn+O92Oik5+krqxY7X9flMbATx2dHv2+uu6mZIvc+HpZ X-Received: by 2002:a17:906:58d2:b0:6da:b635:fbf3 with SMTP id e18-20020a17090658d200b006dab635fbf3mr24991316ejs.40.1647411373530; Tue, 15 Mar 2022 23:16:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647411373; cv=none; d=google.com; s=arc-20160816; b=GZzeQAak6Q35c1f+/IcxUqukp5zVQunYzUxlb4YniJn3MgldAyXzv8498t/DWl7/eg l8DbGHa+XDFfQ1lmH7Prq92qrCnrTpbC5YncIwps/HGUEL909aW6J5EXg348n7kszsnN ya3eYcaL/NtPpUkBRE4x8h9ZV9/6eylTsTi5fq40DMxRpBPKsW3l1X+HX5lqkmZsMwJp ir3dShwTymWO8aSlt/C7AGY/0sNRWJnicBOSNz2JIk3WOXXUKB5sjUlipssadaquMgaw P60reeSF8DMr2oFVSuopzfJ4n2rnnCkQVYJZIpMhHXvHl7a4yDri2Ew5Q6zJAtO+pBRB lmvA== 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=xsL1yyPtJH82a/B6MBZL26Q4PHqCsWQNmYIJJchipuw=; b=leD3/Wx5Qxx7VmdQmuy+WbEafeV1fRfheCr5F/Mq5R5bWyqdkm4kKdBpx242Q2sR+7 tGsLE56XKeJgPpsk7qHCSCKuRwiq286piwuGKXe086Y4Pip3U2AKnwYQdxzSK/0szEr1 jQ2qSNHrPfml6Mqs/+LtmLSAlv/VPy77MRDVqKqUJ6Ih/KFiHj7rVnojYorB5Q6RCPvy WEZ3vu73busrdwhHcNa63hoFc98iV5fqhPAhPjvrQ/GCBMx4E4h4qmwzAit2zei4ZhRM CwkI953kaMXg18uWTjae2IuiDaoi1WwYM2i5Si3r2N8oKliYKjHjMtumGmT72qdr2nxo mUVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=KtqEQwoi; 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 js5-20020a17090797c500b006d733812b03si609053ejc.534.2022.03.15.23.15.37; Tue, 15 Mar 2022 23:16:13 -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=KtqEQwoi; 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 S243543AbiCNR6U (ORCPT + 99 others); Mon, 14 Mar 2022 13:58:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243300AbiCNR6R (ORCPT ); Mon, 14 Mar 2022 13:58:17 -0400 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26BBE3F316 for ; Mon, 14 Mar 2022 10:56:58 -0700 (PDT) Received: by mail-io1-xd34.google.com with SMTP id r2so19209322iod.9 for ; Mon, 14 Mar 2022 10:56:58 -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=xsL1yyPtJH82a/B6MBZL26Q4PHqCsWQNmYIJJchipuw=; b=KtqEQwoiSXyAB3K4bV435qjbFXJZkJJNQyB/cVy7lTZCWPCMP2gCAsuv8gd7ryVSiE bcsa7fl/aMf90imqBHODe+ZAIZE7CpC69Y40xpkKe5wSCRHZxp/H87xAcWvB4JNOXu3d bNiKKFNhApF15p3dDy5q41PwLrkWIsaQdJFqS+Bd6WyR58vyuWxz5OX3NZ1+tU7YGQr5 Fb59HUD42e2h2poQpjhprRt/6U/KIh5FL3WH6ehqyhiCyYe6N8cpdfkgA+IbC2XAs0bj OviAyjxtZF9IUMY+WztYBO6Ch5ZhPXJmS14L+xPQWTWuZezSAPj7G3BqDsX6YMs15EZ4 yLGA== 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=xsL1yyPtJH82a/B6MBZL26Q4PHqCsWQNmYIJJchipuw=; b=akPwC3/w6KakKtP0Dm782eFRv713yNV+kgsERxmPaye6bGdCn02CyuGgXDN667vKjf BEzcMVx5cVqtSimZd69Ul2BKsUG6dzndsbaUuu/MhQlmVSlZm6ecYCgiSH6PFZXgYH+2 b9LTKgGAAMCMOqPK3o9Jydt+TQ5kke5CtUMuz6mFmSB/xb0m0w4yDK6piji3liyftkwW bEbeoyhtft3xw70sLnaOiQ5AlL4Kl216YUgzeXM2bB2LFERAeQVYNbZi3i0PfsGUhkVS WUb1nMnTZumuqujCeZxcj4aCTSAaJBtjKhwQZrpJM9g5feQhYe7LI7jcAEXetPyR0bcA Q49A== X-Gm-Message-State: AOAM531H5JvU/44tnM4uqKbeke4JEGUIOoyAORMLPlZOW7nnaFL3Gv8F 8yGjda9ftkVFntifUBLa9qCFsw== X-Received: by 2002:a05:6638:22c:b0:319:f4d2:9e06 with SMTP id f12-20020a056638022c00b00319f4d29e06mr8731004jaq.223.1647280617634; Mon, 14 Mar 2022 10:56:57 -0700 (PDT) Received: from google.com (194.225.68.34.bc.googleusercontent.com. [34.68.225.194]) by smtp.gmail.com with ESMTPSA id s12-20020a92cbcc000000b002bd04428740sm9419353ilq.80.2022.03.14.10.56.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Mar 2022 10:56:57 -0700 (PDT) Date: Mon, 14 Mar 2022 17:56:53 +0000 From: Oliver Upton To: Andrew Jones Cc: Sean Christopherson , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Huth , Janosch Frank , Claudio Imbrenda , David Hildenbrand , David Matlack , Ben Gardon Subject: Re: [RFC PATCH 000/105] KVM: selftests: Overhaul APIs, purge VCPU_ID Message-ID: References: <20220311055056.57265-1-seanjc@google.com> <20220314110653.a46vy5hqegt75wpb@gator> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220314110653.a46vy5hqegt75wpb@gator> 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 Mon, Mar 14, 2022 at 12:06:53PM +0100, Andrew Jones wrote: > On Fri, Mar 11, 2022 at 05:49:11AM +0000, Sean Christopherson wrote: > > First off, hopefully I didn't just spam you with 106 emails. In theory, > > unless you're subscribed to LKML, you should see only the cover letter > > and everything else should be on lore if you want to pull down the mbox > > (instead of saying "LOL, 105 patches!?!?", or maybe after you say that). > > > > This is a (very) early RFC for overhauling KVM's selftests APIs. It's > > compile tested only (maybe), there are no changelogs, etc... > > > > My end goal with an overhaul is to get to a state where adding new > > features and writing tests is less painful/disgusting (I feel dirty every > > time I copy+paste VCPU_ID). I opted to directly send only the cover > > letter because most of the individual patches aren't all that interesting, > > there's still 46 patches even if the per-test conversions are omitted, and > > it's the final state that I really care about and want to discuss. > > > > The overarching theme of my take on where to go with selftests is to stop > > treating tests like second class citizens. Stop hiding vcpu, kvm_vm, etc... > > There's no sensitive data/constructs, and the encapsulation has led to > > really, really bad and difficult to maintain code. E.g. Want to call a > > vCPU ioctl()? Hope you have the VM... > > Ack to dropping the privateness of structs. > > > > > The other theme in the rework is to deduplicate code and try to set us > > up for success in the future. E.g. provide macros/helpers instead of > > spamming CTRL-C => CTRL-V (see the -700 LoC). > > Ack to more helper functions. I'm not sure what the best way to document > or provide examples for the API is though. Currently we mostly rely on > test writers to read other tests (I suppose the function headers help a > bit, but, IMO, not much). Maybe we need a heavily commented example.c > that can help test writers get started, along with better API function > descriptions for anything exported from the lib. > +1. Definitely guilty of copy/pasting a test then tweaking to fit the problem I'm trying to solve. A barebones example would be helpful. Haven't looked at the patches yet, but one of my whines about the selftests is that every test winds up explicitly handling exit reasons that percolate up from the libraries. Perhaps some helpers around ABORTs and the like would be useful (and maybe Sean already did this!) > > > > I was hoping to get this into a less shabby state before posting, but I'm > > I'm going to be OOO for the next few weeks and want to get the ball rolling > > instead of waiting another month or so. > > Ideas look good to me, but I'll wait for the cleaned up series posted to > the KVM ML to review it. Also, I see at least patch 1/105 is a fix. It'd > be nice to post all fixes separately so they get in sooner than later. > > Oh, some of the renaming doesn't look all that important to me, like > prefixing with kvm_ or adding _arch_, but I don't have strong preferences > on the names. Also, for the _arch_ functions it'd be nice to create > common, weak functions which the arch must override. The common function > would just assert. That should help people who want to port to other > architectures determine what they need to implement first. And, for > anything which an arch can optionally adopt a common implementation, > *not* naming the common function with _arch_, but still defining it as > weak, would make sense to me too. I think it may make more sense to only define optional functions as weak and let the compiler do the screaming for the required ones. Only discovering that functions are missing at runtime could be annoying if you're cross-compiling and running on a separate host with a different architecture. -- Oliver