All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <npiggin@suse.de>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Jared Hulbert <jaredeh@gmail.com>,
	carsteno@de.ibm.com, Andrew Morton <akpm@linux-foundation.org>,
	mschwid2@linux.vnet.ibm.com, heicars2@linux.vnet.ibm.com,
	linux-mm@kvack.org, linux-fsdevel@vger.kernel.org
Subject: Re: [patch 4/6] xip: support non-struct page backed memory
Date: Mon, 3 Mar 2008 21:32:02 +0100	[thread overview]
Message-ID: <20080303203202.GI8974@wotan.suse.de> (raw)
In-Reply-To: <alpine.LFD.1.00.0803031152240.17889@woody.linux-foundation.org>

On Mon, Mar 03, 2008 at 12:04:37PM -0800, Linus Torvalds wrote:
> 
> 
> On Mon, 3 Mar 2008, Jared Hulbert wrote:
> > 
> > By 1:1 you mean virtual + offset == physical + offset right?
> 
> Right. It's a special case, and it's an important special case because 
> it's the only one that is fast to do.
> 
> It's not very common, but it's common enough that it's worth doing.
> 
> That said, xip should probably never have used virt_to_phys() in the first 
> place. It should be limited to purely architecture-specific memory 
> management routines.

Actually, xip in your kernel doesn't, it was just a patch I proposed.
Basically I wanted to get a pfn from a kva, however that kva might be
ioremapped which I didn't actually worry about because only testing
a plain RAM backed system.

 
> [ There's a number of drivers that need "physical" addresses for DMA, and 
>   that use virt_to_phys, but they should use the DMA interfaces 
>   that do this right, and even for legacy things that don't use the proper 
>   DMA allocator things virt_to_phys is wrong, because it's about _bus_ 
>   addresses, not CPU physical addresses. Only architecture code can know 
>   when the two actually mean the same thing ]
> 
> Quite frankly, I think it's totally wrong to use kernel-virtual addresses 
> in those interfaces in first place. Either you use "struct page *" or you 
> use a pfn number. Nothing else is simply valid.

Although they were already using kernel-virtual addresses before I got
there, we want to remove the requirement to have a struct page, and
there are no good accessors to kmap a pfn (AFAIK) otherwise we could
indeed just use a pfn.

We'll scrap the virt_to_phys idea and make the interface return both
the kaddr and the pfn, I think.


WARNING: multiple messages have this Message-ID (diff)
From: Nick Piggin <npiggin@suse.de>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Jared Hulbert <jaredeh@gmail.com>,
	carsteno@de.ibm.com, Andrew Morton <akpm@linux-foundation.org>,
	mschwid2@linux.vnet.ibm.com, heicars2@linux.vnet.ibm.com,
	linux-mm@kvack.org, linux-fsdevel@vger.kernel.org
Subject: Re: [patch 4/6] xip: support non-struct page backed memory
Date: Mon, 3 Mar 2008 21:32:02 +0100	[thread overview]
Message-ID: <20080303203202.GI8974@wotan.suse.de> (raw)
In-Reply-To: <alpine.LFD.1.00.0803031152240.17889@woody.linux-foundation.org>

On Mon, Mar 03, 2008 at 12:04:37PM -0800, Linus Torvalds wrote:
> 
> 
> On Mon, 3 Mar 2008, Jared Hulbert wrote:
> > 
> > By 1:1 you mean virtual + offset == physical + offset right?
> 
> Right. It's a special case, and it's an important special case because 
> it's the only one that is fast to do.
> 
> It's not very common, but it's common enough that it's worth doing.
> 
> That said, xip should probably never have used virt_to_phys() in the first 
> place. It should be limited to purely architecture-specific memory 
> management routines.

