From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3084D15A87C for ; Wed, 25 Sep 2024 08:44:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727253868; cv=none; b=glLILDO1ATH5yRn/Qh/kvUyCLhBAfIDUBIlRfviIRJsHF61/FXjb54GmsFGIvikWhgFx+fgKbRN75/JiZQW9Q9T7pKxNf7hjng0KD9v+KRuOXMvXg58k5VNgCve1qAJGUZ064SZ2JO8bgPc3BW95epPdhQc4wGUaHt9S1FF9R3U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727253868; c=relaxed/simple; bh=fp5Mf7idLBODRJmfv1T3S/u+ul+mXmM0kO3BnThv8HA=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=d5+2rq6+rHJ0hYj1PCjDx1tZ4swlj0arg54GmRS06HmfiZggx+76oSppwD+mV4bGVdSxcatRNhWPx+8NiOVS1iTrGGU3cmqCDxNBEAulmnGOFtyet1HTjD/Liz1lAVOZkaeqbZRrweVdXbRQwvWwBKfSeEpdxpoEuOxv8dzdF4k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=XT2jYL/9; arc=none smtp.client-ip=209.85.208.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="XT2jYL/9" Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-5c71f2311f5so12792a12.1 for ; Wed, 25 Sep 2024 01:44:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1727253865; x=1727858665; darn=lists.linux.dev; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=fp5Mf7idLBODRJmfv1T3S/u+ul+mXmM0kO3BnThv8HA=; b=XT2jYL/9qx++aRWnh63H6jNXGrenwIVF3arAe4VKI89PXREOLkFwg/RA1XTfz70WHd BvuSL7p9aekOFY1gG4nPtHJF49muN9rbxcDbj7b5hYS9kLh0qkcaZ3UtSzkd0xSSlhY8 Zuo3eVC15T3YUPDpW7DKir7U8rV+V/Ww+uKnCOEdhHJCPkXUKY41KfpsFwIBucd34Bd8 nzweYeVEQ1FeMRiNPhntOnvn4OYOIuhF5XgROBc6R63lHK1+72UG7JjjnU9my1q7JWmt KMOkulnoWIjGZYri3BE4yTPLIrwicVmcq3CM50IVD0MVKj+fjRr8wYH5h3/40DlT07fS POVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727253865; x=1727858665; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fp5Mf7idLBODRJmfv1T3S/u+ul+mXmM0kO3BnThv8HA=; b=Q8DATy9cUJXZZdm3TGzvPMO0DLUMglPt8bDDWMrrBPy/+FicXcVos7k3PWpz6wYtc4 fGMVJjoMpNT1tligCqNSLC3mP4OFJI3Ccsyk/T/Fs0hfvwicnbeA5YgX0HFXN+swjRQX oiCCQCUAO5JL+NV92+JYAGBmphE3Th7C8hUiZwpo8Fl/toUj0xTi0/yRNWEhSfAzdb4z RB8ztT0Vz4HswhL+tct87S/DZNWIKfl3qVpBlgjsn+/63FAicaF0x6Trt8VtEB1Au3qL av6GMl6pZQyif2Xi4G1YBf2yommmnx/CyuRthA1SILhBdXw5U5eUrGtLRR/tDjTJFgTt gsfw== X-Forwarded-Encrypted: i=1; AJvYcCX+a9h9p1mdpqMuPY/UTwjhzfByr9flNd/+/LidYRh5Tfb7vh7GS8vw6zLLT6CFWcOry3CKJYetDBYw@lists.linux.dev X-Gm-Message-State: AOJu0YybPv5kCIFm9fwuaBZEtzWF0yLE0j4xjXTPIf8VWI5wGN7Lqd7P uCUWXEyAQ/bkm0j8DB5KHKBYa2tDlZ1SyRqAZPiwPI46SfjU3QxsWl5hoy/YbQrsGI6pbIc2/fI Jn17NnxKZXPfi8DjIWzmRsjroXsqaxKXv94r+ X-Google-Smtp-Source: AGHT+IHKRTDGK6cO+UR0DQQih7mccHmFaGUU/bQ5I0XVaFXESymT4q9yT3f6r4WgiGSRT/MGKTkDivZYIrZJfRkqMX4= X-Received: by 2002:a05:6402:520b:b0:5c5:b8fe:d1ec with SMTP id 4fb4d7f45d1cf-5c720fc0a58mr263957a12.3.1727253865144; Wed, 25 Sep 2024 01:44:25 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-coco@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240823132137.336874-1-aik@amd.com> <20240823132137.336874-13-aik@amd.com> <20240923160239.GD9417@nvidia.com> <20240924120735.GI9417@nvidia.com> In-Reply-To: <20240924120735.GI9417@nvidia.com> From: Vishal Annapurve Date: Wed, 25 Sep 2024 10:44:12 +0200 Message-ID: Subject: Re: [RFC PATCH 12/21] KVM: IOMMUFD: MEMFD: Map private pages To: Jason Gunthorpe Cc: "Tian, Kevin" , Alexey Kardashevskiy , "kvm@vger.kernel.org" , "iommu@lists.linux.dev" , "linux-coco@lists.linux.dev" , "linux-pci@vger.kernel.org" , Suravee Suthikulpanit , Alex Williamson , "Williams, Dan J" , "pratikrajesh.sampat@amd.com" , "michael.day@amd.com" , "david.kaplan@amd.com" , "dhaval.giani@amd.com" , Santosh Shukla , Tom Lendacky , Michael Roth , Alexander Graf , Nikunj A Dadhania , Vasant Hegde , Lukas Wunner Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Sep 24, 2024 at 2:07=E2=80=AFPM Jason Gunthorpe wr= ote: > > On Mon, Sep 23, 2024 at 11:52:19PM +0000, Tian, Kevin wrote: > > > IMHO we should try to do as best we can here, and the ideal interface > > > would be a notifier to switch the shared/private pages in some portio= n > > > of the guestmemfd. With the idea that iommufd could perhaps do it > > > atomically. > > > > yes atomic replacement is necessary here, as there might be in-fly > > DMAs to pages adjacent to the one being converted in the same > > 1G hunk. Unmap/remap could potentially break it. > > Yeah.. This integration is going to be much more complicated than I > originally thought about. It will need the generic pt stuff as the > hitless page table manipulations we are contemplating here are pretty > complex. > > Jason To ensure that I understand your concern properly, the complexity of handling hitless page manipulations is because guests can convert memory at smaller granularity than the physical page size used by the host software. Complexity remains the same irrespective of whether kvm/guest_memfd is notifying iommu driver to unmap converted ranges or if its userspace notifying iommu driver.