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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D366BC001DF for ; Tue, 1 Aug 2023 00:23:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229590AbjHAAXK (ORCPT ); Mon, 31 Jul 2023 20:23:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229486AbjHAAXJ (ORCPT ); Mon, 31 Jul 2023 20:23:09 -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 ESMTPS id E710B1BEC for ; Mon, 31 Jul 2023 17:22:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690849312; 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=1JqVW3nKS6ih7lr1bT/HdEeWmAfLdL43H1rrm50D/ao=; b=AeAW4m9tHosIISHXrBGK2SCT8g+AgQBijP31nAhazAUV5K2NLCGu/nehszJWc/SoQpGmhT qNeFEbEUDpg67aiMCYxbHAnKE00ZU4gf3zm4lt+UOE2MgfzQdE8msHjMIMV3yGLKtq8eBc U2VXBnM71CJOfwRz3kfs8iwMoRoG9WY= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-308-V1bk4oSvNp-9AJ19a2t3yQ-1; Mon, 31 Jul 2023 20:21:50 -0400 X-MC-Unique: V1bk4oSvNp-9AJ19a2t3yQ-1 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-76ca3baaec8so44142085a.1 for ; Mon, 31 Jul 2023 17:21:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690849310; x=1691454110; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=1JqVW3nKS6ih7lr1bT/HdEeWmAfLdL43H1rrm50D/ao=; b=EZEA5qkivW9pnoOji1HzNpvdUK40XtpbU9gH4Ou+WV8icY1H3NVanWnSgY2cCOFAZ9 kReKRtQYctzn2j9Xs0DRDQxdTS4XfXBEhLrDdWH79b2alFROs9b6RyOBtP7E/8LnYBET NnO/fhSRsWabJut+px8RG8Ddq062kkrtEiymrl9TL7x+sq89WaUfpVRmjzbeo8Fow3Eb FIOaJ1ZmOKcAR3QDJnRUnfwfSxuZNzvgK/I2Q5xeXG0wTIPtKc2lZ2lUKdqgrybZM7ot +nyPHydMm88wVRuDJa4ovypPzsWdykIW0y+sIopZRxRHzyi1LKFnrUgZnhKCnAHJTwze Re/Q== X-Gm-Message-State: ABy/qLZtWXFeBYAXlxzbQTvkAV2p8lj+nsdG1kKCp+TOloAYki/qrDvX XB8xs0Eiz2290m4RYhqFsslZY9Hke8CzLo6f/X5a0dY6HOfKBqwFTbXllxHMnRcFVGMS/LQwLXs KI7cb4AxXRcjY X-Received: by 2002:a05:620a:24d0:b0:767:f2e7:47c0 with SMTP id m16-20020a05620a24d000b00767f2e747c0mr11472998qkn.1.1690849309944; Mon, 31 Jul 2023 17:21:49 -0700 (PDT) X-Google-Smtp-Source: APBJJlFkB2xrFKwX29nFK0UU7HJMjyCVFqFuyruoxfJ4KYdJp/fi0G+JCL4IHqQH3QsZS+VEOSY1iQ== X-Received: by 2002:a05:620a:24d0:b0:767:f2e7:47c0 with SMTP id m16-20020a05620a24d000b00767f2e747c0mr11472985qkn.1.1690849309634; Mon, 31 Jul 2023 17:21:49 -0700 (PDT) Received: from x1n (cpe5c7695f3aee0-cm5c7695f3aede.cpe.net.cable.rogers.com. [99.254.144.39]) by smtp.gmail.com with ESMTPSA id h26-20020a05620a10ba00b00767ba88f0c9sm3725129qkk.7.2023.07.31.17.21.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 17:21:49 -0700 (PDT) Date: Mon, 31 Jul 2023 20:21:46 -0400 From: Peter Xu To: "Michael S. Tsirkin" Cc: Sean Christopherson , Xiaoyao Li , Paolo Bonzini , David Hildenbrand , Igor Mammedov , Marcel Apfelbaum , Richard Henderson , Marcelo Tosatti , Markus Armbruster , Eric Blake , Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?= , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Chao Peng , Michael Roth , isaku.yamahata@gmail.com, qemu-devel@nongnu.org, kvm@vger.kernel.org Subject: Re: [RFC PATCH 04/19] memory: Introduce memory_region_can_be_private() Message-ID: References: <20230731162201.271114-1-xiaoyao.li@intel.com> <20230731162201.271114-5-xiaoyao.li@intel.com> <20230731173607-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230731173607-mutt-send-email-mst@kernel.org> Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Mon, Jul 31, 2023 at 05:36:37PM -0400, Michael S. Tsirkin wrote: > On Mon, Jul 31, 2023 at 02:34:22PM -0700, Sean Christopherson wrote: > > On Mon, Jul 31, 2023, Peter Xu wrote: > > > On Mon, Jul 31, 2023 at 12:21:46PM -0400, Xiaoyao Li wrote: > > > > +bool memory_region_can_be_private(MemoryRegion *mr) > > > > +{ > > > > + return mr->ram_block && mr->ram_block->gmem_fd >= 0; > > > > +} > > > > > > This is not really MAP_PRIVATE, am I right? If so, is there still chance > > > we rename it (it seems to be also in the kernel proposal all across..)? > > > > Yes and yes. > > > > > I worry it can be very confusing in the future against MAP_PRIVATE / > > > MAP_SHARED otherwise. > > > > Heh, it's already quite confusing at times. I'm definitely open to naming that > > doesn't collide with MAP_{PRIVATE,SHARED}, especially if someone can come with a > > naming scheme that includes a succinct way to describe memory that is shared > > between two or more VMs, but is accessible to _only_ those VMs. > > Standard solution is a technology specific prefix. > protect_shared, encrypt_shared etc. Agreed, a prefix could definitely help (if nothing better comes at last..). If e.g. "encrypted" too long to be applied everywhere in var names and functions, maybe it can also be "enc_{private|shared}". Thanks, -- Peter Xu