Skip to contentSkip to conversation

rbtree: include linux/compiler.h for definition of __always_inline

PATCH In review Will Deacon 3 participants 4 messages Oct 22, 2012 – Oct 24, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rbtree: include linux/compiler.h for definition of __always_inline

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 <[email protected]>
Cc Michel Lespinasse <[email protected]>
Cc Ingo Molnar <[email protected]>
---
 include/linux/rbtree_augmented.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
include/linux/rbtree_augmented.h +1 -0
index 214caa3..2ac60c9 100644
@@ -24,6 +24,7 @@
 #ifndef _LINUX_RBTREE_AUGMENTED_H
 #define _LINUX_RBTREE_AUGMENTED_H
 
+#include <linux/compiler.h>
 #include <linux/rbtree.h>
 
 /*
Signature · 1 line
1.7.4.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Will Deacon

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’

Quoted 7 lines

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

Cc Pekka Enberg <[email protected]>
Cc Michel Lespinasse <[email protected]>
Cc Ingo Molnar <[email protected]>

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

Signature · 2 lines
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.
#2 lore raw
Quoted 15 lines · Michel Lespinasse
Quoted 6 lines · Will Deacon

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’

Quoted 7 lines

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

Cc Pekka Enberg <[email protected]>
Cc Michel Lespinasse <[email protected]>
Cc Ingo Molnar <[email protected]>
Quoted 6 lines

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.

Quoted 5 lines

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

Thanks Michel!

Will

#3 lore raw
Quoted 19 lines · Will Deacon
Quoted 18 lines · Michel Lespinasse
Quoted 6 lines · Will Deacon

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???

Quoted 7 lines

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

Cc Pekka Enberg <[email protected]>
Cc Michel Lespinasse <[email protected]>
Cc Ingo Molnar <[email protected]>

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

Quoted 7 lines
Quoted 3 lines

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