mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Subhash Jadavani <subhashj@codeaurora.org>
Cc: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org,
	linux-mmc@vger.kernel.org, linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH v2 1/1] block: blk-merge: don't merge the pages with non-contiguous descriptors
Date: Tue, 15 Jan 2013 16:19:54 +0000	[thread overview]
Message-ID: <1358266794.10591.8.camel@dabdike.int.hansenpartnership.com> (raw)
In-Reply-To: <1358265681-25671-1-git-send-email-subhashj@codeaurora.org>

On Tue, 2013-01-15 at 21:31 +0530, Subhash Jadavani wrote:
> blk_rq_map_sg() function merges the physically contiguous pages to use same
> scatter-gather node without checking if their page descriptors are
> contiguous or not.
> 
> Now when dma_map_sg() is called on the scatter gather list, it would
> take the base page pointer from each node (one by one) and iterates
> through all of the pages in same sg node by keep incrementing the base
> page pointer with the assumption that physically contiguous pages will
> have their page descriptor address contiguous which may not be true
> if SPARSEMEM config is enabled. So here we may end referring to invalid
> page descriptor.
> 
> Following table shows the example of physically contiguous pages but
> their page descriptor addresses non-contiguous.
> -------------------------------------------
> | Page Descriptor    |   Physical Address |
> ------------------------------------------
> | 0xc1e43fdc         |   0xdffff000       |
> | 0xc2052000         |   0xe0000000       |
> -------------------------------------------
> 
> With this patch, relevant blk-merge functions will also check if the
> physically contiguous pages are having page descriptors address contiguous
> or not? If not then, these pages are separated to be in different
> scatter-gather nodes.

How does this manifest as a bug?

The discontinuity is in struct page arrays, which hardware doesn't care
about.  All we need is to get from struct page to the physical address
for programming the hardware, for which we use the sg_phys() inline
function.

Even given we have a two page physical contiguity at 0xdffff000 in your
example, the sg list entry contains a length of 8192 and a page_link of
0xc1e43fdc, which we transform to the correct physical address and
length.

James



  reply	other threads:[~2013-01-15 16:20 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-15 16:01 Subhash Jadavani
2013-01-15 16:19 ` James Bottomley [this message]
2013-01-16  6:37   ` Subhash Jadavani
2013-01-16  9:25     ` James Bottomley
2013-01-16 10:32     ` James Bottomley
2013-01-16 12:39       ` Subhash Jadavani
2013-01-16 23:14       ` Russell King - ARM Linux
2013-01-17  8:54         ` James Bottomley
2013-01-16 23:18       ` Tejun Heo
2013-01-17  9:11         ` James Bottomley
2013-01-17 10:37           ` Russell King - ARM Linux
2013-01-17 10:47             ` Russell King - ARM Linux
2013-01-17 11:01               ` James Bottomley
2013-01-17 11:04                 ` Russell King - ARM Linux
2013-01-17 11:19                   ` James Bottomley
2013-01-17 11:40                     ` Russell King - ARM Linux
2013-01-17 14:58               ` Subhash Jadavani

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=1358266794.10591.8.camel@dabdike.int.hansenpartnership.com \
    --to=james.bottomley@hansenpartnership.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=subhashj@codeaurora.org \
    /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

all inboxes | Powered by JetHome®