linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
To: Ming Lei <tom.leiming@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block <linux-block@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Artemi Ivanov <artemi.ivanov@cogentembedded.com>
Subject: Re: blk_queue_bounce_limit() broken for mask=0xffffffff on 64bit archs
Date: Fri, 13 Jan 2017 09:10:37 +0300	[thread overview]
Message-ID: <303d9c92-d38e-7456-abeb-e1e5af9a3200@cogentembedded.com> (raw)
In-Reply-To: <CACVXFVPgmaBh5OqjfTfqdQ9k78PWsmozuRZpSG5gMg84m4sDwQ@mail.gmail.com>


>> There is a use cases when architecture is 64-bit but hardware supports
>> only DMA to lower 4G of address space. E.g. NVMe device on RCar PCIe host.
>>
>> For such cases, it looks proper to call blk_queue_bounce_limit() with
>> mask set to 0xffffffff - thus making block layer to use bounce buffers
>> for any addresses beyond 4G.  To support that, architecture provides
>> GFP_DMA zone that covers exactly low 4G on arm64.
>>
>> However setting this limit does not work:
>>
>>   if (b_pfn < (min_t(u64, 0xffffffffUL, BLK_BOUNCE_HIGH) >> PAGE_SHIFT))
>>       dma = 1;
>>
>> When mask is 0xffffffff that condition is false
> 
> That should have been true in your case, since the b_pfn is smaller than
> 0xffffffff.

b_pfn is exactly 0xffffffffUL >> SHIFT, thus contition is false

>>   q->limits.bounce_pfn = max(max_low_pfn, b_pfn);
>>
>> this line is executed and replaces any limit with end of memory (on
>> 64bit arch all memory is low).
> 
> I don't understand why max() is used? And why not min()?
> 
> Looks the above line just disables bounce for 64bit arch, doesn't it?

Effectively yes. And I don't understand logic behind this code.

Nikita

      reply	other threads:[~2017-01-13  6:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-09 20:48 blk_queue_bounce_limit() broken for mask=0xffffffff on 64bit archs Nikita Yushchenko
2017-01-09 20:59 ` Christoph Hellwig
2017-01-13  6:07 ` Ming Lei
2017-01-13  6:10   ` Nikita Yushchenko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=303d9c92-d38e-7456-abeb-e1e5af9a3200@cogentembedded.com \
    --to=nikita.yoush@cogentembedded.com \
    --cc=artemi.ivanov@cogentembedded.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tom.leiming@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).