lkml.org 
[lkml]   [2019]   [Oct]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] iommu/dma: Relax locking in iommu_dma_prepare_msi()
From
Date
On 17/10/2019 17:24, Christoph Hellwig wrote:
> On Wed, Oct 16, 2019 at 06:07:36PM +0100, Robin Murphy wrote:
>> @@ -1180,7 +1179,7 @@ int iommu_dma_prepare_msi(struct msi_desc *desc, phys_addr_t msi_addr)
>> struct iommu_domain *domain = iommu_get_domain_for_dev(dev);
>> struct iommu_dma_cookie *cookie;
>> struct iommu_dma_msi_page *msi_page;
>> - unsigned long flags;
>> + static DEFINE_MUTEX(msi_prepare_lock);
>
> Just a style nitpick, but I find locks declared inside functions
> really weird. In addition to that locks not embedded into a structure
> and not directly next to variables or data structures they protect
> really need a comment explaining what they are trying to serialize.

Hmm, the lock itself is merely a glorified comment, it's named for the
operation it protects, its entire existence spans 15 consecutive lines,
and 27% of those lines are dedicated to explaining that it's technically
redundant. Is there *really* anything that isn't clear from the context?

Robin.

\
 
 \ /
  Last update: 2019-10-18 15:53    [W:0.055 / U:1.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site