Actually, xip in your kernel doesn't, it was just a patch I proposed.
Basically I wanted to get a pfn from a kva, however that kva might be
ioremapped which I didn't actually worry about because only testing
a plain RAM backed system.

 
> [ There's a number of drivers that need "physical" addresses for DMA, and 
>   that use virt_to_phys, but they should use the DMA interfaces 
>   that do this right, and even for legacy things that don't use the proper 
>   DMA allocator things virt_to_phys is wrong, because it's about _bus_ 
>   addresses, not CPU physical addresses. Only architecture code can know 
>   when the two actually mean the same thing ]
> 
> Quite frankly, I think it's totally wrong to use kernel-virtual addresses 
> in those interfaces in first place. Either you use "struct page *" or you 
> use a pfn number. Nothing else is simply valid.

Although they were already using kernel-virtual addresses before I got
there, we want to remove the requirement to have a struct page, and
there are no good accessors to kmap a pfn (AFAIK) otherwise we could
indeed just use a pfn.

We'll scrap the virt_to_phys idea and make the interface return both
the kaddr and the pfn, I think.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2008-03-03 20:32 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080118045649.334391000@suse.de>
2008-01-18  4:56 ` [patch 1/6] mm: introduce VM_MIXEDMAP npiggin, Jared Hulbert
2008-01-18  4:56 ` [patch 2/6] mm: introduce pte_special pte bit npiggin-l3A5Bk7waGM
2008-01-18  4:56   ` npiggin
2008-01-18  4:56   ` npiggin
2008-01-18 16:41   ` Linus Torvalds
2008-01-18 16:41     ` Linus Torvalds
2008-01-18 18:04     ` Sam Ravnborg
2008-01-18 18:04       ` Sam Ravnborg
2008-01-18 18:28       ` Linus Torvalds
2008-01-18 18:28         ` Linus Torvalds
2008-01-18 18:53         ` Sam Ravnborg
2008-01-18 18:53           ` Sam Ravnborg
2008-01-18 22:46     ` Nick Piggin
2008-01-18 22:46       ` Nick Piggin
2008-01-18 23:03       ` Linus Torvalds
2008-01-18 23:03         ` Linus Torvalds
2008-01-19  5:07         ` Nick Piggin
2008-01-19  5:07           ` Nick Piggin
2008-01-21  9:43       ` Nick Piggin
2008-01-21  9:43         ` Nick Piggin
2008-01-18  4:56 ` [patch 3/6] mm: add vm_insert_mixed npiggin
2008-01-18  4:56 ` [patch 4/6] xip: support non-struct page backed memory npiggin
2008-01-18  4:56   ` npiggin
2008-03-01  8:14   ` Jared Hulbert
2008-03-01  8:14     ` Jared Hulbert
2008-03-03  5:29     ` Nick Piggin
2008-03-03  5:29       ` Nick Piggin
2008-03-03  8:30       ` Carsten Otte
2008-03-03  8:30         ` Carsten Otte
2008-03-03 15:59       ` Jared Hulbert
2008-03-03 15:59         ` Jared Hulbert
2008-03-03  8:18     ` Carsten Otte
2008-03-03  8:18       ` Carsten Otte
2008-03-03 15:44       ` Jared Hulbert
2008-03-03 15:44         ` Jared Hulbert
2008-03-03 18:40       ` Linus Torvalds
2008-03-03 18:40         ` Linus Torvalds
2008-03-03 19:38         ` Jared Hulbert
2008-03-03 19:38           ` Jared Hulbert
2008-03-03 20:04           ` Linus Torvalds
2008-03-03 20:04             ` Linus Torvalds
2008-03-03 20:32             ` Nick Piggin [this message]
2008-03-03 20:32               ` Nick Piggin
2008-03-03 22:21               ` Linus Torvalds
2008-03-03 22:21                 ` Linus Torvalds
2008-03-03 23:25                 ` Jared Hulbert
2008-03-03 23:25                   ` Jared Hulbert
2008-03-04  9:06                 ` Carsten Otte
2008-03-04  9:06                   ` Carsten Otte

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=20080303203202.GI8974@wotan.suse.de \
    --to=npiggin@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=carsteno@de.ibm.com \
    --cc=heicars2@linux.vnet.ibm.com \
    --cc=jaredeh@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mschwid2@linux.vnet.ibm.com \
    --cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.