[PATCH 01/16] introduce vcpu struct
this patch introduces a vcpu struct for lguest. In upcoming patches, more and more fields will be moved from the lguest struct to the vcpu Signed-off-by: Glauber de Oliveira Costa <[EMAIL PROTECTED]> --- drivers/lguest/lg.h | 10 ++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h index 8692489..8fc1c29 100644 --- a/drivers/lguest/lg.h +++ b/drivers/lguest/lg.h @@ -38,6 +38,13 @@ struct lguest_pages #define CHANGED_GDT_TLS4 /* Actually a subset of CHANGED_GDT */ #define CHANGED_ALL3 +struct lguest; + +struct lg_vcpu { + int vcpu_id; + struct lguest *lg; +}; + /* The private info the thread maintains about the guest. */ struct lguest { @@ -47,6 +54,9 @@ struct lguest struct lguest_data __user *lguest_data; struct task_struct *tsk; struct mm_struct *mm; /* == tsk->mm, but that becomes NULL on exit */ + struct lg_vcpu vcpus[NR_CPUS]; + unsigned int nr_vcpus; + u32 pfn_limit; /* This provides the offset to the base of guest-physical * memory in the Launcher. */ -- 1.5.0.6 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 01/16] introduce vcpu struct
this patch introduces a vcpu struct for lguest. In upcoming patches, more and more fields will be moved from the lguest struct to the vcpu Signed-off-by: Glauber de Oliveira Costa [EMAIL PROTECTED] --- drivers/lguest/lg.h | 10 ++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h index 8692489..8fc1c29 100644 --- a/drivers/lguest/lg.h +++ b/drivers/lguest/lg.h @@ -38,6 +38,13 @@ struct lguest_pages #define CHANGED_GDT_TLS4 /* Actually a subset of CHANGED_GDT */ #define CHANGED_ALL3 +struct lguest; + +struct lg_vcpu { + int vcpu_id; + struct lguest *lg; +}; + /* The private info the thread maintains about the guest. */ struct lguest { @@ -47,6 +54,9 @@ struct lguest struct lguest_data __user *lguest_data; struct task_struct *tsk; struct mm_struct *mm; /* == tsk-mm, but that becomes NULL on exit */ + struct lg_vcpu vcpus[NR_CPUS]; + unsigned int nr_vcpus; + u32 pfn_limit; /* This provides the offset to the base of guest-physical * memory in the Launcher. */ -- 1.5.0.6 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 01/16] introduce vcpu struct
On Friday 21 December 2007 00:33:41 Glauber de Oliveira Costa wrote: > this patch introduces a vcpu struct for lguest. In upcoming patches, > more and more fields will be moved from the lguest struct to the vcpu Hi Glommer, > +static inline struct lguest *lg_of_vcpu(struct lguest_vcpu *vcpu) > +{ > + return container_of((vcpu - vcpu->vcpu_id), struct lguest, vcpus[0]); > +} I think this function is a bad idea: it contains implicit UP assumptions which aren't obvious to the caller. vcpu->lg should do the same thing, no? Rusty, -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 01/16] introduce vcpu struct
On Friday 21 December 2007 00:33:41 Glauber de Oliveira Costa wrote: this patch introduces a vcpu struct for lguest. In upcoming patches, more and more fields will be moved from the lguest struct to the vcpu Hi Glommer, +static inline struct lguest *lg_of_vcpu(struct lguest_vcpu *vcpu) +{ + return container_of((vcpu - vcpu-vcpu_id), struct lguest, vcpus[0]); +} I think this function is a bad idea: it contains implicit UP assumptions which aren't obvious to the caller. vcpu-lg should do the same thing, no? Rusty, -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 01/16] introduce vcpu struct
this patch introduces a vcpu struct for lguest. In upcoming patches, more and more fields will be moved from the lguest struct to the vcpu Signed-off-by: Glauber de Oliveira Costa <[EMAIL PROTECTED]> --- drivers/lguest/lg.h | 15 +++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h index 8692489..9723732 100644 --- a/drivers/lguest/lg.h +++ b/drivers/lguest/lg.h @@ -38,6 +38,13 @@ struct lguest_pages #define CHANGED_GDT_TLS4 /* Actually a subset of CHANGED_GDT */ #define CHANGED_ALL3 +struct lguest; + +struct lguest_vcpu { + int vcpu_id; + struct lguest *lg; +}; + /* The private info the thread maintains about the guest. */ struct lguest { @@ -47,6 +54,9 @@ struct lguest struct lguest_data __user *lguest_data; struct task_struct *tsk; struct mm_struct *mm; /* == tsk->mm, but that becomes NULL on exit */ + struct lguest_vcpu vcpus[NR_CPUS]; + unsigned int nr_vcpus; + u32 pfn_limit; /* This provides the offset to the base of guest-physical * memory in the Launcher. */ @@ -92,6 +102,11 @@ struct lguest DECLARE_BITMAP(irqs_pending, LGUEST_IRQS); }; +static inline struct lguest *lg_of_vcpu(struct lguest_vcpu *vcpu) +{ + return container_of((vcpu - vcpu->vcpu_id), struct lguest, vcpus[0]); +} + extern struct mutex lguest_lock; /* core.c: */ -- 1.5.0.6 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 01/16] introduce vcpu struct
this patch introduces a vcpu struct for lguest. In upcoming patches, more and more fields will be moved from the lguest struct to the vcpu Signed-off-by: Glauber de Oliveira Costa [EMAIL PROTECTED] --- drivers/lguest/lg.h | 15 +++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h index 8692489..9723732 100644 --- a/drivers/lguest/lg.h +++ b/drivers/lguest/lg.h @@ -38,6 +38,13 @@ struct lguest_pages #define CHANGED_GDT_TLS4 /* Actually a subset of CHANGED_GDT */ #define CHANGED_ALL3 +struct lguest; + +struct lguest_vcpu { + int vcpu_id; + struct lguest *lg; +}; + /* The private info the thread maintains about the guest. */ struct lguest { @@ -47,6 +54,9 @@ struct lguest struct lguest_data __user *lguest_data; struct task_struct *tsk; struct mm_struct *mm; /* == tsk-mm, but that becomes NULL on exit */ + struct lguest_vcpu vcpus[NR_CPUS]; + unsigned int nr_vcpus; + u32 pfn_limit; /* This provides the offset to the base of guest-physical * memory in the Launcher. */ @@ -92,6 +102,11 @@ struct lguest DECLARE_BITMAP(irqs_pending, LGUEST_IRQS); }; +static inline struct lguest *lg_of_vcpu(struct lguest_vcpu *vcpu) +{ + return container_of((vcpu - vcpu-vcpu_id), struct lguest, vcpus[0]); +} + extern struct mutex lguest_lock; /* core.c: */ -- 1.5.0.6 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/