mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ian Campbell <ijc@hellion.org.uk>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: jeremy@goop.org, xen-devel@lists.xensource.com,
	beckyb@kernel.crashing.org, okir@suse.de, x86@kernel.org,
	linux-kernel@vger.kernel.org, mingo@elte.hu, gregkh@suse.de
Subject: Re: [Xen-devel] Re: Where do we stand with the Xen patches?
Date: Thu, 21 May 2009 12:45:35 +0100	[thread overview]
Message-ID: <1242906335.22654.188.camel@zakaz.uk.xensource.com> (raw)
In-Reply-To: <20090521201951I.fujita.tomonori@lab.ntt.co.jp>

On Thu, 2009-05-21 at 20:19 +0900, FUJITA Tomonori wrote:
> On Thu, 21 May 2009 12:03:05 +0100
> Ian Campbell <ijc@hellion.org.uk> wrote:
> 
> > On Thu, 2009-05-21 at 06:39 -0400, FUJITA Tomonori wrote:
> > > On Thu, 21 May 2009 11:28:53 +0100
> > > Ian Campbell <ijc@hellion.org.uk> wrote:
> > >  
> > > > +#ifdef CONFIG_PCI_XEN
> > > > +extern int xen_range_needs_mapping(phys_addr_t paddr, size_t size);
> > > > +#else
> > > > +static inline int xen_range_needs_mapping(phys_addr_t paddr, size_t size) { return 0; }
> > > > +#endif
> > > 
> > > I know Xen can do something like this but you think that this is
> > > clean?
> > 
> > Well, defining a static inline function when a CONFIG option is disabled
> > is fairly idiomatic in the kernel and in general hiding these sorts of
> > things in the headers in this way is preferred to having them in .c
> > files. See e.g. the handling of CONFIG_PRINTK in include/linux/kernel.h
> > or CONFIG_HIGHMEM in include/linux/highmem.h for just two examples out
> > of many.
> 
> Well, I know that it's idiomatic, but placing CONFIG_PCI_XEN in
> arch/{x86|ia64}/include/asm/ is a wrong abstraction to me.

Agreed, include/xen/swiotlb.h is the right place for it.

> > > In addition, you also the similar hack in
> > > arch/ia64/include/asm/dma-mapping.h for ia64's dom0 support, I think.
> > > 
> > > IMO, your patch just moves the ugly hacks from lib/swiotlb.c to
> > > arch/{x86|ia64}/include/asm/dma-mapping.h.
> > 
> > I nearly suggested that for this hook it might actually be preferable to
> > put the one line Xen hook directly into swiotlb.c. I didn't think this
> > suggestion would go down very well though.
> 
> Any arch or Xen specific code should not live in swiotlb.c

Again agreed, which is why I didn't suggest it ;-)

