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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E60EC43334 for ; Thu, 23 Jun 2022 21:29:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7468D8E0193; Thu, 23 Jun 2022 17:29:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F6388E0192; Thu, 23 Jun 2022 17:29:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5BDDB8E0193; Thu, 23 Jun 2022 17:29:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 4CAD28E0192 for ; Thu, 23 Jun 2022 17:29:19 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 0EAB620C33 for ; Thu, 23 Jun 2022 21:29:19 +0000 (UTC) X-FDA: 79610791638.16.623C975 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf12.hostedemail.com (Postfix) with ESMTP id 8E2BE4000B for ; Thu, 23 Jun 2022 21:29:18 +0000 (UTC) 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-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-616-OP86Qou4PwuNPeKCzmqYZw-1; Thu, 23 Jun 2022 17:29:16 -0400 X-MC-Unique: OP86Qou4PwuNPeKCzmqYZw-1 Received: by mail-io1-f71.google.com with SMTP id t11-20020a6bdb0b000000b00674fd106c0cso196888ioc.16 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=0+JZ/jXcpBnKft8efqZS8CH0/IZny9X8SAnL39WBHZDJ8k20Naqj+FS+ljwOjXkIl8 sLV1CwFZhFyeHKce3I3qF1aRWRtfY+ttCu/iZzbh8+1XXbx9LQ8zwIX5BbJoi3vPylFa LlZgaMO/F4/VHGaC/2dgKrG8lVZd3ri4U/La/+i3Iynm5ZBGNwSY/M1WjEiqmscYjO9r vE0PcApgB04k9Z19llu3Vg4St+n2xPb/ans4J6jgInhIDZTB/NI+sqNGWQK0PbVijUpb IHnc+D6p2QNP33VklZyP/U8VGtlOJtL+3rsFbs3MC3qJ4z7Qwf+7Z9eCFLsRnAcKy6/J JtIQ== X-Gm-Message-State: AJIora+J2UgmpDyLxC7LFl7ae7XUES8yG2nQk3760Fr2LZvEOXUf8nbT YJ6ufP41v3gpGgSjEjCDzlHATSHD7HIZDgRU+MU8vWk45D3A/MBbaQgi/w0yxk0sOubVfZCbGlJ ruVuIr2T5TWo= X-Received: by 2002:a05:6602:13c3:b0:672:6e5b:f91d with SMTP id o3-20020a05660213c300b006726e5bf91dmr5280347iov.68.1656019755999; Thu, 23 Jun 2022 14:29:15 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vtJvEhlzlRfOF8b92vaohNpblje8osM0+m8TcPa0obERTPPu0deqheKeigL7E2U8Aqg0jxfg== 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 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656019758; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=6PfW9sxpQj/mvhni+b0KRiNmHNGj39/jQBs8n3G3n/E=; b=dDxMGw+Pb+NWy1CoLUenVHlxrX5KR859pWICYeukSNnRIORd1EuwFlxihIFZ278Wum5XWS knPySE/st+qMzb8XZZcofVb6aP3WZEqH//BX/SLr9iF1kkyw4Zk9W/ZOHqts4P5eAEWfiQ c4B8AxOOaddcqWjpAd0uGcn6OBcigeE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656019758; a=rsa-sha256; cv=none; b=4LWCaVAezLR6PDh9hwjWGkniWFhIH/O5Hq14nvYfTw4x+wh3FuM/6DFhPIGGU9itxX8bGg kssXX9Fv1l8UFbtqf/NdXHLQGbt0e/VMjWBhX2qiyM8w6OZtay7fp926xg9D/6aQwAuRTC 1bDJ4pvl6pfM/liApSIKA7X7Wzls9Qc= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=i2rZEXo4; spf=none (imf12.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspam-User: Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=i2rZEXo4; spf=none (imf12.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 8E2BE4000B X-Stat-Signature: 1y59he7okh6gn7toro6n911xfo9opsme X-HE-Tag: 1656019758-468807 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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