On 9/17/19 1:23 PM, David Rientjes wrote:
> On Mon, 16 Sep 2019, David Rientjes wrote:
> 
>> Brijesh and Tom, we currently hit this any time we boot an SEV enabled 
>> Ubuntu 18.04 guest; I assume that guest kernels, especially those of such 
>> major distributions, are expected to work with warnings and BUGs when 
>> certain drivers are enabled.
>>
>> If the vmap purge lock is to remain a mutex (any other reason that 
>> unmapping aliases can block?) then it appears that allocating a dmapool 
>> is the only alternative.  Is this something that you'll be addressing 
>> generically or do we need to get buy-in from the maintainers of this 
>> specific driver?
>>
> 
> We've found that the following applied on top of 5.2.14 suppresses the 
> warnings.
> 
> Christoph, Keith, Jens, is this something that we could do for the nvme 
> driver?  I'll happily propose it formally if it would be acceptable.
> 
> Thanks!
> 
> 
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -1613,7 +1613,8 @@ static int nvme_alloc_admin_tags(struct nvme_dev *dev)
>               dev->admin_tagset.timeout = ADMIN_TIMEOUT;
>               dev->admin_tagset.numa_node = dev_to_node(dev->dev);
>               dev->admin_tagset.cmd_size = sizeof(struct nvme_iod);
> -             dev->admin_tagset.flags = BLK_MQ_F_NO_SCHED;
> +             dev->admin_tagset.flags = BLK_MQ_F_NO_SCHED |
> +                                       BLK_MQ_F_BLOCKING;

I think you want to only set the BLK_MQ_F_BLOCKING if the DMA is required
to be unencrypted. Unfortunately, force_dma_unencrypted() can't be called
from a module. Is there a DMA API that could be called to get that info?

Thanks,
Tom

>               dev->admin_tagset.driver_data = dev;
>  
>               if (blk_mq_alloc_tag_set(&dev->admin_tagset))
> @@ -2262,7 +2263,8 @@ static int nvme_dev_add(struct nvme_dev *dev)
>               dev->tagset.queue_depth =
>                               min_t(int, dev->q_depth, BLK_MQ_MAX_DEPTH) - 1;
>               dev->tagset.cmd_size = sizeof(struct nvme_iod);
> -             dev->tagset.flags = BLK_MQ_F_SHOULD_MERGE;
> +             dev->tagset.flags = BLK_MQ_F_SHOULD_MERGE |
> +                                 BLK_MQ_F_BLOCKING;
>               dev->tagset.driver_data = dev;
>  
>               ret = blk_mq_alloc_tag_set(&dev->tagset);
> 
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to