From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) (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 687AF1E9B17 for ; Wed, 19 Mar 2025 17:41:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742406062; cv=none; b=YucmUj/ICjHxGynTDAH1Kg3OMi4y2RZkJR8CN29p1GFOflMFDocSSNLxl/dTJ5rGIeCL7/gR1AEZYCbVStCbdtmN+fUKqouehuy7tOZC0ZEZ99kkSxpmhpju7UQCS1MniKN+KjCc24lJ1BCp6sML2ndrxuh5xcgvzfYcaTPMvs4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742406062; c=relaxed/simple; bh=Uup4ij0e3QxR7P+2AXE6ojI6gZ035al5TOyCCZJD8FY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=QYbyoeCmcFgrcqmNVGS10k7LMYVWz3pJNfbN1QNoXgoyh7uHPGoXf0aRFdSBpb5MJhFnLaYIgWrqcxFHPL7uzqJ0Nrv/gKPOsyxo5sanPdKp1ep5nEe/ehryfQYnX/Vc1vH1RQf9tvuXLM6UQ9ZC5j1UVyfKVkgrzYi2bJvCQ+I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b=nV/VpToK; arc=none smtp.client-ip=209.85.222.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="nV/VpToK" Received: by mail-qk1-f173.google.com with SMTP id af79cd13be357-7c542ffec37so705335385a.2 for ; Wed, 19 Mar 2025 10:41:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1742406059; x=1743010859; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=leCUW9KEkZQcVeVok9ACFyeDj4RZoftXqhcJPMWCJYU=; b=nV/VpToKK1Aoc35hYasv8EBUTMZK3YWljurPD2RE8K95jFcoCmONYbBpbib1QPyFbd zSv/Fnk+PNhWJ/yPZHfQrWxfNZCut2KGrxd3hZas9X5TZ7EXb7a/dokHKpxOytAT4pQ9 gfeyNgK4YiJtjD06hxgzxo38t1AVC0Vdkwe+i1EL1u+f4qzlchDtmyVqmWb5xb9CtAnf CMt/PYJWppWD+Yuqh6qT9h2143TT+qM7QypYtCpfyJf8bTECAWu3m0vRYjgL+whCaBCP +g+MkRpdKaz0uAvhepSHNFG2+jIm5/kc50U3IlZji0KHpX/QBJGLS8rOlfY0KbgUMJAR wnZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742406059; x=1743010859; 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=leCUW9KEkZQcVeVok9ACFyeDj4RZoftXqhcJPMWCJYU=; b=nxrG47pN8gSPhjsr3DU31PNTMbmasvvdprNMGfi9f2u32/LoCViEz8W+8OomYOG2+b +ppY60KCiGX3KHg9Z0Kx3YrJQmrT4QGHiVvrLBl7mnU3fq8ZWlpciZQYtCCKa6QAFHML 6keZKXaYqXW6JY95QbkfvFTTkRkRS8tEJVlmDSLdr9EoCe1ru5wtRTpOw2MLUCXQNVKr F6g5P8EM97XKlWfT/JhRMhFR1mMm2uha7g0w555jQwvZv4SVbSB1yNUJ6CvdBWwAf6+G LvSEv5ruhBLminahWrfw9e4rKJFCg9TLVcPD+OPVWSVmhIyXyMZiSTvvn6tHl3qxls1w DlzQ== X-Forwarded-Encrypted: i=1; AJvYcCWmNBChpNro9JA1v4wRwsapC225UHKX9TMwMr/NgaUrkUCY1qbSad77fbPXrIfrAyyeVAw=@vger.kernel.org X-Gm-Message-State: AOJu0YzSwvcFwifD5WLAkn6+iWkcmgVopMDK3lZQt18eeBU64ipH26WX hGQEG2FlULD7EFTSmVwk3uHk0smbXn4TvDl/wch6GJXOJP6B/sY7/7/gbUu8aEY= X-Gm-Gg: ASbGncvuOTyFvSwJa62K9uO5DS7ZUFvVXw5YcWrBYh966vzT+FV1r5yi6emM+Fefs3K xjZeKDvj1yBUrBOP1sJ5TGmxLGroM59GW33uqx12vTp6MT+32FwsLlqp1rjsP+o6Nf2hEfHLMNJ EDeNqfLLF4G1pxHNO36VdA+GUqc0Kl7TjAd/tvDBxHrh3LeATQ56XD95jtvJySwh1gSyGE7F1SB MSb0c70re5qYE/VXHqz6lcTRY1gk/JeKvukcj0L7M0QJ6Q2R0+fgAD2Ed46F6zHKib1AQ6JW9GG zx/BNv/lC2MyL1twWqz87M0Vyt+d+ownd+iNkcbsep0rB08I7IurSXoEUta8sprpesXcAmIMa+N ezYUQEsBTOLBs1YN4o0dTuv6s5RKr X-Google-Smtp-Source: AGHT+IFoJAQ9bGba/Z0yZg+D8yG6xp2ytZSUuDU+bbhNp9w3ofz/kSX0XQcOY4VVJjVXQ+26hrcvHQ== X-Received: by 2002:a05:620a:57b:b0:7c5:6ba5:dd65 with SMTP id af79cd13be357-7c5a84a3654mr479964285a.55.1742406059344; Wed, 19 Mar 2025 10:40:59 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-68-128-5.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.128.5]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7c573c4dd2bsm884915085a.14.2025.03.19.10.40.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Mar 2025 10:40:58 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1tuxPW-00000000WcK-0irF; Wed, 19 Mar 2025 14:40:58 -0300 Date: Wed, 19 Mar 2025 14:40:58 -0300 From: Jason Gunthorpe To: Alexey Kardashevskiy Cc: Michael Roth , x86@kernel.org, kvm@vger.kernel.org, linux-crypto@vger.kernel.org, linux-pci@vger.kernel.org, linux-arch@vger.kernel.org, Sean Christopherson , Paolo Bonzini , Tom Lendacky , Ashish Kalra , Joerg Roedel , Suravee Suthikulpanit , Robin Murphy , Kevin Tian , Bjorn Helgaas , Dan Williams , Christoph Hellwig , Nikunj A Dadhania , Vasant Hegde , Joao Martins , Nicolin Chen , Lu Baolu , Steve Sistare , Lukas Wunner , Jonathan Cameron , Suzuki K Poulose , Dionna Glaze , Yi Liu , iommu@lists.linux.dev, linux-coco@lists.linux.dev, Zhi Wang , AXu Yilun , "Aneesh Kumar K . V" Subject: Re: [RFC PATCH v2 12/22] iommufd: Allow mapping from guest_memfd Message-ID: <20250319174058.GF10600@ziepe.ca> References: <20250218111017.491719-1-aik@amd.com> <20250218111017.491719-13-aik@amd.com> <20250218141634.GI3696814@ziepe.ca> <340d8dba-1b09-4875-8604-cd9f66ca1407@amd.com> <20250218235105.GK3696814@ziepe.ca> <06b850ab-5321-4134-9b24-a83aaab704bf@amd.com> <20250219133516.GL3696814@ziepe.ca> <20250219202324.uq2kq27kmpmptbwx@amd.com> <20250219203708.GO3696814@ziepe.ca> <604c0d0e-048f-402a-893a-62e1ce8d24ba@amd.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <604c0d0e-048f-402a-893a-62e1ce8d24ba@amd.com> On Thu, Mar 13, 2025 at 03:51:13PM +1100, Alexey Kardashevskiy wrote: > About this atomical restructure - I looked at yours iommu-pt branch on > github but __cut_mapping()->pt_table_install64() only atomically swaps the > PDE but it does not do IOMMU TLB invalidate, have I missed it? That branch doesn't have the invalidation wired in, there is another branch that has invalidation but not cut yet.. It is a journey > And if it did so, that would not be atomic but it won't matter as > long as we do not destroy the old PDE before invalidating IOMMU TLB, > is this the idea? Thanks, When splitting the change in the PDE->PTE doesn't change the translation in effect. So if the IOTLB has cached the PDE, the SW will update it to an array of PTEs of same address, any concurrent DMA will continue to hit the same address, then when we invalidate the IOTLB the PDE will get dropped from cache and the next DMA will load PTEs. When I say atomic I mean from the perspective of the DMA initator there is no visible alteration. Perhaps I should say hitless. Jason