* [PATCH 5 of 6] unplug emulated devices
@ 2010-04-22 15:16 Stefano Stabellini
2010-04-22 21:02 ` Konrad Rzeszutek Wilk
0 siblings, 1 reply; 3+ messages in thread
From: Stefano Stabellini @ 2010-04-22 15:16 UTC (permalink / raw)
To: xen-devel
Hi all,
this patch adds a xen_unplug command line option to the kernel to unplug
xen emulated devices.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
arch/x86/xen/enlighten.c | 30 +++++++++++++++++++++++++++++-
1 files changed, 29 insertions(+), 1 deletions(-)
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 2ce2da1..7acb130 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -37,6 +37,7 @@
#include <xen/interface/memory.h>
#include <xen/interface/hvm/hvm_op.h>
#include <xen/interface/hvm/params.h>
+#include <xen/interface/platform_pci.h>
#include <xen/features.h>
#include <xen/page.h>
#include <xen/hvm.h>
@@ -86,6 +87,7 @@ struct shared_info xen_dummy_shared_info;
void *xen_initial_gdt;
int xen_have_vector_callback;
+int unplug;
/*
* Point at some empty memory to start with. We map the real shared_info
@@ -1389,9 +1391,35 @@ void __init xen_guest_init(void)
x86_platform_ipi_callback = do_hvm_pv_evtchn_intr;
xen_have_vector_callback = 1;
}
-
+ if (unplug) {
+ /* unplug emulated devices */
+ outw(UNPLUG_ALL, XEN_IOPORT_UNPLUG);
+ }
have_vcpu_info_placement = 0;
x86_init.irqs.intr_init = xen_init_IRQ;
machine_ops = xen_machine_ops;
}
+static int __init parse_unplug(char *arg)
+{
+ char *p, *q;
+
+ for (p = arg; p; p = q) {
+ q = strchr(arg, ',');
+ if (q)
+ *q++ = '\0';
+ if (!strcmp(p, "all"))
+ unplug |= UNPLUG_ALL;
+ else if (!strcmp(p, "ide-disks"))
+ unplug |= UNPLUG_ALL_IDE_DISKS;
+ else if (!strcmp(p, "aux-ide-disks"))
+ unplug |= UNPLUG_AUX_IDE_DISKS;
+ else if (!strcmp(p, "nics"))
+ unplug |= UNPLUG_ALL_NICS;
+ else
+ printk(KERN_WARNING "unrecognised option '%s' "
+ "in module parameter 'dev_unplug'\n", p);
+ }
+ return 0;
+}
+early_param("xen_unplug", parse_unplug);
--
1.5.4.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 5 of 6] unplug emulated devices
2010-04-22 15:16 [PATCH 5 of 6] unplug emulated devices Stefano Stabellini
@ 2010-04-22 21:02 ` Konrad Rzeszutek Wilk
2010-04-23 15:32 ` Stefano Stabellini
0 siblings, 1 reply; 3+ messages in thread
From: Konrad Rzeszutek Wilk @ 2010-04-22 21:02 UTC (permalink / raw)
To: Stefano Stabellini; +Cc: xen-devel
On Thu, Apr 22, 2010 at 04:16:50PM +0100, Stefano Stabellini wrote:
> Hi all,
> this patch adds a xen_unplug command line option to the kernel to unplug
> xen emulated devices.
For those folks who don't understand the pain^H^H^Htransition from emulated device
to a PV device, can you do a more detailed writeup?
Why don't we want this be enabled by default? Perhaps you want to make
the parameter only parse the disable option - devices which we _dont_
want to be unplugged. So paramter name would 'xen_keep_plugged='.
>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
>
> ---
> arch/x86/xen/enlighten.c | 30 +++++++++++++++++++++++++++++-
> 1 files changed, 29 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
> index 2ce2da1..7acb130 100644
> --- a/arch/x86/xen/enlighten.c
> +++ b/arch/x86/xen/enlighten.c
> @@ -37,6 +37,7 @@
> #include <xen/interface/memory.h>
> #include <xen/interface/hvm/hvm_op.h>
> #include <xen/interface/hvm/params.h>
> +#include <xen/interface/platform_pci.h>
> #include <xen/features.h>
> #include <xen/page.h>
> #include <xen/hvm.h>
> @@ -86,6 +87,7 @@ struct shared_info xen_dummy_shared_info;
> void *xen_initial_gdt;
>
> int xen_have_vector_callback;
> +int unplug;
>
> /*
> * Point at some empty memory to start with. We map the real shared_info
> @@ -1389,9 +1391,35 @@ void __init xen_guest_init(void)
> x86_platform_ipi_callback = do_hvm_pv_evtchn_intr;
> xen_have_vector_callback = 1;
> }
> -
> + if (unplug) {
> + /* unplug emulated devices */
> + outw(UNPLUG_ALL, XEN_IOPORT_UNPLUG);
> + }
> have_vcpu_info_placement = 0;
> x86_init.irqs.intr_init = xen_init_IRQ;
> machine_ops = xen_machine_ops;
> }
>
> +static int __init parse_unplug(char *arg)
> +{
> + char *p, *q;
> +
> + for (p = arg; p; p = q) {
> + q = strchr(arg, ',');
> + if (q)
> + *q++ = '\0';
> + if (!strcmp(p, "all"))
> + unplug |= UNPLUG_ALL;
> + else if (!strcmp(p, "ide-disks"))
> + unplug |= UNPLUG_ALL_IDE_DISKS;
> + else if (!strcmp(p, "aux-ide-disks"))
> + unplug |= UNPLUG_AUX_IDE_DISKS;
> + else if (!strcmp(p, "nics"))
> + unplug |= UNPLUG_ALL_NICS;
> + else
> + printk(KERN_WARNING "unrecognised option '%s' "
> + "in module parameter 'dev_unplug'\n", p);
> + }
> + return 0;
> +}
> +early_param("xen_unplug", parse_unplug);
> --
> 1.5.4.3
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 5 of 6] unplug emulated devices
2010-04-22 21:02 ` Konrad Rzeszutek Wilk
@ 2010-04-23 15:32 ` Stefano Stabellini
0 siblings, 0 replies; 3+ messages in thread
From: Stefano Stabellini @ 2010-04-23 15:32 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk; +Cc: xen-devel@lists.xensource.com, Stefano Stabellini
On Thu, 22 Apr 2010, Konrad Rzeszutek Wilk wrote:
> On Thu, Apr 22, 2010 at 04:16:50PM +0100, Stefano Stabellini wrote:
> > Hi all,
> > this patch adds a xen_unplug command line option to the kernel to unplug
> > xen emulated devices.
>
> For those folks who don't understand the pain^H^H^Htransition from emulated device
> to a PV device, can you do a more detailed writeup?
>
When the guest loads, if pv drivers are available, the guest is supposed
to unplug the emulated disks and network cards before initializing the pv
drivers.
> Why don't we want this be enabled by default? Perhaps you want to make
> the parameter only parse the disable option - devices which we _dont_
> want to be unplugged. So paramter name would 'xen_keep_plugged='.
If the kernel is configured correctly and pv drivers are present, we
definitely want to unplug the emulated devices, however this might imply
that other command line options to the kernel must be changed as well.
For example if before you had: root=/dev/hda1
with pv drivers you need: root=/dev/xvda1
Besides qemu offers an unplug interface rather than a keep_plugged
interface so it came natural to export an unplug interface as well...
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-04-23 15:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-22 15:16 [PATCH 5 of 6] unplug emulated devices Stefano Stabellini
2010-04-22 21:02 ` Konrad Rzeszutek Wilk
2010-04-23 15:32 ` Stefano Stabellini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.