lkml.org 
[lkml]   [2023]   [Aug]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v7 1/1] vfio/nvgpu: Add vfio pci variant module for grace hopper
On Wed, 23 Aug 2023 14:50:31 +0000
Ankit Agrawal <ankita@nvidia.com> wrote:

> >> + if (index == VFIO_PCI_BAR2_REGION_INDEX) {
> >> + if (!nvdev->opregion) {
> >> + nvdev->opregion = memremap(nvdev->hpa, nvdev->mem_length, MEMREMAP_WB);
> >> + if (!nvdev->opregion)
> >> + return -ENOMEM;
> >> + }
> >
> > [AW] Seems like this would be susceptible to concurrent accesses causing
> > duplicate mappings.
> >
> > [JG] Needs some kind of locking on opregion
>
> Right, will add a new lock item in nvdev to control the access to opregion/memmap.
> Please let me know if it is preferable to do memremap in open_device instead of
> read/write.

That's a valid option also, certainly avoids the locking and
serialization per access. Thanks,

Alex

\
 
 \ /
  Last update: 2023-08-23 17:15    [W:0.076 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site