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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA252C433F5 for ; Tue, 4 Jan 2022 17:34:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235753AbiADRe5 (ORCPT ); Tue, 4 Jan 2022 12:34:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235660AbiADRe4 (ORCPT ); Tue, 4 Jan 2022 12:34:56 -0500 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 104B2C061784 for ; Tue, 4 Jan 2022 09:34:56 -0800 (PST) Received: by mail-pf1-x42a.google.com with SMTP id v11so32836921pfu.2 for ; Tue, 04 Jan 2022 09:34:56 -0800 (PST) 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=whSHyDkf0XZc1mjjjqOGE1/cp29qdWazioE+cyFAqO0=; b=AKGtA6ul6yuij5z+AvEU6YGN7uC/zmR1Z3AA2eavQwv49exOo937KC2cThIO1M5x5R ld8sDO2VSHM/RDAO9u2p+XO+70K8kcxVOrir1Y0yigapUXNM0Ylp9TZuzLp8opNiwQ7F AnKU33bHmO0NaKXzOI53pZm3IA1/NzLaG7sHnIF4oNjbhA1aPFUnql4JxyGrCHn6JbAR SUbiQLLvznmxlgAa1lOw1puG4OnmRONMmAC/E92187ZUZ0u1IfwKfyQOhRxiduWbOsmw QfJOYMgQVQMBG6eYUimmH+OiBuy14zVxqAM71F46TwcrfoWBadi7V6J39TzjtU+srhbw QcaQ== 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=whSHyDkf0XZc1mjjjqOGE1/cp29qdWazioE+cyFAqO0=; b=k6lJ0JLXZ5dYBbWZYSgRJSund0gOXMrnJ0nWddzYXWnbBxhHSxLIlp0LcrlQPway0I yGSu0EjB3h5yTMcrYDSPncy1hMDaD1D8ssq0qvok7QwoqhG8hGT0HLJDFa7FqZTYGtkX J0+vWN/s/x11F/VrJv7h7x0c5czgg/aPQzr4AauUGC/M7TTXvwVSd63vlOmRn7RFxBBN 8nEIIn3TTIUzf2xtfHQKURhcIPGWhc6nvCUgUHQsJ9oMveVZPCDD3F9NZuBCS/OC1RvB d9xoB8MDQpOZwT5JvelPyDPPI5NVB9oxoIaedLnV2CtbW5JrEkHxxHBUEodZ0aDAX9dG h/Ug== X-Gm-Message-State: AOAM531sA7k5RVoFniIQIhvw6MhBcrMLNMieceiT2VozdPYUMV1nKVcN us1IhHGaxsF7/HL9TANVRXPU7Q== X-Google-Smtp-Source: ABdhPJzZB3uUldS3H3PomxXInau17VQRCQJ4/BUX9qRXpwldcK2cYuphdyVvLg2cunzd1cVS/euxnw== X-Received: by 2002:a63:87c3:: with SMTP id i186mr45003143pge.507.1641317695407; Tue, 04 Jan 2022 09:34:55 -0800 (PST) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id k23sm401859pji.3.2022.01.04.09.34.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jan 2022 09:34:54 -0800 (PST) Date: Tue, 4 Jan 2022 17:34:51 +0000 From: Sean Christopherson To: Chao Peng Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, qemu-devel@nongnu.org, Paolo Bonzini , Jonathan Corbet , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H . Peter Anvin" , Hugh Dickins , Jeff Layton , "J . Bruce Fields" , Andrew Morton , Yu Zhang , "Kirill A . Shutemov" , luto@kernel.org, john.ji@intel.com, susie.li@intel.com, jun.nakajima@intel.com, dave.hansen@intel.com, ak@linux.intel.com, david@redhat.com Subject: Re: [PATCH v3 kvm/queue 04/16] KVM: Extend the memslot to support fd-based private memory Message-ID: References: <20211223123011.41044-1-chao.p.peng@linux.intel.com> <20211223123011.41044-5-chao.p.peng@linux.intel.com> <20211231025344.GC7255@chaop.bj.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211231025344.GC7255@chaop.bj.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 31, 2021, Chao Peng wrote: > On Thu, Dec 23, 2021 at 05:35:37PM +0000, Sean Christopherson wrote: > > On Thu, Dec 23, 2021, Chao Peng wrote: > > > diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h > > > index 1daa45268de2..41434322fa23 100644 > > > --- a/include/uapi/linux/kvm.h > > > +++ b/include/uapi/linux/kvm.h > > > @@ -103,6 +103,17 @@ struct kvm_userspace_memory_region { > > > __u64 userspace_addr; /* start of the userspace allocated memory */ > > > }; > > > > > > +struct kvm_userspace_memory_region_ext { > > > + __u32 slot; > > > + __u32 flags; > > > + __u64 guest_phys_addr; > > > + __u64 memory_size; /* bytes */ > > > + __u64 userspace_addr; /* hva */ > > > > Would it make sense to embed "struct kvm_userspace_memory_region"? > > > > > + __u64 ofs; /* offset into fd */ > > > + __u32 fd; > > > > Again, use descriptive names, then comments like "offset into fd" are unnecessary. > > > > __u64 private_offset; > > __u32 private_fd; > > My original thought is the same fields might be used for shared memslot > as well in future (e.g. there may be another KVM_MEM_* bit can reuse the > same fields for shared slot) so non private-specific name may sound > better. But definitely I have no objection and can use private_* names > for next version unless there is other objection. If that does happen, it's easy enough to wrap them in a union.