> > In any case something along these lines needs to go somewhere. I think
> > you are slightly mischaracterising this as an "ugly hack" -- it is a
> > necessary interface to enable a particular use-case, and it actually has
> > a very small cross section (it's basically five or six lines of code).
> 

> 
> A necessary interface? Sorry, I don't buy it. It's necessary for
> only Xen. And it's not fit well for swiotlb and the architecture
> abstraction.

I said "necessary interface to enable a particular use-case". Xen is a
valid use case -- I appreciate that you personally may have no interest
in it but plenty of people do and plenty of people would like to see it
working in the mainline kernels.

In terms of clean abstraction this is a architecture hook to allow
mappings to be forced through the swiotlb. It is essentially a more
flexible extension to the existing swiotlb_force flag, in fact
swiotlb_force_mapping() might even be a better name for it.

IMHO, the benefits here (working Xen domain 0 plus PCI passthrough to
guest domains) are well worth the costs.

> > If there was a cleaner way to achieve the same result we would of course
> > go with that. I don't think duplicating swiotlb.c, as has been suggested
> > as the alternative, just for that one hook point makes sense.
> 
> One hook? You need to reread swiotlb.c. There are more. All should go.

I meant that swiotlb_range_needs_mapping is the single contentious hook
as far as I can tell. It is the only one which you appear to be
disputing the very existence of (irrespective of whether it uses __weak
or is moved into asm/dma-mapping.h). The other existing __weak hooks are
useful to other users too and all can, AFAICT, be moved into
asm/dma-mapping.h.

You have already dealt with moving swiotlb_address_needs_mapping and I
am currently looking into the the phys_to_bus and bus_to_phys ones. That
just leaves the alloc functions, which are next on my list after
phys_to_bus and bus_to_phys. Will finishing up those patches resolve
most of your objections are do you have others?

Ian.

-- 
Ian Campbell

This supersedes all previous notices.


  reply	other threads:[~2009-05-21 11:46 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-14 19:54 Jeremy Fitzhardinge
2009-05-15 18:35 ` Ingo Molnar
2009-05-15 19:59   ` Jeremy Fitzhardinge
2009-05-18  1:36 ` FUJITA Tomonori
2009-05-18  1:42   ` Jeremy Fitzhardinge
2009-05-18  8:40   ` Ingo Molnar
2009-05-19  5:27     ` FUJITA Tomonori
2009-05-19 13:03       ` Ingo Molnar
2009-05-19 15:30         ` FUJITA Tomonori
2009-05-19 15:56           ` Ian Campbell
2009-05-20 17:06             ` Jeremy Fitzhardinge
2009-05-21  8:54               ` FUJITA Tomonori
2009-05-21 10:27                 ` Ian Campbell
2009-05-21 10:28                   ` Ian Campbell
2009-05-21 10:39                     ` FUJITA Tomonori
2009-05-21 11:03                       ` [Xen-devel] " Ian Campbell
2009-05-21 11:08                         ` Ian Campbell
2009-05-21 11:19                         ` FUJITA Tomonori
2009-05-21 11:45                           ` Ian Campbell [this message]
2009-05-21 16:15                             ` swiotlb: remove __weak hooks in favour of architecture-specific functions Ian Campbell
2009-05-21 16:19                               ` Ian Campbell
2009-05-21 16:47                               ` Randy Dunlap
2009-05-22  8:55                                 ` Ian Campbell
2009-05-22 11:13                               ` FUJITA Tomonori
2009-05-22 11:43                                 ` Ian Campbell
2009-05-22 11:55                                   ` FUJITA Tomonori
2009-05-22 14:02                                     ` Ian Campbell
2009-05-22 14:24                                       ` FUJITA Tomonori
2009-05-21 16:15                             ` [PATCH] swiotlb: make is_buffer_dma_capable architecture-specific Ian Campbell
2009-05-21 16:15                             ` [PATCH] swiotlb: make range_needs_mapping architecture-specific Ian Campbell
2009-05-22 11:13                               ` FUJITA Tomonori
2009-05-22 11:45                                 ` Ian Campbell
2009-05-21 16:15                             ` [PATCH] swiotlb/xen: update xen for swiotlb_arch_force_mapping changes Ian Campbell
2009-05-21 16:15                             ` [PATCH] swiotlb: make swiotlb allocation functions architecture-specific Ian Campbell
2009-05-22 11:13                               ` FUJITA Tomonori
2009-05-22 11:46                                 ` Ian Campbell
2009-05-21 16:15                             ` [PATCH] swiotlb/xen: update xen for changes to swiotlb allocation interface Ian Campbell
2009-05-21 16:15                             ` [PATCH] swiotlb: make swiotlb phys<->bus translations architecture-specific Ian Campbell
2009-05-22 11:13                               ` FUJITA Tomonori
2009-05-22 11:46                                 ` Ian Campbell
2009-05-21 16:15                             ` [PATCH] swiotlb/xen: update xen swiotlb for phys<->bus API changes Ian Campbell
2009-05-21 17:21                             ` [Xen-devel] Re: Where do we stand with the Xen patches? FUJITA Tomonori
2009-05-21 10:48                 ` Ian Campbell

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=1242906335.22654.188.camel@zakaz.uk.xensource.com \
    --to=ijc@hellion.org.uk \
    --cc=beckyb@kernel.crashing.org \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=gregkh@suse.de \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=okir@suse.de \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xensource.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

all inboxes | Powered by JetHome®