Christoph,

On 2019/06/26 15:10, Christoph Hellwig wrote:
> On Wed, Jun 26, 2019 at 10:47:57AM +0900, Damien Le Moal wrote:
>> @@ -1501,9 +1502,14 @@ struct bio *bio_map_kern(struct request_queue *q, 
>> void *data, unsigned int len,
>>      unsigned long end = (kaddr + len + PAGE_SIZE - 1) >> PAGE_SHIFT;
>>      unsigned long start = kaddr >> PAGE_SHIFT;
>>      const int nr_pages = end - start;
>> +    bool is_vmalloc = is_vmalloc_addr(data);
>> +    struct page *page;
>>      int offset, i;
>>      struct bio *bio;
>>  
>> +    if (is_vmalloc)
>> +            invalidate_kernel_vmap_range(data, len);
> 
> That is not correct.
> 
> The submission path needs an unconditional flush_kernel_vmap_range call,
> and the read completion path will additionally need the
> invalidate_kernel_vmap_range call.
> 

I mimicked what XFS and DM do with vmalloc-ed buffers. I guess I missed 
something.

So in this case, the allocation is in sd_zbc.c, where the completion is too. So
I think it may be better to have flush_kernel_vmap_range() right after the
allocation before scsi_execute_req() is called and do the
invalidate_kernel_vmap_range() before scanning the report zones output for
transformation into struct blk_zone ? And do not do anything in bio_map_kern
beside the change from virt_to_page() to vmalloc_to_page() ?

-- 
Damien Le Moal
Western Digital Research

Reply via email to