Glauber de Oliveira Costa
2007-Dec-20 05:33 UTC
[PATCH 0/16] lguest: introduce vcpu structure
this patch makes room for the vcpu structure in lguest, already used in this very same way at lguest64. It's the first part of our plan to have lguest and lguest64 unified too. When two dogs hang out, you don't have new puppies right in the other day. Some time has to be elapsed. They have to grow first. In this same spirit, having these patches _do not_ mean smp guests can be launched (yet) Much more work is to come, but this is the basic infrastructure. Enjoy
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 <gcosta@redhat.com> --- 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_TLS 4 /* Actually a subset of CHANGED_GDT */ #define CHANGED_ALL 3 +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
On Friday 21 December 2007 00:33:40 Glauber de Oliveira Costa wrote:> this patch makes room for the vcpu structure in lguest, already used in > this very same way at lguest64. It's the first part of our plan to > have lguest and lguest64 unified too.Hi Glauber! These patches look really solid, thanks! A few minor things, then I'll apply them and push them for 2.6.25. My only question is whether we should go further and vpu-ify routines like lgread and kill_guest, so that we can avoid more "lg" temporary variables...> When two dogs hang out, you don't have new puppies right in the other day. > Some time has to be elapsed. They have to grow first. In this same spirit, > having these patches _do not_ mean smp guests can be launched (yet) > Much more work is to come, but this is the basic infrastructure.OK, that made me laugh... Thanks! Rusty.
On Wed, 26 Dec 2007, Rusty Russell wrote:> On Friday 21 December 2007 00:33:42 Glauber de Oliveira Costa wrote: > > + if (!vcpu_id) { > > + /* > > + * Service input, then unset the BREAK to > > + * release the Waker. > > + */ > > + handle_input(lguest_fd); > > + if (pwrite(lguest_fd, args, sizeof(args), 0) < 0) > > + err(1, "Resetting break"); > > + } > > I hate winged comments: those two extra lines, wasted! >For multiple lines, wings are a Good Thing (TM). Otherwise it looks sloppy. /* Service input, then unset the BREAK to * release the Waker. */ extra asterisk! ok then /* Service input, then unset the BREAK to release the Waker. */ Yuck, that "release" looks like it can be code, especially with parsers that look for comments that start with some sort of /* or * Those little wings do IMHO make the code look nicer. I know in the Linux community, my weight compared to you is a chihuahua compared to a St. Bernard. But in this case, I believe others think that my collar is prettier than yours. ;-) Some one buy Rusty a bigger hard-drive to store those extra lines. -- Steve
Glauber de Oliveira Costa
2008-Jan-07 05:05 UTC
[PATCH 0/16 -v2] lguest smp infrastructure
Folks, This new series is not at all fundamentally different from the old one I sent. Only difference is that I address the comments received, mainly from Rusty. enjoy!
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 <gcosta@redhat.com> --- 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_TLS 4 /* Actually a subset of CHANGED_GDT */ #define CHANGED_ALL 3 +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
Reasonably Related Threads
- [PATCH 0/16] lguest: introduce vcpu structure
- [PATCH 0/7] Modify lguest32 to make room for lguest64
- [PATCH 0/7] Modify lguest32 to make room for lguest64
- [PATCH 0/5 -v2] Modify lguest32 to make room for lguest64 (version 2)
- [PATCH 0/5 -v2] Modify lguest32 to make room for lguest64 (version 2)