diff -NurpP --minimal linux-2.6.16-rc5-vs2.0.2-rc10.2/include/linux/vs_context.h linux-2.6.16-rc5-vs2.0.2-rc10.x/include/linux/vs_context.h --- linux-2.6.16-rc5-vs2.0.2-rc10.2/include/linux/vs_context.h 2006-02-17 22:18:51 +0100 +++ linux-2.6.16-rc5-vs2.0.2-rc10.x/include/linux/vs_context.h 2006-03-10 22:19:42 +0100 @@ -5,10 +5,10 @@ #include "vserver/debug.h" -#define get_vx_info(i) __get_vx_info(i,__FILE__,__LINE__) +#define get_vx_info(i) __get_vx_info(i,__FILE__,__LINE__,__HERE__) static inline struct vx_info *__get_vx_info(struct vx_info *vxi, - const char *_file, int _line) + const char *_file, int _line, void *_here) { if (!vxi) return NULL; @@ -16,7 +16,7 @@ static inline struct vx_info *__get_vx_i vxlprintk(VXD_CBIT(xid, 2), "get_vx_info(%p[#%d.%d])", vxi, vxi?vxi->vx_id:0, vxi?atomic_read(&vxi->vx_usecnt):0, _file, _line); - vxh_get_vx_info(vxi); + __vxh_get_vx_info(vxi, _here); atomic_inc(&vxi->vx_usecnt); return vxi; @@ -25,10 +25,10 @@ static inline struct vx_info *__get_vx_i extern void free_vx_info(struct vx_info *); -#define put_vx_info(i) __put_vx_info(i,__FILE__,__LINE__) +#define put_vx_info(i) __put_vx_info(i,__FILE__,__LINE__,__HERE__) static inline void __put_vx_info(struct vx_info *vxi, - const char *_file, int _line) + const char *_file, int _line, void *_here) { if (!vxi) return; @@ -36,17 +36,17 @@ static inline void __put_vx_info(struct vxlprintk(VXD_CBIT(xid, 2), "put_vx_info(%p[#%d.%d])", vxi, vxi?vxi->vx_id:0, vxi?atomic_read(&vxi->vx_usecnt):0, _file, _line); - vxh_put_vx_info(vxi); + __vxh_put_vx_info(vxi, _here); if (atomic_dec_and_test(&vxi->vx_usecnt)) free_vx_info(vxi); } -#define init_vx_info(p,i) __init_vx_info(p,i,__FILE__,__LINE__) +#define init_vx_info(p,i) __init_vx_info(p,i,__FILE__,__LINE__,__HERE__) static inline void __init_vx_info(struct vx_info **vxp, struct vx_info *vxi, - const char *_file, int _line) + const char *_file, int _line, void *_here) { if (vxi) { vxlprintk(VXD_CBIT(xid, 3), @@ -54,7 +54,7 @@ static inline void __init_vx_info(struct vxi, vxi?vxi->vx_id:0, vxi?atomic_read(&vxi->vx_usecnt):0, _file, _line); - vxh_init_vx_info(vxi, vxp); + __vxh_init_vx_info(vxi, vxp, _here); atomic_inc(&vxi->vx_usecnt); } @@ -62,10 +62,10 @@ static inline void __init_vx_info(struct } -#define set_vx_info(p,i) __set_vx_info(p,i,__FILE__,__LINE__) +#define set_vx_info(p,i) __set_vx_info(p,i,__FILE__,__LINE__,__HERE__) static inline void __set_vx_info(struct vx_info **vxp, struct vx_info *vxi, - const char *_file, int _line) + const char *_file, int _line, void *_here) { struct vx_info *vxo; @@ -76,7 +76,7 @@ static inline void __set_vx_info(struct vxi, vxi?vxi->vx_id:0, vxi?atomic_read(&vxi->vx_usecnt):0, _file, _line); - vxh_set_vx_info(vxi, vxp); + __vxh_set_vx_info(vxi, vxp, _here); atomic_inc(&vxi->vx_usecnt); vxo = xchg(vxp, vxi); @@ -84,10 +84,10 @@ static inline void __set_vx_info(struct } -#define clr_vx_info(p) __clr_vx_info(p,__FILE__,__LINE__) +#define clr_vx_info(p) __clr_vx_info(p,__FILE__,__LINE__,__HERE__) static inline void __clr_vx_info(struct vx_info **vxp, - const char *_file, int _line) + const char *_file, int _line, void *_here) { struct vx_info *vxo; @@ -99,24 +99,26 @@ static inline void __clr_vx_info(struct vxo, vxo?vxo->vx_id:0, vxo?atomic_read(&vxo->vx_usecnt):0, _file, _line); - vxh_clr_vx_info(vxo, vxp); + __vxh_clr_vx_info(vxo, vxp, _here); if (atomic_dec_and_test(&vxo->vx_usecnt)) free_vx_info(vxo); } -#define claim_vx_info(v,p) __claim_vx_info(v,p,__FILE__,__LINE__) +#define claim_vx_info(v,p) \ + __claim_vx_info(v,p,__FILE__,__LINE__,__HERE__) static inline void __claim_vx_info(struct vx_info *vxi, - struct task_struct *task, const char *_file, int _line) + struct task_struct *task, + const char *_file, int _line, void *_here) { vxlprintk(VXD_CBIT(xid, 3), "claim_vx_info(%p[#%d.%d.%d]) %p", vxi, vxi?vxi->vx_id:0, vxi?atomic_read(&vxi->vx_usecnt):0, vxi?atomic_read(&vxi->vx_tasks):0, task, _file, _line); - vxh_claim_vx_info(vxi, task); + __vxh_claim_vx_info(vxi, task, _here); atomic_inc(&vxi->vx_tasks); } @@ -124,17 +126,19 @@ static inline void __claim_vx_info(struc extern void unhash_vx_info(struct vx_info *); -#define release_vx_info(v,p) __release_vx_info(v,p,__FILE__,__LINE__) +#define release_vx_info(v,p) \ + __release_vx_info(v,p,__FILE__,__LINE__,__HERE__) static inline void __release_vx_info(struct vx_info *vxi, - struct task_struct *task, const char *_file, int _line) + struct task_struct *task, + const char *_file, int _line, void *_here) { vxlprintk(VXD_CBIT(xid, 3), "release_vx_info(%p[#%d.%d.%d]) %p", vxi, vxi?vxi->vx_id:0, vxi?atomic_read(&vxi->vx_usecnt):0, vxi?atomic_read(&vxi->vx_tasks):0, task, _file, _line); - vxh_release_vx_info(vxi, task); + __vxh_release_vx_info(vxi, task, _here); might_sleep(); @@ -143,17 +147,18 @@ static inline void __release_vx_info(str } -#define task_get_vx_info(p) __task_get_vx_info(p,__FILE__,__LINE__) +#define task_get_vx_info(p) \ + __task_get_vx_info(p,__FILE__,__LINE__,__HERE__) -static __inline__ struct vx_info *__task_get_vx_info(struct task_struct *p, - const char *_file, int _line) +static inline struct vx_info *__task_get_vx_info(struct task_struct *p, + const char *_file, int _line, void *_here) { struct vx_info *vxi; task_lock(p); vxlprintk(VXD_CBIT(xid, 5), "task_get_vx_info(%p)", p, _file, _line); - vxi = __get_vx_info(p->vx_info, _file, _line); + vxi = __get_vx_info(p->vx_info, _file, _line, _here); task_unlock(p); return vxi; } diff -NurpP --minimal linux-2.6.16-rc5-vs2.0.2-rc10.2/include/linux/vserver/debug.h linux-2.6.16-rc5-vs2.0.2-rc10.x/include/linux/vserver/debug.h --- linux-2.6.16-rc5-vs2.0.2-rc10.2/include/linux/vserver/debug.h 2006-03-05 05:20:03 +0100 +++ linux-2.6.16-rc5-vs2.0.2-rc10.x/include/linux/vserver/debug.h 2006-03-10 22:11:58 +0100 @@ -143,7 +143,9 @@ struct _vx_hist_entry { struct _vx_hist_entry *vxh_advance(void *loc); -static inline void __vxh_copy_vxi(struct _vx_hist_entry *entry, struct vx_info *vxi) + +static inline +void __vxh_copy_vxi(struct _vx_hist_entry *entry, struct vx_info *vxi) { entry->vxi.ptr = vxi; if (vxi) { @@ -154,97 +156,117 @@ static inline void __vxh_copy_vxi(struct } -#define VXH_HERE() current_text_addr() +#define __HERE__ current_text_addr() -#define __VXH_BODY(__type, __data) \ +#define __VXH_BODY(__type, __data, __here) \ struct _vx_hist_entry *entry; \ \ preempt_disable(); \ - entry = vxh_advance(VXH_HERE()); \ + entry = vxh_advance(__here); \ __data; \ entry->type = __type; \ preempt_enable(); /* pass vxi only */ -#define __VXH_SIMPLE \ + +#define __VXH_SMPL \ __vxh_copy_vxi(entry, vxi) -#define VXH_SIMPLE(__name, __type) \ -static inline void __name(struct vx_info *vxi) \ -{ \ - __VXH_BODY(__type, __VXH_SIMPLE) \ +static inline +void __vxh_smpl(struct vx_info *vxi, int __type, void *__here) +{ + __VXH_BODY(__type, __VXH_SMPL, __here) } /* pass vxi and data (void *) */ + #define __VXH_DATA \ __vxh_copy_vxi(entry, vxi); \ entry->sc.data = data -#define VXH_DATA(__name, __type) \ -static inline \ -void __name(struct vx_info *vxi, void *data) \ -{ \ - __VXH_BODY(__type, __VXH_DATA) \ +static inline +void __vxh_data(struct vx_info *vxi, void *data, + int __type, void *__here) +{ + __VXH_BODY(__type, __VXH_DATA, __here) } /* pass vxi and arg (long) */ -#define __VXH_LARG \ + +#define __VXH_LONG \ __vxh_copy_vxi(entry, vxi); \ entry->ll.arg = arg -#define VXH_LARG(__name, __type) \ -static inline \ -void __name(struct vx_info *vxi, long arg) \ -{ \ - __VXH_BODY(__type, __VXH_LARG) \ +static inline +void __vxh_long(struct vx_info *vxi, long arg, + int __type, void *__here) +{ + __VXH_BODY(__type, __VXH_LONG, __here) } -static inline void vxh_throw_oops(void) +static inline +void __vxh_throw_oops(void *__here) { - __VXH_BODY(VXH_THROW_OOPS, {}); + __VXH_BODY(VXH_THROW_OOPS, {}, __here); /* prevent further acquisition */ vxh_active = 0; } -VXH_SIMPLE(vxh_get_vx_info, VXH_GET_VX_INFO); -VXH_SIMPLE(vxh_put_vx_info, VXH_PUT_VX_INFO); -VXH_DATA(vxh_init_vx_info, VXH_INIT_VX_INFO); -VXH_DATA(vxh_set_vx_info, VXH_SET_VX_INFO); -VXH_DATA(vxh_clr_vx_info, VXH_CLR_VX_INFO); +#define vxh_throw_oops() __vxh_throw_oops(__HERE__); -VXH_DATA(vxh_claim_vx_info, VXH_CLAIM_VX_INFO); -VXH_DATA(vxh_release_vx_info, VXH_RELEASE_VX_INFO); +#define __vxh_get_vx_info(v,h) __vxh_smpl(v, VXH_GET_VX_INFO, h); +#define __vxh_put_vx_info(v,h) __vxh_smpl(v, VXH_PUT_VX_INFO, h); -VXH_SIMPLE(vxh_alloc_vx_info, VXH_ALLOC_VX_INFO); -VXH_SIMPLE(vxh_dealloc_vx_info, VXH_DEALLOC_VX_INFO); +#define __vxh_init_vx_info(v,d,h) \ + __vxh_data(v,d, VXH_INIT_VX_INFO, h); +#define __vxh_set_vx_info(v,d,h) \ + __vxh_data(v,d, VXH_SET_VX_INFO, h); +#define __vxh_clr_vx_info(v,d,h) \ + __vxh_data(v,d, VXH_CLR_VX_INFO, h); -VXH_SIMPLE(vxh_hash_vx_info, VXH_HASH_VX_INFO); -VXH_SIMPLE(vxh_unhash_vx_info, VXH_UNHASH_VX_INFO); +#define __vxh_claim_vx_info(v,d,h) \ + __vxh_data(v,d, VXH_CLAIM_VX_INFO, h); +#define __vxh_release_vx_info(v,d,h) \ + __vxh_data(v,d, VXH_RELEASE_VX_INFO, h); -VXH_LARG(vxh_loc_vx_info, VXH_LOC_VX_INFO); -VXH_LARG(vxh_lookup_vx_info, VXH_LOOKUP_VX_INFO); -VXH_LARG(vxh_create_vx_info, VXH_CREATE_VX_INFO); +#define vxh_alloc_vx_info(v) \ + __vxh_smpl(v, VXH_ALLOC_VX_INFO, __HERE__); +#define vxh_dealloc_vx_info(v) \ + __vxh_smpl(v, VXH_DEALLOC_VX_INFO, __HERE__); + +#define vxh_hash_vx_info(v) \ + __vxh_smpl(v, VXH_HASH_VX_INFO, __HERE__); +#define vxh_unhash_vx_info(v) \ + __vxh_smpl(v, VXH_UNHASH_VX_INFO, __HERE__); + +#define vxh_loc_vx_info(v,l) \ + __vxh_long(v,l, VXH_LOC_VX_INFO, __HERE__); +#define vxh_lookup_vx_info(v,l) \ + __vxh_long(v,l, VXH_LOOKUP_VX_INFO, __HERE__); +#define vxh_create_vx_info(v,l) \ + __vxh_long(v,l, VXH_CREATE_VX_INFO, __HERE__); extern void vxh_dump_history(void); #else /* CONFIG_VSERVER_HISTORY */ +#define __HERE__ 0 #define vxh_throw_oops() do { } while (0) -#define vxh_get_vx_info(v) do { } while (0) -#define vxh_put_vx_info(v) do { } while (0) +#define __vxh_get_vx_info(v,h) do { } while (0) +#define __vxh_put_vx_info(v,h) do { } while (0) -#define vxh_init_vx_info(v,d) do { } while (0) -#define vxh_set_vx_info(v,d) do { } while (0) -#define vxh_clr_vx_info(v,d) do { } while (0) +#define __vxh_init_vx_info(v,d,h) do { } while (0) +#define __vxh_set_vx_info(v,d,h) do { } while (0) +#define __vxh_clr_vx_info(v,d,h) do { } while (0) -#define vxh_claim_vx_info(v,d) do { } while (0) -#define vxh_release_vx_info(v,d) do { } while (0) +#define __vxh_claim_vx_info(v,d,h) do { } while (0) +#define __vxh_release_vx_info(v,d,h) do { } while (0) #define vxh_alloc_vx_info(v) do { } while (0) #define vxh_dealloc_vx_info(v) do { } while (0)