lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2xm4hj576fbs3ydwxcjs732ddax6zze2mmbka3ocdmddsczqtx@ghc7uxquidrn>
Date: Wed, 21 Jan 2026 06:49:28 +0000
From: Ankit Soni <Ankit.Soni@....com>
To: Jacob Pan <jacob.pan@...ux.microsoft.com>
CC: <iommu@...ts.linux.dev>, <vasant.hegde@....com>,
	<suravee.suthikulpanit@....com>, <joro@...tes.org>, <will@...nel.org>,
	<robin.murphy@....com>, <linux-kernel@...r.kernel.org>,
	<Srikanth.Aithal@....com>
Subject: Re: [PATCH] iommu/amd: serialize sequence allocation under
 concurrent TLB invalidations

On Tue, Jan 20, 2026 at 09:24:27AM -0800, Jacob Pan wrote:
> Hi Ankit,
> 
> On Tue, 20 Jan 2026 09:05:07 +0000
> Ankit Soni <Ankit.Soni@....com> wrote:
> 
> > With concurrent TLB invalidations, completion wait randomly gets
> > timed out because cmd_sem_val was incremented outside the IOMMU
> > spinlock, allowing CMD_COMPL_WAIT commands to be queued out of
> > sequence and breaking the ordering assumption in wait_on_sem().
> > Move the cmd_sem_val increment under iommu->lock so completion
> > sequence allocation is serialized with command queuing.
> > And remove the unnecessary return.
> > 
> > Fixes: d2a0cac10597 ("iommu/amd: move wait_on_sem() out of spinlock")
> > 
> > Tested-by: Srikanth Aithal <sraithal@....com>
> > Reported-by: Srikanth Aithal <sraithal@....com>
> > Signed-off-by: Ankit Soni <Ankit.Soni@....com>
> > ---
> >  drivers/iommu/amd/iommu.c | 18 ++++++++++++------
> >  1 file changed, 12 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
> > index d7f457338de7..593fb879b7b0 100644
> > --- a/drivers/iommu/amd/iommu.c
> > +++ b/drivers/iommu/amd/iommu.c
> > @@ -1422,6 +1422,12 @@ static int iommu_queue_command(struct
> > amd_iommu *iommu, struct iommu_cmd *cmd) return
> > iommu_queue_command_sync(iommu, cmd, true); }
> >  
> > +static u64 get_cmdsem_val(struct amd_iommu *iommu)
> > +{
> > +	lockdep_assert_held(&iommu->lock);
> > +	return atomic64_inc_return(&iommu->cmd_sem_val);
> Do we still need this to be atomic now that it’s protected by a
> spinlock?
> 

Hi Jacob,
Thanks for pointing this out, we can remove atomic operation here.
I will change and post v2.

-Ankit


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