linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rbtree: include linux/compiler.h for definition of __always_inline
@ 2012-10-22 17:01 Will Deacon
  2012-10-22 21:56 ` Michel Lespinasse
  0 siblings, 1 reply; 4+ messages in thread
From: Will Deacon @ 2012-10-22 17:01 UTC (permalink / raw)
  To: linux-kernel; +Cc: Will Deacon, Pekka Enberg, Michel Lespinasse, Ingo Molnar

rb_erase_augmented is a static function annotated with __always_inline.
This causes a compile failure when attempting to use the rbtree
implementation as a library (e.g. kvm tool):

rbtree_augmented.h:125:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’

This patch includes linux/compiler.h in rbtree_augmented.h so that the
__always_inline macro is resolved correctly.

Cc: Pekka Enberg <penberg@kernel.org>
Cc: Michel Lespinasse <walken@google.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 include/linux/rbtree_augmented.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/linux/rbtree_augmented.h b/include/linux/rbtree_augmented.h
index 214caa3..2ac60c9 100644
--- a/include/linux/rbtree_augmented.h
+++ b/include/linux/rbtree_augmented.h
@@ -24,6 +24,7 @@
 #ifndef _LINUX_RBTREE_AUGMENTED_H
 #define _LINUX_RBTREE_AUGMENTED_H
 
+#include <linux/compiler.h>
 #include <linux/rbtree.h>
 
 /*
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] rbtree: include linux/compiler.h for definition of __always_inline
  2012-10-22 17:01 [PATCH] rbtree: include linux/compiler.h for definition of __always_inline Will Deacon
@ 2012-10-22 21:56 ` Michel Lespinasse
  2012-10-23  9:29   ` Will Deacon
  0 siblings, 1 reply; 4+ messages in thread
From: Michel Lespinasse @ 2012-10-22 21:56 UTC (permalink / raw)
  To: Will Deacon; +Cc: linux-kernel, Pekka Enberg, Ingo Molnar

On Mon, Oct 22, 2012 at 10:01 AM, Will Deacon <will.deacon@arm.com> wrote:
> rb_erase_augmented is a static function annotated with __always_inline.
> This causes a compile failure when attempting to use the rbtree
> implementation as a library (e.g. kvm tool):
>
> rbtree_augmented.h:125:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
>
> This patch includes linux/compiler.h in rbtree_augmented.h so that the
> __always_inline macro is resolved correctly.
>
> Cc: Pekka Enberg <penberg@kernel.org>
> Cc: Michel Lespinasse <walken@google.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> Signed-off-by: Will Deacon <will.deacon@arm.com>

Just curious - what are you going to implement with augmented rbtrees
in kvm tool ?

If the basic rbtree or the interval tree implementations are
sufficient for your usage, you should try using that (in which case
you won't need this header fix).

But either way, the header fix is correct and will be required when
someone wants to use augmented rbtrees outside of the kernel. I just
didn't think that day would come so fast :)

Reviewed-by: Michel Lespinasse <walken@google.com>

-- 
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] rbtree: include linux/compiler.h for definition of __always_inline
  2012-10-22 21:56 ` Michel Lespinasse
@ 2012-10-23  9:29   ` Will Deacon
  2012-10-24  7:45     ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Will Deacon @ 2012-10-23  9:29 UTC (permalink / raw)
  To: Michel Lespinasse; +Cc: linux-kernel@vger.kernel.org, Pekka Enberg, Ingo Molnar

On Mon, Oct 22, 2012 at 10:56:21PM +0100, Michel Lespinasse wrote:
> On Mon, Oct 22, 2012 at 10:01 AM, Will Deacon <will.deacon@arm.com> wrote:
> > rb_erase_augmented is a static function annotated with __always_inline.
> > This causes a compile failure when attempting to use the rbtree
> > implementation as a library (e.g. kvm tool):
> >
> > rbtree_augmented.h:125:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
> >
> > This patch includes linux/compiler.h in rbtree_augmented.h so that the
> > __always_inline macro is resolved correctly.
> >
> > Cc: Pekka Enberg <penberg@kernel.org>
> > Cc: Michel Lespinasse <walken@google.com>
> > Cc: Ingo Molnar <mingo@elte.hu>
> > Signed-off-by: Will Deacon <will.deacon@arm.com>
> 
> Just curious - what are you going to implement with augmented rbtrees
> in kvm tool ?
> 
> If the basic rbtree or the interval tree implementations are
> sufficient for your usage, you should try using that (in which case
> you won't need this header fix).

kvm tool uses interval rbtrees for things like keeping track of virtual
devices, although it looks like Ingo implemented the augment callbacks
while moving to -rc1.

> But either way, the header fix is correct and will be required when
> someone wants to use augmented rbtrees outside of the kernel. I just
> didn't think that day would come so fast :)
> 
> Reviewed-by: Michel Lespinasse <walken@google.com>

Thanks Michel!

Will

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] rbtree: include linux/compiler.h for definition of __always_inline
  2012-10-23  9:29   ` Will Deacon
@ 2012-10-24  7:45     ` Ingo Molnar
  0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2012-10-24  7:45 UTC (permalink / raw)
  To: Will Deacon
  Cc: Michel Lespinasse, linux-kernel@vger.kernel.org, Pekka Enberg,
	Ingo Molnar


* Will Deacon <will.deacon@arm.com> wrote:

> On Mon, Oct 22, 2012 at 10:56:21PM +0100, Michel Lespinasse wrote:
> > On Mon, Oct 22, 2012 at 10:01 AM, Will Deacon <will.deacon@arm.com> wrote:
> > > rb_erase_augmented is a static function annotated with __always_inline.
> > > This causes a compile failure when attempting to use the rbtree
> > > implementation as a library (e.g. kvm tool):
> > >
> > > rbtree_augmented.h:125:24: error: expected ???=???, ???,???, ???;???, ???asm??? or ???__attribute__??? before ???void???
> > >
> > > This patch includes linux/compiler.h in rbtree_augmented.h so that the
> > > __always_inline macro is resolved correctly.
> > >
> > > Cc: Pekka Enberg <penberg@kernel.org>
> > > Cc: Michel Lespinasse <walken@google.com>
> > > Cc: Ingo Molnar <mingo@elte.hu>
> > > Signed-off-by: Will Deacon <will.deacon@arm.com>
> > 
> > Just curious - what are you going to implement with augmented rbtrees
> > in kvm tool ?
> > 
> > If the basic rbtree or the interval tree implementations are
> > sufficient for your usage, you should try using that (in which case
> > you won't need this header fix).
> 
> kvm tool uses interval rbtrees for things like keeping track 
> of virtual devices, although it looks like Ingo implemented 
> the augment callbacks while moving to -rc1.

Yeah, latest kvmtool uses the modern augmented-rbtree facility 
of the kernel.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-24  7:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-22 17:01 [PATCH] rbtree: include linux/compiler.h for definition of __always_inline Will Deacon
2012-10-22 21:56 ` Michel Lespinasse
2012-10-23  9:29   ` Will Deacon
2012-10-24  7:45     ` Ingo Molnar

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).