Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6244045iog; Thu, 23 Jun 2022 14:40:20 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uRDjLiZGOhSZEvuc2AxZfehGzi0TE3TxDDUwqOIPxik6n4zaxIy72oHW02ELhzAYGueIG1 X-Received: by 2002:aa7:c801:0:b0:435:5a08:f54c with SMTP id a1-20020aa7c801000000b004355a08f54cmr13628936edt.254.1656020419835; Thu, 23 Jun 2022 14:40:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656020419; cv=none; d=google.com; s=arc-20160816; b=qGx+rJS2/RQlrgAkLNcUleCnQgjpBvZBxygsdWHvi6WFW2wV7TDWdD36gQHsq64p2U KtwN1rsdNXcAm0ZXhyE8UAWOA2T3ccEd2kpCATA0V/HwPM/jBPeqUQcS4+VNop3gkvVQ hnahPKlwJjxMS4tYcOERjeZ3/pO3ameG4ZRXgvg5VvPlXfEacGpKev32mdOF1rGTA5Ik 8FWii3ao2GEKH/v+QDb7lqTORYCBGRWdxTDoAyrRPjiX7aFBDFerYuTi4iNQrv+uevo0 roEyfdtGKGdvsKVAP9ez9Wu4tTzJZBkjv8yYHR858cIugkMUd/MkkiQG8UaNcDuZ9uBc SSOQ== 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=6PfW9sxpQj/mvhni+b0KRiNmHNGj39/jQBs8n3G3n/E=; b=nMVIZhgBdhpk8TCIuLoK9PuR6wSX4h+kaw7gSL/Bt59ZWhEbg7jO4d/IEN1SMeGqcR LRgW0NjNc8mTmKIcryiPwZxhGo6HanMI4L42PwGdPlTb1jD9pzPis3l2aBJQ9Xr4fYKi QIRclq3qAyk48xfofJDYEPyuBlKprKxgSLoJy/BCEx20/2jWex9chgNG3pBR1e3cQA+A 539Y6t/j3YSYfAFUsokjLTTlkNgTX/sxV8sUJzBiUvvalcb23HDmX5Q/R4rJSDEI4pym 8XO/NzUGnJla8BCaZrsJnrqO/ot+neUfUfJ12dlb9HpZfV3V780nks5Sp6CmC7vJ0qDy YCSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=i2rZEXo4; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v28-20020a50955c000000b004357fc99bcesi797597eda.196.2022.06.23.14.39.54; Thu, 23 Jun 2022 14:40:19 -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=@redhat.com header.s=mimecast20190719 header.b=i2rZEXo4; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229806AbiFWV3V (ORCPT + 99 others); Thu, 23 Jun 2022 17:29:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229464AbiFWV3U (ORCPT ); Thu, 23 Jun 2022 17:29:20 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2A4775251F for ; Thu, 23 Jun 2022 14:29:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656019758; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=6PfW9sxpQj/mvhni+b0KRiNmHNGj39/jQBs8n3G3n/E=; b=i2rZEXo49QwUmz7rTW1PNtwpd4ROnXA+jCSsz1p39sdzBjX/XxsNkdCcXUy0Y/FX65Qssh gAcDQMllb+ZUoZ+lc83TeQfuMn5G2+KZPvVbfOOHSuV9QRvM53VJk00Uk6XtNebUvj4exW YVuLVuY2r/rbvJOLeDK8qr+Tlf8+vS4= Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-578-vc2GWJ_YOGWIurpiz4FtMw-1; Thu, 23 Jun 2022 17:29:17 -0400 X-MC-Unique: vc2GWJ_YOGWIurpiz4FtMw-1 Received: by mail-il1-f198.google.com with SMTP id x5-20020a923005000000b002d1a91c4d13so185803ile.4 for ; Thu, 23 Jun 2022 14:29:16 -0700 (PDT) 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=6PfW9sxpQj/mvhni+b0KRiNmHNGj39/jQBs8n3G3n/E=; b=YHhMAQehGlX6EiX6BtZ0nRr95lmFAhGQozdm/kBrhy06yZyITcmvpoB4aL88Tjw/wN Y9O3vc1Wxo16tLCUC7W0qohn95FkAGEAcxStK65zrtVaL1E2DxzyHNyqamPBU3v4tSzA 9yDuJ7MlCHe/WNAh15CU37zoK3QCV/kc4IWOgF1KU2mL5ap0yxe+0K7fUmM8PCnnKAhW Q4TokkKZEezUcDR94fchhYGbxzZ2RcSyHrPRJi8DtOxCfnwqD5XgEoZrRS1R06jY7E91 JHBaUvEMlp3Uw7db44RKZ9u3w8VWdQRaYOjeh8plKkodWTALNJiAhEJssLMflhii8g3D e6rA== X-Gm-Message-State: AJIora/jqnWrUUXnpdWB+f+HwAXsaZVbFrKPJXOmL73Vf07dLcfhOa5E aWe5xZXIOpeDndi0tMBhn0svanf2teJ7Bh7Yx1taA5y3p5wPH+Yba2hqNGVNeKtl+bGKTYup4qL DZxhdqNKbju48xqj8TqcTLl5W X-Received: by 2002:a05:6602:13c3:b0:672:6e5b:f91d with SMTP id o3-20020a05660213c300b006726e5bf91dmr5280345iov.68.1656019755998; Thu, 23 Jun 2022 14:29:15 -0700 (PDT) X-Received: by 2002:a05:6602:13c3:b0:672:6e5b:f91d with SMTP id o3-20020a05660213c300b006726e5bf91dmr5280339iov.68.1656019755753; Thu, 23 Jun 2022 14:29:15 -0700 (PDT) Received: from xz-m1.local (cpec09435e3e0ee-cmc09435e3e0ec.cpe.net.cable.rogers.com. [99.241.198.116]) by smtp.gmail.com with ESMTPSA id h7-20020a0566380f0700b00339cfcf4a49sm202645jas.141.2022.06.23.14.29.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 14:29:15 -0700 (PDT) Date: Thu, 23 Jun 2022 17:29:13 -0400 From: Peter Xu To: Sean Christopherson Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Paolo Bonzini , Andrew Morton , David Hildenbrand , "Dr . David Alan Gilbert" , Andrea Arcangeli , Linux MM Mailing List Subject: Re: [PATCH 2/4] kvm: Merge "atomic" and "write" in __gfn_to_pfn_memslot() Message-ID: References: <20220622213656.81546-1-peterx@redhat.com> <20220622213656.81546-3-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 23, 2022 at 08:29:13PM +0000, Sean Christopherson wrote: > This is what I came up with for splitting @async into a pure input (no_wait) and > a return value (KVM_PFN_ERR_NEEDS_IO). The attached patch looks good to me. It's just that.. [...] > kvm_pfn_t __gfn_to_pfn_memslot(const struct kvm_memory_slot *slot, gfn_t gfn, > - bool atomic, bool *async, bool write_fault, > + bool atomic, bool no_wait, bool write_fault, > bool *writable, hva_t *hva) .. with this patch on top we'll have 3 booleans already. With the new one to add separated as suggested then it'll hit 4. Let's say one day we'll have that struct, but.. are you sure you think keeping four booleans around is nicer than having a flag, no matter whether we'd like to have a struct or not? kvm_pfn_t __gfn_to_pfn_memslot(const struct kvm_memory_slot *slot, gfn_t gfn, bool atomic, bool no_wait, bool write_fault, bool interruptible, bool *writable, hva_t *hva); What if the booleans goes to 5, 6, or more? /me starts to wonder what'll be the magic number that we'll start to think a bitmask flag will be more lovely here. :) -- Peter Xu