netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robert Hancock <hancockrwd@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: bzolnier@gmail.com, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [RFC PATCH] fix problems with NETIF_F_HIGHDMA in networking drivers
Date: Sat, 27 Feb 2010 11:59:47 -0600	[thread overview]
Message-ID: <51f3faa71002270959o4d1435e3xf67185fccaf50b18@mail.gmail.com> (raw)
In-Reply-To: <20100227.015350.71138134.davem@davemloft.net>

On Sat, Feb 27, 2010 at 3:53 AM, David Miller <davem@davemloft.net> wrote:
> From: Robert Hancock <hancockrwd@gmail.com>
> Date: Fri, 26 Feb 2010 21:08:04 -0600
>
>> That seems like a reasonable approach to me. Only question is how to
>> implement the check for DMA_64BIT. Can we just check page_to_phys on
>> each of the pages in the skb to see if it's > 0xffffffff ? Are there
>> any architectures where it's more complicated than that?
>
> On almost every platform it's "more complicated than that".
>
> This is the whole issue.  What matters is the final DMA address and
> since we have IOMMUs and the like, it is absolutely not tenable to
> solve this by checking physical address attributes.

Yeah, physical address isn't quite right. There is a precedent for
such a check in the block layer though - look at
blk_queue_bounce_limit in block/blk-settings.c:

void blk_queue_bounce_limit(struct request_queue *q, u64 dma_mask)
{
        unsigned long b_pfn = dma_mask >> PAGE_SHIFT;
        int dma = 0;

        q->bounce_gfp = GFP_NOIO;
#if BITS_PER_LONG == 64
        /*
         * Assume anything <= 4GB can be handled by IOMMU.  Actually
         * some IOMMUs can handle everything, but I don't know of a
         * way to test this here.
         */
        if (b_pfn < (min_t(u64, 0xffffffffUL, BLK_BOUNCE_HIGH) >> PAGE_SHIFT))
                dma = 1;
        q->limits.bounce_pfn = max_low_pfn;
#else
        if (b_pfn < blk_max_low_pfn)
                dma = 1;
        q->limits.bounce_pfn = b_pfn;
#endif
        if (dma) {
                init_emergency_isa_pool();
                q->bounce_gfp = GFP_NOIO | GFP_DMA;
                q->limits.bounce_pfn = b_pfn;
        }
}

and then in mm/bounce.c:

static void __blk_queue_bounce(struct request_queue *q, struct bio **bio_orig,
                               mempool_t *pool)
{
        struct page *page;
        struct bio *bio = NULL;
        int i, rw = bio_data_dir(*bio_orig);
        struct bio_vec *to, *from;

        bio_for_each_segment(from, *bio_orig, i) {
                page = from->bv_page;

                /*
                 * is destination page below bounce pfn?
                 */
                if (page_to_pfn(page) <= queue_bounce_pfn(q))
                        continue;

Following that logic then, it appears that page_to_pfn(page) >
(0xffffffff >> PAGE_SHIFT) should tell us what we want to know for the
DMA_64BIT flag.. or am I missing something?

  parent reply	other threads:[~2010-02-27 17:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-23  2:45 [RFC PATCH] fix problems with NETIF_F_HIGHDMA in networking drivers Robert Hancock
2010-02-26  9:36 ` David Miller
     [not found]   ` <20100226.013637.255461265.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2010-02-26 14:46     ` Robert Hancock
2010-02-26 15:25       ` Bartlomiej Zolnierkiewicz
2010-02-27  3:08         ` Robert Hancock
2010-02-27  9:53           ` David Miller
2010-02-27 11:59             ` Bartlomiej Zolnierkiewicz
2010-02-27 12:05               ` David Miller
2010-02-27 18:15                 ` Robert Hancock
2010-02-27 18:38                   ` FUJITA Tomonori
     [not found]                     ` <20100228033706G.fujita.tomonori-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org>
2010-02-28  8:16                       ` David Miller
2010-03-01 16:34                         ` Was: Re: [RFC PATCH] fix problems with NETIF_F_HIGHDMA in networking, Now: SWIOTLB dynamic allocation Konrad Rzeszutek Wilk
2010-03-01 21:12                           ` Robert Hancock
2010-03-02  4:40                             ` FUJITA Tomonori
2010-03-02  4:40                           ` FUJITA Tomonori
2010-02-27 17:59             ` Robert Hancock [this message]
     [not found]               ` <51f3faa71002270959o4d1435e3xf67185fccaf50b18-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-02-27 18:38                 ` [RFC PATCH] fix problems with NETIF_F_HIGHDMA in networking drivers FUJITA Tomonori

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=51f3faa71002270959o4d1435e3xf67185fccaf50b18@mail.gmail.com \
    --to=hancockrwd@gmail.com \
    --cc=bzolnier@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).