All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] serial: DCC(JTAG) serial and console emulation support
From: Mike Frysinger @ 2010-10-07 20:02 UTC (permalink / raw)
  To: Daniel Walker
  Cc: linux-kernel, Hyok S. Choi, Tony Lindgren, Jeff Ohlstein,
	Greg Kroah-Hartman, Ben Dooks, Alan Cox, Kukjin Kim, Feng Tang,
	Tobias Klauser, Jason Wessel, Philippe Langlais
In-Reply-To: <1286481532.23836.27.camel@c-dwalke-linux.qualcomm.com>

On Thu, Oct 7, 2010 at 15:58, Daniel Walker wrote:
> On Thu, 2010-10-07 at 15:48 -0400, Mike Frysinger wrote:
>> i dont think hijacking the "ttyS" namespace is acceptable, even if
>> it's behind a Kconfig.  other people have tried in the past (myself
>> included) and been shot down.  sounds like a shim for crappy userspace
>> apps that blindly assume /dev/ttyS*.  is that really an issue anymore
>> though now that things like /dev/ttyUSB* are so common and people are
>> used to picking between multiple serial sources ?
>
> It also creates a ttyJ* which uses the same interfaces as the code for
> ttyS* .. I don't think allowing a Kconfig option to shim this in as a
> ttyS* is all that bad .. This driver is only going to be used in rare
> cases for debugging , having a ttyS* is just a level of flexibility ..

how is that any different from:
ln -s ttyJ0 /dev/ttyS0
-mike

^ permalink raw reply

* Re: [PATCH v1 14/16] OMAP3: hwmod DSS: DSI Move init, exit to driver
From: Thomas Petazzoni @ 2010-10-07 20:00 UTC (permalink / raw)
  To: Guruswamy Senthilvadivu
  Cc: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap
In-Reply-To: <1286363699-9614-15-git-send-email-svadivu@ti.com>

Hello Senthil,

On Wed,  6 Oct 2010 16:44:57 +0530
Guruswamy Senthilvadivu <svadivu@ti.com> wrote:

> Move init exit methods to its driver probe, remove.
> pdev member has to be maintained by its own drivers.
> regulator has to be privately handled in each driver.

Same comments than the one for patch 13/16 about the contents of
->probe() and ->remove() methods, and the auxilliary dsi_get_vdds_dsi()
function.

Regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply

* Re: [PATCH] ACPI: Read TSC upon resume
From: Rafael J. Wysocki @ 2010-10-07 19:59 UTC (permalink / raw)
  To: Sameer Nanda
  Cc: Greg KH, lenb, stefan.bader, brad.figg, apw, linux-acpi,
	linux-kernel
In-Reply-To: <AANLkTi=mjaojm-O2rbKRTpsqpKiSKjU+P2dGZmENd-jU@mail.gmail.com>

On Thursday, October 07, 2010, Sameer Nanda wrote:
> (resending as plain text, sorry if you got dupe messages)
> 
> On Wed, Oct 6, 2010 at 7:19 PM, Greg KH <gregkh@suse.de> wrote:
> > On Wed, Oct 06, 2010 at 04:15:19PM -0700, Sameer Nanda wrote:
> >> Read the TSC upon resuming and print it out. This is useful
> >> in helping figure out amount of time spent in the BIOS when
> >> resuming from suspend.
> >>
> >> Change-Id: I1d6a32bd62421becddecd152d561763e5f3e1101
> >
> > What is this tag for?  I don't think it matches anything the kernel
> > community wants, do you?
> 
> Yeah, its not needed.  Let me resubmit the patch without this tag.
> 
> >
> > And are you always going to be printing this out?  Why do we want to
> > know this every time?
> 
> Yes, every time.  This helps track variance in BIOS resume times
> within a single boot.
> 
> >
> >> Signed-off-by: Sameer Nanda <snanda@chromium.org>
> >> ---
> >>  drivers/acpi/sleep.c |    4 ++++
> >>  1 files changed, 4 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
> >> index c0fed2e..f0588fa 100644
> >> --- a/drivers/acpi/sleep.c
> >> +++ b/drivers/acpi/sleep.c
> >> @@ -214,6 +214,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
> >>       acpi_status status = AE_OK;
> >>       unsigned long flags = 0;
> >>       u32 acpi_state = acpi_target_sleep_state;
> >> +     u64 tsc;
> >>
> >>       ACPI_FLUSH_CPU_CACHE();
> >>
> >> @@ -235,6 +236,9 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
> >>
> >>       case ACPI_STATE_S3:
> >>               do_suspend_lowlevel();
> >> +             rdtscll(tsc);
> >> +             printk(KERN_INFO "TSC at resume: %llu\n",
> >> +                             (unsigned long long)tsc);
> >
> > How long does this take, will it slow down resume?
> 
> The impact is ~10us (as measured on an Intel Atom N455 @ 1.66Ghz).
> Given that resume time is currently of the order of 1sec, its in the
> noise range.

Do I think correctly that it assumes the TSC will be updated in the sleep state?

Rafael

^ permalink raw reply

* Re: [KVM_AUTOTEST][RFC 0/3]: QMP basic test-suite
From: Luiz Capitulino @ 2010-10-07 19:59 UTC (permalink / raw)
  To: Luiz Capitulino; +Cc: autotest, kvm, lmr, ehabkost, armbru
In-Reply-To: <1286481127-24640-1-git-send-email-lcapitulino@redhat.com>

On Thu,  7 Oct 2010 16:52:04 -0300
Luiz Capitulino <lcapitulino@redhat.com> wrote:

> This series is an _initial_ work on having a full QMP test-suite in
> kvm-autotest. I think it's very near of being in a mergeable state, but I
> figured it would be a good idea to get some feedback before submitting the
> final version.

Cool, autotest list is closed for non-subscribers. Adding this info to the
kvm-autotest wiki page.

^ permalink raw reply

* [PATCH 1/3] Powerpc/4xx: Add suspend and idle support
From: Victor Gallardo @ 2010-10-07 19:07 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Victor Gallardo

Add suspend/resume support for all 4xx compatible CPUs.
See /sys/power/state for available power states configured in.

Add two different idle states (idle-wait and idle-doze)
controlled via sysfs. Default is idle-wait.
	cat /sys/devices/system/cpu/cpu0/idle
	[wait] doze

To save additional power, use idle-doze.
	echo doze > /sys/devices/system/cpu/cpu0/idle
	cat /sys/devices/system/cpu/cpu0/idle
	wait [doze]

Signed-off-by: Victor Gallardo <vgallardo@apm.com>
---
 Documentation/powerpc/dts-bindings/4xx/cpm.txt |   43 +++
 arch/powerpc/Kconfig                           |   13 +-
 arch/powerpc/platforms/44x/Makefile            |    5 +-
 arch/powerpc/sysdev/Makefile                   |    1 +
 arch/powerpc/sysdev/ppc4xx_cpm.c               |  339 ++++++++++++++++++++++++
 5 files changed, 397 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/powerpc/dts-bindings/4xx/cpm.txt
 create mode 100644 arch/powerpc/sysdev/ppc4xx_cpm.c

diff --git a/Documentation/powerpc/dts-bindings/4xx/cpm.txt b/Documentation/powerpc/dts-bindings/4xx/cpm.txt
new file mode 100644
index 0000000..9635df8
--- /dev/null
+++ b/Documentation/powerpc/dts-bindings/4xx/cpm.txt
@@ -0,0 +1,43 @@
+PPC4xx Clock Power Management (CPM) node
+
+Required properties:
+	- compatible		: compatible list, currently only "ibm,cpm"
+	- dcr-access-method	: "native"
+	- dcr-reg		: < DCR register range >
+
+Optional properties:
+	- er-offset		: All 4xx SoCs with a CPM controller have
+				  one of two different order for the CPM
+				  registers. Some have the CPM registers
+				  in the following order (ER,FR,SR). The
+				  others have them in the following order
+				  (SR,ER,FR). For the second case set
+				  er-offset = <1>.
+	- unused-units		: specifier consist of one cell. For each
+				  bit in the cell, the corresponding bit
+				  in CPM will be set to turn off unused
+				  devices.
+	- idle-doze		: specifier consist of one cell. For each
+				  bit in the cell, the corresponding bit
+				  in CPM will be set to turn off unused
+				  devices. This is usually just CPM[CPU].
+	- standby		: specifier consist of one cell. For each
+				  bit in the cell, the corresponding bit
+				  in CPM will be set on standby and
+				  restored on resume.
+	- suspend		: specifier consist of one cell. For each
+				  bit in the cell, the corresponding bit
+				  in CPM will be set on suspend (mem) and
+				  restored on resume.
+
+Example:
+        CPM0: cpm {
+                compatible = "ibm,cpm";
+                dcr-access-method = "native";
+                dcr-reg = <0x160 0x003>;
+		er-offset = <0>;
+                unused-units = <0x00000100>;
+                idle-doze = <0x02000000>;
+                standby = <0xfeff0000>;
+                standby = <0xfeff791d>;
+        };
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 631e5a0..10b2f15 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -210,7 +210,7 @@ config ARCH_HIBERNATION_POSSIBLE
 config ARCH_SUSPEND_POSSIBLE
 	def_bool y
 	depends on ADB_PMU || PPC_EFIKA || PPC_LITE5200 || PPC_83xx || \
-		   PPC_85xx || PPC_86xx || PPC_PSERIES
+		   PPC_85xx || PPC_86xx || PPC_PSERIES || 44x || 40x
 
 config PPC_DCR_NATIVE
 	bool
@@ -596,13 +596,11 @@ config EXTRA_TARGETS
 
 	  If unsure, leave blank
 
-if !44x || BROKEN
 config ARCH_WANTS_FREEZER_CONTROL
 	def_bool y
 	depends on ADB_PMU
 
 source kernel/power/Kconfig
-endif
 
 config SECCOMP
 	bool "Enable seccomp to safely compute untrusted bytecode"
@@ -683,6 +681,15 @@ config FSL_PMC
 	  Freescale MPC85xx/MPC86xx power management controller support
 	  (suspend/resume). For MPC83xx see platforms/83xx/suspend.c
 
+config PPC4xx_CPM
+	bool
+	default y
+	depends on SUSPEND && (44x || 40x)
+	help
+	  PPC4xx Clock Power Management (CPM) support (suspend/resume).
+	  It also enables support for two different idle states (idle-wait
+	  and idle-doze).
+
 config 4xx_SOC
 	bool
 
diff --git a/arch/powerpc/platforms/44x/Makefile b/arch/powerpc/platforms/44x/Makefile
index 82ff326..c04d16d 100644
--- a/arch/powerpc/platforms/44x/Makefile
+++ b/arch/powerpc/platforms/44x/Makefile
@@ -1,4 +1,7 @@
-obj-$(CONFIG_44x)	:= misc_44x.o idle.o
+obj-$(CONFIG_44x)	+= misc_44x.o
+ifneq ($(CONFIG_PPC4xx_CPM),y)
+obj-$(CONFIG_44x)	+= idle.o
+endif
 obj-$(CONFIG_PPC44x_SIMPLE) += ppc44x_simple.o
 obj-$(CONFIG_EBONY)	+= ebony.o
 obj-$(CONFIG_SAM440EP) 	+= sam440ep.o
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index 5642924..a9728d1 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -42,6 +42,7 @@ obj-$(CONFIG_OF_RTC)		+= of_rtc.o
 ifeq ($(CONFIG_PCI),y)
 obj-$(CONFIG_4xx)		+= ppc4xx_pci.o
 endif
+obj-$(CONFIG_PPC4xx_CPM)	+= ppc4xx_cpm.o
 obj-$(CONFIG_PPC4xx_GPIO)	+= ppc4xx_gpio.o
 
 obj-$(CONFIG_CPM)		+= cpm_common.o
diff --git a/arch/powerpc/sysdev/ppc4xx_cpm.c b/arch/powerpc/sysdev/ppc4xx_cpm.c
new file mode 100644
index 0000000..d47a7ed
--- /dev/null
+++ b/arch/powerpc/sysdev/ppc4xx_cpm.c
@@ -0,0 +1,339 @@
+/*
+ * PowerPC 4xx Clock and Power Management
+ *
+ * Copyright (C) 2010, Applied Micro Circuits Corporation
+ * Victor Gallardo (vgallardo@apm.com)
+ *
+ * Based on arch/powerpc/platforms/44x/idle.c:
+ * Jerone Young <jyoung5@us.ibm.com>
+ * Copyright 2008 IBM Corp.
+ *
+ * Based on arch/powerpc/sysdev/fsl_pmc.c:
+ * Anton Vorontsov <avorontsov@ru.mvista.com>
+ * Copyright 2009  MontaVista Software, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <linux/kernel.h>
+#include <linux/of_platform.h>
+#include <linux/sysfs.h>
+#include <linux/cpu.h>
+#include <linux/suspend.h>
+#include <asm/dcr.h>
+#include <asm/dcr-native.h>
+#include <asm/machdep.h>
+
+#define CPM_ER	0
+#define CPM_FR	1
+#define CPM_SR	2
+
+#define CPM_IDLE_WAIT	0
+#define CPM_IDLE_DOZE	1
+
+struct cpm {
+	dcr_host_t	dcr_host;
+	unsigned int	dcr_offset[3];
+	unsigned int	powersave_off;
+	unsigned int	unused;
+	unsigned int	idle_doze;
+	unsigned int	standby;
+	unsigned int	suspend;
+};
+
+static struct cpm cpm;
+
+struct cpm_idle_mode {
+	unsigned int enabled;
+	const char  *name;
+};
+
+static struct cpm_idle_mode idle_mode[] = {
+	[CPM_IDLE_WAIT] = { 1, "wait" }, /* default */
+	[CPM_IDLE_DOZE] = { 0, "doze" },
+};
+
+static void cpm_set(unsigned int cpm_reg, unsigned int mask)
+{
+	unsigned int value;
+
+	value = dcr_read(cpm.dcr_host, cpm.dcr_offset[cpm_reg]);
+	value |= mask;
+	dcr_write(cpm.dcr_host, cpm.dcr_offset[cpm_reg], value);
+}
+
+static void cpm_idle_wait(void)
+{
+	unsigned long msr_save;
+
+	/* save off initial state */
+	msr_save = mfmsr();
+	/* sync required when CPM0_ER[CPU] is set */
+	mb();
+	/* set wait state MSR */
+	mtmsr(msr_save|MSR_WE|MSR_EE|MSR_CE|MSR_DE);
+	isync();
+	/* return to initial state */
+	mtmsr(msr_save);
+	isync();
+}
+
+static void cpm_idle_sleep(unsigned int mask)
+{
+	unsigned int er_save;
+
+	/* update CPM_ER state */
+	er_save = dcr_read(cpm.dcr_host, cpm.dcr_offset[CPM_ER]);
+	dcr_write(cpm.dcr_host, cpm.dcr_offset[CPM_ER],
+		  er_save | mask);
+
+	/* go to wait state */
+	cpm_idle_wait();
+
+	/* restore CPM_ER state */
+	dcr_write(cpm.dcr_host, cpm.dcr_offset[CPM_ER], er_save);
+}
+
+static void cpm_idle_doze(void)
+{
+	cpm_idle_sleep(cpm.idle_doze);
+}
+
+static void cpm_idle_config(int mode)
+{
+	int i;
+
+	if (idle_mode[mode].enabled)
+		return;
+
+	for (i = 0; i < ARRAY_SIZE(idle_mode); i++)
+		idle_mode[i].enabled = 0;
+
+	idle_mode[mode].enabled = 1;
+}
+
+static ssize_t cpm_idle_show(struct kobject *kobj,
+			     struct kobj_attribute *attr, char *buf)
+{
+	char *s = buf;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(idle_mode); i++) {
+		if (idle_mode[i].enabled)
+			s += sprintf(s, "[%s] ", idle_mode[i].name);
+		else
+			s += sprintf(s, "%s ", idle_mode[i].name);
+	}
+
+	*(s-1) = '\n'; /* convert the last space to a newline */
+
+	return s - buf;
+}
+
+static ssize_t cpm_idle_store(struct kobject *kobj,
+			      struct kobj_attribute *attr,
+			      const char *buf, size_t n)
+{
+	int i;
+	char *p;
+	int len;
+
+	p = memchr(buf, '\n', n);
+	len = p ? p - buf : n;
+
+	for (i = 0; i < ARRAY_SIZE(idle_mode); i++) {
+		if (strncmp(buf, idle_mode[i].name, len) == 0) {
+			cpm_idle_config(i);
+			return n;
+		}
+	}
+
+	return -EINVAL;
+}
+
+static struct kobj_attribute cpm_idle_attr =
+	__ATTR(idle, 0644, cpm_idle_show, cpm_idle_store);
+
+static void cpm_idle_config_sysfs(void)
+{
+	struct sys_device *sys_dev;
+	unsigned long ret;
+
+	sys_dev = get_cpu_sysdev(0);
+
+	ret = sysfs_create_file(&sys_dev->kobj,
+				&cpm_idle_attr.attr);
+	if (ret)
+		printk(KERN_WARNING
+		       "cpm: failed to create idle sysfs entry\n");
+}
+
+static void cpm_idle(void)
+{
+	if (idle_mode[CPM_IDLE_DOZE].enabled)
+		cpm_idle_doze();
+	else
+		cpm_idle_wait();
+}
+
+static int cpm_suspend_valid(suspend_state_t state)
+{
+	switch (state) {
+	case PM_SUSPEND_STANDBY:
+		return !!cpm.standby;
+	case PM_SUSPEND_MEM:
+		return !!cpm.suspend;
+	default:
+		return 0;
+	}
+}
+
+static void cpm_suspend_standby(unsigned int mask)
+{
+	unsigned long tcr_save;
+
+	/* disable decrement interrupt */
+	tcr_save = mfspr(SPRN_TCR);
+	mtspr(SPRN_TCR, tcr_save & ~TCR_DIE);
+
+	/* go to sleep state */
+	cpm_idle_sleep(mask);
+
+	/* restore decrement interrupt */
+	mtspr(SPRN_TCR, tcr_save);
+}
+
+static int cpm_suspend_enter(suspend_state_t state)
+{
+	switch (state) {
+	case PM_SUSPEND_STANDBY:
+		cpm_suspend_standby(cpm.standby);
+		break;
+	case PM_SUSPEND_MEM:
+		cpm_suspend_standby(cpm.suspend);
+		break;
+	}
+
+	return 0;
+}
+
+static struct platform_suspend_ops cpm_suspend_ops = {
+	.valid		= cpm_suspend_valid,
+	.enter		= cpm_suspend_enter,
+};
+
+static int cpm_get_uint_property(struct device_node *np,
+				 const char *name)
+{
+	int len;
+	const unsigned int *prop = of_get_property(np, name, &len);
+
+	if (prop == NULL || len < sizeof(u32))
+		return 0;
+
+	return *prop;
+}
+
+static int __init cpm_init(void)
+{
+	struct device_node *np;
+	int dcr_base, dcr_len;
+	int ret = 0;
+
+	if (!cpm.powersave_off) {
+		cpm_idle_config(CPM_IDLE_WAIT);
+		ppc_md.power_save = &cpm_idle;
+	}
+
+	np = of_find_compatible_node(NULL, NULL, "ibm,cpm");
+	if (!np) {
+		ret = -EINVAL;
+		goto out;
+	}
+
+	dcr_base = dcr_resource_start(np, 0);
+	dcr_len = dcr_resource_len(np, 0);
+
+	if (dcr_base == 0 || dcr_len == 0) {
+		printk(KERN_ERR "cpm: could not parse dcr property for %s\n",
+		       np->full_name);
+		ret = -EINVAL;
+		goto out;
+	}
+
+	cpm.dcr_host = dcr_map(np, dcr_base, dcr_len);
+
+	if (!DCR_MAP_OK(cpm.dcr_host)) {
+		printk(KERN_ERR "cpm: failed to map dcr property for %s\n",
+		       np->full_name);
+		ret = -EINVAL;
+		goto out;
+	}
+
+	/* All 4xx SoCs with a CPM controller have one of two
+	 * different order for the CPM registers. Some have the
+	 * CPM registers in the following order (ER,FR,SR). The
+	 * others have them in the following order (SR,ER,FR).
+	 */
+
+	if (cpm_get_uint_property(np, "er-offset") == 0) {
+		cpm.dcr_offset[CPM_ER] = 0;
+		cpm.dcr_offset[CPM_FR] = 1;
+		cpm.dcr_offset[CPM_SR] = 2;
+	} else {
+		cpm.dcr_offset[CPM_ER] = 1;
+		cpm.dcr_offset[CPM_FR] = 2;
+		cpm.dcr_offset[CPM_SR] = 0;
+	}
+
+	/* Now let's see what IPs to turn off for the following modes */
+
+	cpm.unused = cpm_get_uint_property(np, "unused-units");
+	cpm.idle_doze = cpm_get_uint_property(np, "idle-doze");
+	cpm.standby = cpm_get_uint_property(np, "standby");
+	cpm.suspend = cpm_get_uint_property(np, "suspend");
+
+	/* If some IPs are unused let's turn them off now */
+
+	if (cpm.unused) {
+		cpm_set(CPM_ER, cpm.unused);
+		cpm_set(CPM_FR, cpm.unused);
+	}
+
+	/* Now let's export interfaces */
+
+	if (!cpm.powersave_off && cpm.idle_doze)
+		cpm_idle_config_sysfs();
+
+	if (cpm.standby || cpm.suspend)
+		suspend_set_ops(&cpm_suspend_ops);
+out:
+	if (np)
+		of_node_put(np);
+	return ret;
+}
+
+late_initcall(cpm_init);
+
+static int __init cpm_powersave_off(char *arg)
+{
+	cpm.powersave_off = 1;
+	return 0;
+}
+__setup("powersave=off", cpm_powersave_off);
-- 
1.6.1.rc3

^ permalink raw reply related

* [PATCH 2/3] powerpc/4xx: Add Canyonlands suspend and idle support
From: Victor Gallardo @ 2010-10-07 19:07 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Victor Gallardo

- Add Clock Power Management (CPM) node to dts tree
- Add idle-doze entry in CPM node
- Add standby entry in CPM node
- Add PM and SUSPEND support by default in defconfig
- Remove UART2 and UART3 as they are unused, this will
  CPM to put unused-units (UART2 and UART3) to sleep.

Signed-off-by: Victor Gallardo <vgallardo@apm.com>
---
 arch/powerpc/boot/dts/canyonlands.dts          |   31 +++++++-----------------
 arch/powerpc/configs/44x/canyonlands_defconfig |    3 ++
 2 files changed, 12 insertions(+), 22 deletions(-)

diff --git a/arch/powerpc/boot/dts/canyonlands.dts b/arch/powerpc/boot/dts/canyonlands.dts
index a303703..5b27a4b 100644
--- a/arch/powerpc/boot/dts/canyonlands.dts
+++ b/arch/powerpc/boot/dts/canyonlands.dts
@@ -105,6 +105,15 @@
 		dcr-reg = <0x00c 0x002>;
 	};
 
+	CPM0: cpm {
+		compatible = "ibm,cpm";
+		dcr-access-method = "native";
+		dcr-reg = <0x160 0x003>;
+		unused-units = <0x00000100>;
+		idle-doze = <0x02000000>;
+		standby = <0xfeff791d>;
+	};
+
 	L2C0: l2c {
 		compatible = "ibm,l2-cache-460ex", "ibm,l2-cache";
 		dcr-reg = <0x020 0x008		/* Internal SRAM DCR's */
@@ -270,28 +279,6 @@
 				interrupts = <0x1 0x4>;
 			};
 
-			UART2: serial@ef600500 {
-				device_type = "serial";
-				compatible = "ns16550";
-				reg = <0xef600500 0x00000008>;
-				virtual-reg = <0xef600500>;
-				clock-frequency = <0>; /* Filled in by U-Boot */
-				current-speed = <0>; /* Filled in by U-Boot */
-				interrupt-parent = <&UIC1>;
-				interrupts = <28 0x4>;
-			};
-
-			UART3: serial@ef600600 {
-				device_type = "serial";
-				compatible = "ns16550";
-				reg = <0xef600600 0x00000008>;
-				virtual-reg = <0xef600600>;
-				clock-frequency = <0>; /* Filled in by U-Boot */
-				current-speed = <0>; /* Filled in by U-Boot */
-				interrupt-parent = <&UIC1>;
-				interrupts = <29 0x4>;
-			};
-
 			IIC0: i2c@ef600700 {
 				compatible = "ibm,iic-460ex", "ibm,iic";
 				reg = <0xef600700 0x00000014>;
diff --git a/arch/powerpc/configs/44x/canyonlands_defconfig b/arch/powerpc/configs/44x/canyonlands_defconfig
index 45c64d8..17e4dd9 100644
--- a/arch/powerpc/configs/44x/canyonlands_defconfig
+++ b/arch/powerpc/configs/44x/canyonlands_defconfig
@@ -42,6 +42,9 @@ CONFIG_MTD_PHYSMAP_OF=y
 CONFIG_MTD_NAND=y
 CONFIG_MTD_NAND_NDFC=y
 CONFIG_PROC_DEVICETREE=y
+CONFIG_PM=y
+CONFIG_SUSPEND=y
+CONFIG_PPC4xx_CPM=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_SIZE=35000
 # CONFIG_MISC_DEVICES is not set
-- 
1.6.1.rc3

^ permalink raw reply related

* [PATCH 3/3] powerpc/4xx: Add Kilauea suspend and idle support
From: Victor Gallardo @ 2010-10-07 19:07 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Victor Gallardo

- Add Clock Power Management (CPM) node to dts tree
- Add idle-doze entry in CPM node
- Add standby entry in CPM node
- Add PM and SUSPEND support by default in defconfig
- Add NO_HZ and CONFIG_HIGH_RES_TIMERS support by
  default in defconfig

Signed-off-by: Victor Gallardo <vgallardo@apm.com>
---
 arch/powerpc/boot/dts/kilauea.dts          |    9 +++++++++
 arch/powerpc/configs/40x/kilauea_defconfig |    5 +++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/boot/dts/kilauea.dts b/arch/powerpc/boot/dts/kilauea.dts
index 083e68e..89edb16 100644
--- a/arch/powerpc/boot/dts/kilauea.dts
+++ b/arch/powerpc/boot/dts/kilauea.dts
@@ -82,6 +82,15 @@
 		interrupt-parent = <&UIC0>;
 	};
 
+	CPM0: cpm {
+		compatible = "ibm,cpm";
+		dcr-access-method = "native";
+		dcr-reg = <0x0b0 0x003>;
+		unused-units = <0x00000000>;
+		idle-doze = <0x02000000>;
+		standby = <0xe3e74800>;
+	};
+
 	plb {
 		compatible = "ibm,plb-405ex", "ibm,plb4";
 		#address-cells = <1>;
diff --git a/arch/powerpc/configs/40x/kilauea_defconfig b/arch/powerpc/configs/40x/kilauea_defconfig
index 4e19ee7..34b8c1a 100644
--- a/arch/powerpc/configs/40x/kilauea_defconfig
+++ b/arch/powerpc/configs/40x/kilauea_defconfig
@@ -12,6 +12,8 @@ CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
 # CONFIG_BLK_DEV_BSG is not set
 CONFIG_KILAUEA=y
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
 # CONFIG_WALNUT is not set
 CONFIG_SPARSE_IRQ=y
 CONFIG_PCI=y
@@ -42,6 +44,9 @@ CONFIG_MTD_PHYSMAP_OF=y
 CONFIG_MTD_NAND=y
 CONFIG_MTD_NAND_NDFC=y
 CONFIG_PROC_DEVICETREE=y
+CONFIG_PM=y
+CONFIG_SUSPEND=y
+CONFIG_PPC4xx_CPM=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_SIZE=35000
 # CONFIG_MISC_DEVICES is not set
-- 
1.6.1.rc3

^ permalink raw reply related

* Re: ixgbe: normalize frag_list usage
From: Alexander Duyck @ 2010-10-07 19:59 UTC (permalink / raw)
  To: David Miller
  Cc: Kirsher, Jeffrey T, Brandeburg, Jesse, Allan, Bruce W,
	netdev@vger.kernel.org
In-Reply-To: <20101006.235837.241424681.davem@davemloft.net>

On 10/6/2010 11:58 PM, David Miller wrote:
> From: "Duyck, Alexander H"<alexander.h.duyck@intel.com>
> Date: Tue, 5 Oct 2010 15:45:32 -0700
>
>> The patch below is kind of what I had in mind for a way to do RSC and maintain
>> the pointer scheme you are looking for.  Consider this patch an RFC for now
>> since I based this off of Jeff's internal testing tree and so it would need
>> some modification to apply cleanly to net-next.
>
> Can you really not remember the head somewhere?

I can track it in the RSC_CB if that works for you.  Right now though I 
guess I am not seeing the difference between tracking this in 
skb->frag_next vs IXGBE_RSC_CB(skb)->frag_head.  I think it might help 
if you were to provide some functions that demonstrate exactly what you 
had in mind for frag list handling.  Specifically if you were to add a 
function for merging a frag into the frag list, and for how you want to 
approach cleaning up the skb->prev/frag_tail_tracker pointer when you 
are cleaning up an active frag_list.

> What I wanted is for everyone to build their frag list SKBs from head to tail,
> always.  So that I could, as I mentioned in my original posting, do something
> like:

My change is doing just that.  It is building from head to tail.  The 
only difference is that tail is tracking head since it has to be updated 
after the tail is added, and then I can drop next/frag_next back to NULL.

> struct sk_buff {
> 	union {
> 		struct list_head list;
> 		struct {
> 			struct sk_buff	*frag_next;
> 			struct sk_buff	*frag_tail_tracker;
> 		};
> 	};
> };
>
> The ->frag_tail_tracker is only used in the head SKB to maintain where the
> last SKB in the frag list is.

That is what I was doing in the head skb.

> You're tracking the head from the inner SKBs, such that my intended
> conventions are not being followed.

What I am doing is tracking the head from the tail skb.  The reason for 
this is that I need some way to update the len, data_len, and truesize 
after I have placed data in the tail via skb_put.  All of the other SKBs 
in the frag list are just tracking the next like any other SKB in the 
frag_list.

Now that I think about it I guess the issue is that I am adding the SKB 
to the frag_list before it is complete.  I will send another patch out 
in the next couple of hours that should address most of the issues.

Thanks,

Alex






^ permalink raw reply

* Re: [PATCH] serial: DCC(JTAG) serial and console emulation support
From: Daniel Walker @ 2010-10-07 19:58 UTC (permalink / raw)
  To: Mike Frysinger
  Cc: linux-kernel, Hyok S. Choi, Tony Lindgren, Jeff Ohlstein,
	Greg Kroah-Hartman, Ben Dooks, Alan Cox, Kukjin Kim, Feng Tang,
	Tobias Klauser, Jason Wessel, Philippe Langlais
In-Reply-To: <AANLkTi=8Et=Z6zrzbZa3L0MO=cBjjh7L=XU2=PDEbzWW@mail.gmail.com>

On Thu, 2010-10-07 at 15:48 -0400, Mike Frysinger wrote:

> i dont think hijacking the "ttyS" namespace is acceptable, even if
> it's behind a Kconfig.  other people have tried in the past (myself
> included) and been shot down.  sounds like a shim for crappy userspace
> apps that blindly assume /dev/ttyS*.  is that really an issue anymore
> though now that things like /dev/ttyUSB* are so common and people are
> used to picking between multiple serial sources ?

It also creates a ttyJ* which uses the same interfaces as the code for
ttyS* .. I don't think allowing a Kconfig option to shim this in as a
ttyS* is all that bad .. This driver is only going to be used in rare
cases for debugging , having a ttyS* is just a level of flexibility ..

Daniel

-- 

Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.


^ permalink raw reply

* [Bug 15341] Load goes up very high when we traverse the large tree
From: bugzilla-daemon @ 2010-10-07 19:58 UTC (permalink / raw)
  To: linux-scsi
In-Reply-To: <bug-15341-11613@https.bugzilla.kernel.org/>

https://bugzilla.kernel.org/show_bug.cgi?id=15341


Florian Mickler <florian@mickler.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO




-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

^ permalink raw reply

* Re: [PATCH v1 13/16] OMAP3: hwmod DSS: VENC Move init,exit to driver
From: Thomas Petazzoni @ 2010-10-07 19:57 UTC (permalink / raw)
  To: Guruswamy Senthilvadivu
  Cc: khilman, tomi.valkeinen, paul, hvaibhav, linux-omap
In-Reply-To: <1286363699-9614-14-git-send-email-svadivu@ti.com>

Hello Senthil,

On Wed,  6 Oct 2010 16:44:56 +0530
Guruswamy Senthilvadivu <svadivu@ti.com> wrote:

> diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
> index ec17b28..3a121cb 100644
> --- a/drivers/video/omap2/dss/venc.c
> +++ b/drivers/video/omap2/dss/venc.c
> @@ -87,26 +87,6 @@
>  #define VENC_OUTPUT_TEST			0xC8
>  #define VENC_DAC_B__DAC_C			0xC8
>  
> -/* VENC HW IP initialisation */
> -static int omap_venchw_probe(struct platform_device *pdev)
> -{
> -	return 0;
> -}
> -
> -static int omap_venchw_remove(struct platform_device *pdev)
> -{
> -	return 0;
> -}
> -
> -static struct platform_driver omap_venchw_driver = {
> -	.probe          = omap_venchw_probe,
> -	.remove         = omap_venchw_remove,
> -	.driver         = {
> -		.name   = "dss_venc",
> -		.owner  = THIS_MODULE,
> -	},
> -};

Would be better in patch 7/16 to put this stuff at the correct place
(bottom of the file) so it does not need to be moved here.

> +/* VENC HW IP initialisation */
> +static int omap_venchw_probe(struct platform_device *pdev)
> +{
> +	int r;
> +	venc.pdev = pdev;
> +
> +	r = venc_init(pdev);
> +	if (r) {
> +		DSSERR("Failed to initialize venc\n");
> +		goto err_venc;
> +	}
> +
> +err_venc:
> +	return r;
> +}
> +
> +static int omap_venchw_remove(struct platform_device *pdev)
> +{
> +	venc_exit();
> +	return 0;
> +}

Same comment as before: include the code of venc_init() and venc_exit()
directly in the ->probe() and ->remove() hooks respectively.

> +struct regulator *dss_get_vdda_dac(void)
> +{
> +	struct regulator *reg;
> +
> +	if (venc.vdda_dac_reg != NULL)
> +		return venc.vdda_dac_reg;
> +
> +	reg = regulator_get(&venc.pdev->dev, "vdda_dac");
> +	if (!IS_ERR(reg))
> +		venc.vdda_dac_reg = reg;
>  
> +	return reg;
> +}

As far as I can see, this function is now only used in venc_init(),
which is in the same file, so the function should be static, and the
prototype removed from drivers/video/omap2/dss/core.h.

I'm also a bit skeptical about what this function does. It is called
this way in venc_init():

  venc.vdda_dac_reg = dss_get_vdda_dac();

so it is dss_get_vdda_dac() responsability to set venc.vdda_dac_reg, or
is it the caller responsability ?

Moreover, the logic in dss_get_vdda_dac() that tests whether
venc.vdda_dac_reg is already initialized seems to indicate that this
function could be called several times. However, I only see it called
from venc_init(), which as far as I understand is called only once.

Isn't it possible to simplify this by removing the dss_get_vdda_dac()
function and just doing:

  venc.vdda_dac_reg = regulator_get(&venc.pdev->dev, "vdda_dac");

in the venc_init() function (which should become the ->probe() method).

Thanks!

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply

* Re: bitbake COMPATIBLE_MACHINE stack backtrace
From: Frans Meulenbroeks @ 2010-10-07 19:57 UTC (permalink / raw)
  To: openembedded-devel
In-Reply-To: <AANLkTimE8tt4k6nfRSbDJwZDEkecc1sfJQyB9LKtehKQ@mail.gmail.com>

Small addeddum.

Meanwhile had time to test bitbake -b with 1.10.0; this also gives the error.

Frans



^ permalink raw reply

* [PATCH] Bluetooth: hci_uart: Fix typo in stats for sco tx
From: Karl Beldan @ 2010-10-07 19:57 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: linux-bluetooth, Karl Beldan, Marcel Holtmann

s/stat.cmd_tx++/stat.sco_tx++ for HCI_SCODATA_PKT

Signed-off-by: Karl Beldan <karl.beldan@gmail.com>
Cc: Marcel Holtmann <marcel@holtmann.org>
---
 drivers/bluetooth/hci_ldisc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index 998833d..74cb6f3 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -101,7 +101,7 @@ static inline void hci_uart_tx_complete(struct hci_uart *hu, int pkt_type)
 		break;
 
 	case HCI_SCODATA_PKT:
-		hdev->stat.cmd_tx++;
+		hdev->stat.sco_tx++;
 		break;
 	}
 }
-- 
1.7.1.422.g049e9

^ permalink raw reply related

* [PATCH v4] compat: backport netlink changes used in the nl80211 cleanup
From: Felix Fietkau @ 2010-10-07 19:56 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: linux-wireless
In-Reply-To: <4CADC341.40305@openwrt.org>

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
---
v2:
- fix genl_unregister_family wrapper (removes the family from the internal list)
- fix error handling in doit ops
v3:
- fix a theoretical race in family unregister
v4:
- remove old genl_register_family_with_ops implementation
- fix genl_info_net redefinition
tested on 2.6.30

--- a/include/linux/compat-2.6.37.h
+++ b/include/linux/compat-2.6.37.h
@@ -45,6 +45,71 @@ static inline void skb_checksum_none_ass
 
 #define pcmcia_enable_device(link)	pcmcia_request_configuration(link, &link->conf)
 
+#include <net/genetlink.h>
+
+struct compat_genl_info {
+	struct genl_info *info;
+
+	u32 snd_seq;
+	u32 snd_pid;
+	struct genlmsghdr *genlhdr;
+	struct nlattr **attrs;
+	void *user_ptr[2];
+};
+#define genl_info compat_genl_info
+
+struct compat_genl_ops {
+	struct genl_ops ops;
+
+	u8 cmd;
+	u8 internal_flags;
+	unsigned int flags;
+	const struct nla_policy *policy;
+
+	int (*doit)(struct sk_buff *skb, struct genl_info *info);
+	int (*dumpit)(struct sk_buff *skb, struct netlink_callback *cb);
+	int (*done)(struct netlink_callback *cb);
+};
+#define genl_ops compat_genl_ops
+
+struct compat_genl_family {
+	struct genl_family family;
+
+	struct list_head list;
+
+	unsigned int id, hdrsize, version, maxattr;
+	const char *name;
+	bool netnsok;
+
+	struct nlattr **attrbuf;
+
+	int (*pre_doit)(struct genl_ops *ops, struct sk_buff *skb,
+			struct genl_info *info);
+
+	void (*post_doit)(struct genl_ops *ops, struct sk_buff *skb,
+			  struct genl_info *info);
+};
+
+#define genl_family compat_genl_family
+
+#define genl_register_family_with_ops compat_genl_register_family_with_ops
+
+int genl_register_family_with_ops(struct genl_family *family,
+				  struct genl_ops *ops, size_t n_ops);
+
+#define genl_unregister_family compat_genl_unregister_family
+
+int genl_unregister_family(struct genl_family *family);
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
+#define genl_info_net(_info) genl_info_net((_info)->info)
+#endif
+
+#define genlmsg_reply(_msg, _info) genlmsg_reply(_msg, (_info)->info)
+#define genlmsg_put(_skb, _pid, _seq, _fam, _flags, _cmd) genlmsg_put(_skb, _pid, _seq, &(_fam)->family, _flags, _cmd)
+#define genl_register_mc_group(_fam, _grp) genl_register_mc_group(&(_fam)->family, _grp)
+#define genl_unregister_mc_group(_fam, _grp) genl_unregister_mc_group(&(_fam)->family, _grp)
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)) */
 
 #endif /* LINUX_26_37_COMPAT_H */
--- a/compat/compat-2.6.37.c
+++ b/compat/compat-2.6.37.c
@@ -42,4 +42,116 @@ EXPORT_SYMBOL_GPL(net_ns_type_operations
 
 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)*/ 
 
+#undef genl_info
+#undef genl_unregister_family
+
+static LIST_HEAD(compat_nl_fam);
+
+static struct genl_ops *genl_get_cmd(u8 cmd, struct genl_family *family)
+{
+	struct genl_ops *ops;
+
+	list_for_each_entry(ops, &family->family.ops_list, ops.ops_list)
+		if (ops->cmd == cmd)
+			return ops;
+
+	return NULL;
+}
+
+
+static int nl_doit_wrapper(struct sk_buff *skb, struct genl_info *info)
+{
+	struct compat_genl_info compat_info;
+	struct genl_family *family;
+	struct genl_ops *ops;
+	int err;
+
+	list_for_each_entry(family, &compat_nl_fam, list) {
+		if (family->id == info->nlhdr->nlmsg_type)
+			goto found;
+	}
+	return -ENOENT;
+
+found:
+	ops = genl_get_cmd(info->genlhdr->cmd, family);
+	if (!ops)
+		return -ENOENT;
+
+	memset(&compat_info.user_ptr, 0, sizeof(compat_info.user_ptr));
+	compat_info.info = info;
+#define __copy(_field) compat_info._field = info->_field
+	__copy(snd_seq);
+	__copy(snd_pid);
+	__copy(genlhdr);
+	__copy(attrs);
+#undef __copy
+	if (family->pre_doit) {
+		err = family->pre_doit(ops, skb, &compat_info);
+		if (err)
+			return err;
+	}
+
+	err = ops->doit(skb, &compat_info);
+
+	if (family->post_doit)
+		family->post_doit(ops, skb, &compat_info);
+
+	return err;
+}
+
+int compat_genl_register_family_with_ops(struct genl_family *family,
+					 struct genl_ops *ops, size_t n_ops)
+{
+	int i, ret;
+
+#define __copy(_field) family->family._field = family->_field
+	__copy(id);
+	__copy(hdrsize);
+	__copy(version);
+	__copy(maxattr);
+	strncpy(family->family.name, family->name, sizeof(family->family.name));
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
+	__copy(netnsok);
+#endif
+#undef __copy
+
+	ret = genl_register_family(&family->family);
+	if (ret < 0)
+		return ret;
+
+	family->attrbuf = family->family.attrbuf;
+	family->id = family->family.id;
+
+	for (i = 0; i < n_ops; i++) {
+#define __copy(_field) ops[i].ops._field = ops[i]._field
+		__copy(cmd);
+		__copy(flags);
+		__copy(policy);
+		__copy(dumpit);
+		__copy(done);
+#undef __copy
+		ops[i].ops.doit = nl_doit_wrapper;
+		ret = genl_register_ops(&family->family, &ops[i].ops);
+		if (ret < 0)
+			goto error_ops;
+	}
+	list_add(&family->list, &compat_nl_fam);
+
+	return ret;
+
+error_ops:
+	compat_genl_unregister_family(family);
+	return ret;
+}
+EXPORT_SYMBOL(compat_genl_register_family_with_ops);
+
+int compat_genl_unregister_family(struct genl_family *family)
+{
+	int err;
+	err = genl_unregister_family(&family->family);
+	list_del(&family->list);
+	return err;
+}
+EXPORT_SYMBOL(compat_genl_unregister_family);
+
 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37) */
--- a/compat/compat-2.6.31.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2007	Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * Compatibility file for Linux wireless for kernels 2.6.31.
- */
-
-#include <linux/compat.h>
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31))
-
-#include <linux/netdevice.h>
-
-/**
- * genl_register_family_with_ops - register a generic netlink family
- * @family: generic netlink family
- * @ops: operations to be registered
- * @n_ops: number of elements to register
- *
- * Registers the specified family and operations from the specified table.
- * Only one family may be registered with the same family name or identifier.
- *
- * The family id may equal GENL_ID_GENERATE causing an unique id to
- * be automatically generated and assigned.
- *
- * Either a doit or dumpit callback must be specified for every registered
- * operation or the function will fail. Only one operation structure per
- * command identifier may be registered.
- *
- * See include/net/genetlink.h for more documenation on the operations
- * structure.
- *
- * This is equivalent to calling genl_register_family() followed by
- * genl_register_ops() for every operation entry in the table taking
- * care to unregister the family on error path.
- *
- * Return 0 on success or a negative error code.
- */
-int genl_register_family_with_ops(struct genl_family *family,
-	struct genl_ops *ops, size_t n_ops)
-{
-	int err, i;
-
-	err = genl_register_family(family);
-	if (err)
-		return err;
-
-	for (i = 0; i < n_ops; ++i, ++ops) {
-		err = genl_register_ops(family, ops);
-		if (err)
-			goto err_out;
-	}
-	return 0;
-err_out:
-	genl_unregister_family(family);
-	return err;
-}
-EXPORT_SYMBOL(genl_register_family_with_ops);
-
-#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) */
-
--- a/include/linux/compat-2.6.31.h
+++ b/include/linux/compat-2.6.31.h
@@ -114,10 +114,6 @@ static inline struct rtable *skb_rtable(
 	return (struct rtable *)skb_dst(skb);
 }
 
-extern int genl_register_family_with_ops(struct genl_family *family,
-	struct genl_ops *ops, size_t n_ops);
-
-
 /* Backport threaded IRQ support */
 
 static inline
--- a/compat/Makefile
+++ b/compat/Makefile
@@ -23,7 +23,6 @@ compat-$(CONFIG_COMPAT_KERNEL_27) += com
 compat-$(CONFIG_COMPAT_KERNEL_28) += compat-2.6.28.o
 compat-$(CONFIG_COMPAT_KERNEL_29) += compat-2.6.29.o
 compat-$(CONFIG_COMPAT_KERNEL_30) += compat-2.6.30.o
-compat-$(CONFIG_COMPAT_KERNEL_31) += compat-2.6.31.o
 compat-$(CONFIG_COMPAT_KERNEL_32) += compat-2.6.32.o
 compat-$(CONFIG_COMPAT_KERNEL_33) += compat-2.6.33.o
 compat-$(CONFIG_COMPAT_KERNEL_35) += compat-2.6.35.o

^ permalink raw reply

* Re: [Qemu-devel] [PATCH 0/2] USB CCID device
From: Anthony Liguori @ 2010-10-07 19:56 UTC (permalink / raw)
  To: Alon Levy; +Cc: qemu-devel
In-Reply-To: <66149389.650161286403166113.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com>

On 10/06/2010 05:12 PM, Alon Levy wrote:
> Actually, both are possible - but the later is the interesting use case (the
> former is mainly for debugging). To elaborate: the device is meant to allow
> a hardware reader to be available to the guest while still being available to
> the client (which is running on the computer with the real reader attached). So
> the real card is what we are talking to. The other usage is to have a virtual
> card, which would actually be more logical to put with the qemu device, but
> It isn't my current focus (the focus being the real card, and the virtual card
> being implemented in the client side is a testing measure).
>    

Okay, that makes sense.

> I'll do this.
>
> A side note: I tried migrating a QSIMPLEQ today - not a fun experience. I'm
> wondering if this is a result of a mentality that "all devices should allocate
> memory upfront" that makes using / migrating dynamic linked lists a non-starter,
> or just an oversight (no one wrote VMSTATE_QSIMPLEQ yet). As it stands migrating
> a QSIMPLEQ (or any other list) is much easier the old way without using VMSTATE.
> </rant>.
>    

Yeah, complex types are not at all easy to migrate today.  Something we 
need to tackle with vmstate2 eventually.

Regards,

Anthony Liguori

>> Regards,
>>
>> Anthony Liguori
>>      

^ permalink raw reply

* Re: [Qemu-devel] [PATCH 0/2] USB CCID device
From: Anthony Liguori @ 2010-10-07 19:54 UTC (permalink / raw)
  To: Alon Levy; +Cc: qemu-devel, Gerd Hoffmann
In-Reply-To: <2052681331.708791286437179606.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com>

On 10/07/2010 02:39 AM, Alon Levy wrote:
> ----- "Anthony Liguori"<anthony@codemonkey.ws>  wrote:
>
>    
>> On 10/06/2010 03:55 AM, Gerd Hoffmann wrote:
>>      
>>> On 10/06/10 02:28, Alon Levy wrote:
>>>        
>>>>          
>>>>> Does this work with live migration?  I can't see how it would.
>>>>>
>>>>>            
>>>> No, it doesn't right now. It would require cooperation with the
>>>>          
>> client,
>>      
>>>> to tell it to reconnect to the target qemu (kind of like spice).
>>>>          
>>> I think until we have this migration should have pretty much the
>>>        
>> same
>>      
>>> effect as a chardev disconnect, i.e. detach the usb device (which
>>>        
>> the
>>      
>>> guest will see as unplug).
>>>        
>> Better yet, mark the guest as unmigrateable and let the management
>> tool
>> unplug the usb device before migration and replug it after migration.
>>
>> It's the same principle behind device assignment.
>>
>>      
> Is there any way to also get a pre_migrate callback with register_device_unmigratable?
> I'd like to send a VSC_Reconnect message, then the guest sees an unplug, then migration,
>    

No.  The disconnect needs to happen in the management tooling layer.   
Same is true for any device doing hardware passthrough.

Automagic unplugging/plugging during migration is not a good idea 
universally so it's something that needs to happen as a policy at the 
management level.

Regards,

Anthony Liguori

> then (no plug yet since the device is marked as auto_attach=0) client reconnects
> (actually this happens before but to a paused machine waiting for migration), and then
> causes attachement, same as a new machine.
>
>    
>> Regards,
>>
>> Anthony Liguori
>>
>>      
>>> Needs some code though, at minimum you'll have to xfer the connected
>>>        
>>      
>>> state from the migration source and have some bits in post_load()
>>> which do attach/detach if needed.
>>>
>>> cheers,
>>>    Gerd
>>>
>>>        

^ permalink raw reply

* Re: [Qemu-devel] [PATCH 2/3] vnc: support password expire
From: Anthony Liguori @ 2010-10-07 19:53 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: qemu-devel
In-Reply-To: <1286450121-17153-3-git-send-email-kraxel@redhat.com>

On 10/07/2010 06:15 AM, Gerd Hoffmann wrote:
> This patch adds support for expiring passwords to vnc.  It adds a new
> lifetime parameter to the vnc_display_password() function, which
> specifies the number of seconds the new password will be valid.  Passing
> zero as lifetime maintains current behavior (password never expires).
>
> Signed-off-by: Gerd Hoffmann<kraxel@redhat.com>
>    

This has been posted before and I've never understood it.  Why can't a 
management tool just expire passwords on it's own?

How does password expiration help with security at all?

Regards,

Anthony Liguori

> ---
>   console.h |    2 +-
>   monitor.c |    3 +--
>   ui/vnc.c  |   15 ++++++++++++++-
>   ui/vnc.h  |    1 +
>   4 files changed, 17 insertions(+), 4 deletions(-)
>
> diff --git a/console.h b/console.h
> index aafb031..24670e5 100644
> --- a/console.h
> +++ b/console.h
> @@ -368,7 +368,7 @@ void cocoa_display_init(DisplayState *ds, int full_screen);
>   void vnc_display_init(DisplayState *ds);
>   void vnc_display_close(DisplayState *ds);
>   int vnc_display_open(DisplayState *ds, const char *display);
> -int vnc_display_password(DisplayState *ds, const char *password);
> +int vnc_display_password(DisplayState *ds, const char *password, int lifetime);
>   void do_info_vnc_print(Monitor *mon, const QObject *data);
>   void do_info_vnc(Monitor *mon, QObject **ret_data);
>   char *vnc_display_local_addr(DisplayState *ds);
> diff --git a/monitor.c b/monitor.c
> index fbb678d..d82eb9e 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -966,11 +966,10 @@ static int do_quit(Monitor *mon, const QDict *qdict, QObject **ret_data)
>
>   static int change_vnc_password(const char *password)
>   {
> -    if (vnc_display_password(NULL, password)<  0) {
> +    if (vnc_display_password(NULL, password, 0)<  0) {
>           qerror_report(QERR_SET_PASSWD_FAILED);
>           return -1;
>       }
> -
>       return 0;
>   }
>
> diff --git a/ui/vnc.c b/ui/vnc.c
> index 1ef0fc5..51aa9ca 100644
> --- a/ui/vnc.c
> +++ b/ui/vnc.c
> @@ -2078,11 +2078,19 @@ static int protocol_client_auth_vnc(VncState *vs, uint8_t *data, size_t len)
>       unsigned char response[VNC_AUTH_CHALLENGE_SIZE];
>       int i, j, pwlen;
>       unsigned char key[8];
> +    time_t now;
>
>       if (!vs->vd->password || !vs->vd->password[0]) {
>           VNC_DEBUG("No password configured on server");
>           goto reject;
>       }
> +    if (vs->vd->expires) {
> +        time(&now);
> +        if (vs->vd->expires<  now) {
> +            VNC_DEBUG("Password is expired");
> +            goto reject;
> +        }
> +    }
>
>       memcpy(response, vs->challenge, VNC_AUTH_CHALLENGE_SIZE);
>
> @@ -2474,7 +2482,7 @@ void vnc_display_close(DisplayState *ds)
>   #endif
>   }
>
> -int vnc_display_password(DisplayState *ds, const char *password)
> +int vnc_display_password(DisplayState *ds, const char *password, int lifetime)
>   {
>       VncDisplay *vs = ds ? (VncDisplay *)ds->opaque : vnc_display;
>
> @@ -2492,6 +2500,11 @@ int vnc_display_password(DisplayState *ds, const char *password)
>           if (vs->auth == VNC_AUTH_NONE) {
>               vs->auth = VNC_AUTH_VNC;
>           }
> +        if (lifetime) {
> +            vs->expires = time(NULL) + lifetime;
> +        } else {
> +            vs->expires = 0;
> +        }
>       } else {
>           vs->auth = VNC_AUTH_NONE;
>       }
> diff --git a/ui/vnc.h b/ui/vnc.h
> index 9619b24..4f895be 100644
> --- a/ui/vnc.h
> +++ b/ui/vnc.h
> @@ -120,6 +120,7 @@ struct VncDisplay
>
>       char *display;
>       char *password;
> +    time_t expires;
>       int auth;
>       bool lossy;
>   #ifdef CONFIG_VNC_TLS
>    

^ permalink raw reply

* [PATCH 3/3] Introduce QMP basic test-suite
From: Luiz Capitulino @ 2010-10-07 19:52 UTC (permalink / raw)
  To: autotest; +Cc: kvm, lmr, ehabkost, armbru
In-Reply-To: <1286481127-24640-1-git-send-email-lcapitulino@redhat.com>

QMP automated testing can be split in three parts:

1. Testing that the basic protocol works as specified. That is, ensuring
   that the greeting message, success responses and error messages
   contain the basic information the spec says they do. More importantly,
   several errors conditions at the protocol level should be tested

2. Test that each available command behaves as specified by its *own*
   specification. This is a big effort, as each command should have
   its own test suite

3. Asynchronous messages testing. Like command testing, each asynchronous
   message should be tested separately

This commit introduces a new suite to test item 1, that is, the goal
is to ensure that QMP behaves as specified by the basic protocol
specification (which is file QMP/qmp-spec.txt in QEMU's source tree).

Items 2 and 3 are not addressed in this commit in any way. They are a
continuous and long term type of work.

TODO:

o Finding which test failed is not as easy as it should be, is this
  is this a kvm-autotest problem?

o Are all those check_*() functions really needed? Can't we have
  all those checks in only one function?

o The argument_checker_suite() is incomplete

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 client/tests/kvm/tests/qmp_basic.py    |  268 ++++++++++++++++++++++++++++++++
 client/tests/kvm/tests_base.cfg.sample |    3 +
 2 files changed, 271 insertions(+), 0 deletions(-)
 create mode 100644 client/tests/kvm/tests/qmp_basic.py

diff --git a/client/tests/kvm/tests/qmp_basic.py b/client/tests/kvm/tests/qmp_basic.py
new file mode 100644
index 0000000..89dbe6a
--- /dev/null
+++ b/client/tests/kvm/tests/qmp_basic.py
@@ -0,0 +1,268 @@
+import logging, json
+from autotest_lib.client.common_lib import error
+import kvm_subprocess, kvm_test_utils, kvm_utils
+
+def run_qmp_basic(test, params, env):
+    """
+    QMP Specification test-suite: this checks if the *basic* protocol conforms
+    to its specification.
+
+    Please, check it suite for details.
+    """
+    def fail_no_key(qmp_dict, key):
+        if not isinstance(qmp_dict, dict):
+            raise error.TestFail("qmp_dict is not a dict (it's '%s')" % type(qmp_dict))
+        if not key in qmp_dict:
+            raise error.TestFail("'%s' key doesn't exist in dict ('%s')"
+                                 % (key, str(qmp_dict)))
+
+    def check_dict_key(qmp_dict, key, keytype):
+        """
+        Performs the following checks on a QMP dict key:
+
+        1. qmp_dict is a dict
+        2. key exists in qmp_dict
+        3. key is of type keytype
+        
+        If any of these checks fails, error.TestFail is raised.
+        """
+        fail_no_key(qmp_dict, key)
+        if not isinstance(qmp_dict[key], keytype):
+            raise error.TestFail("'%s' key is not of type '%s', it's '%s'"
+                                 % (key, keytype, type(qmp_dict[key])))
+
+    def check_key_is_dict(qmp_dict, key):
+        check_dict_key(qmp_dict, key, dict)
+
+    def check_key_is_list(qmp_dict, key):
+        check_dict_key(qmp_dict, key, list)
+
+    def check_key_is_str(qmp_dict, key):
+        check_dict_key(qmp_dict, key, unicode)
+
+    def check_str_key(qmp_dict, keyname, value=None):
+        check_dict_key(qmp_dict, keyname, unicode)
+        if value and value != qmp_dict[keyname]:
+            raise error.TestFail("'%s' key value '%s' should be '%s'"
+                                 % (keyname, str(qmp_dict[keyname]), str(value)))
+
+    def check_key_is_int(qmp_dict, key):
+        fail_no_key(qmp_dict, key)
+        try:
+            value = int(qmp_dict[key])
+        except:
+            raise error.TestFail("'%s' key is not of type int, it's '%s'"
+                                 % (key, type(qmp_dict[key])))
+
+    def check_bool_key(qmp_dict, keyname, value=None):
+        check_dict_key(qmp_dict, keyname, bool)
+        if value and value != qmp_dict[keyname]:
+            raise error.TestFail("'%s' key value '%s' should be '%s'"
+                                 % (keyname, str(qmp_dict[keyname]), str(value)))
+
+    def check_success_resp(resp, empty=False):
+        check_key_is_dict(resp, "return")
+        if empty and len(resp["return"]) > 0:
+            raise error.TestFail("success response is not empty ('%s')"
+                                 % str(resp))
+
+    def check_error_resp(resp, classname=None, datadict=None):
+        check_key_is_dict(resp, "error")
+        check_key_is_str(resp["error"], "class")
+        if classname and resp["error"]["class"] != classname:
+            raise error.TestFail("error class is '%s' but should be '%s'"
+                                 % (resp["error"]["class"], classname))
+        check_key_is_dict(resp["error"], "data")
+        if datadict and resp["error"]["data"] != datadict:
+            raise error.TestFail("data dict is '%s' but should be '%s'"
+                                 % (resp["error"]["data"], datadict))
+
+    def test_version(version):
+        """
+        Test QMP greeting message's version key which, according to QMP's
+        documentation, should be:
+
+        { "qemu": { "major": json-int, "minor": json-int, "micro": json-int }
+          "package": json-string }
+        """
+        check_key_is_dict(version, "qemu")
+        for key in [ "major", "minor", "micro" ]:
+            check_key_is_int(version["qemu"], key)
+        check_key_is_str(version, "package")
+
+    def test_greeting(greeting):
+        check_key_is_dict(greeting, "QMP")
+        check_key_is_dict(greeting["QMP"], "version")
+        check_key_is_list(greeting["QMP"], "capabilities")
+
+    def greeting_suite(monitor):
+        """
+        Check QMP's greeting message which, according to QMP's spec section
+        '2.2 Server Greeting', is:
+
+        { "QMP": { "version": json-object, "capabilities": json-array } }
+        """
+        greeting = monitor.get_greeting()
+        test_greeting(greeting)
+        test_version(greeting["QMP"]["version"])
+
+
+    def json_parsing_suite(monitor):
+        """
+        Check the QMP's parser conforms to the JSON's spec (RFC 4627).
+        """
+        # We're quite simple right now and the focus is parsing problems
+        # that have already biten us in the past.
+        #
+        # However, the following test-cases are missing:
+        #
+        #   - JSON numbers, strings and arrays
+        #   - More invalid characters or malformed structures
+        #   - Valid, but not obvious syntax (like zillion of spaces or
+        #     strings with unicode chars)
+        bad_json = []
+        
+        # A JSON value MUST be an object, array, number, string, or true,
+        # false, null
+        #
+        # NOTE: QMP seems to ignore a number of chars, like: | and ?
+        bad_json.append(":")
+        bad_json.append(",")
+
+        # Malformed json-objects
+        #
+        # NOTE: sending only "}" seems to break QMP
+        # NOTE: Duplicate keys are accepted (should it?)
+        bad_json.append("{ \"execute\" }")
+        bad_json.append("{ \"execute\": \"query-version\", }")
+        bad_json.append("{ 1: \"query-version\" }")
+        bad_json.append("{ true: \"query-version\" }")
+        bad_json.append("{ []: \"query-version\" }")
+        bad_json.append("{ {}: \"query-version\" }")
+
+        for cmd in bad_json:
+            resp = monitor.send(cmd)
+            check_error_resp(resp, "JSONParsing")
+
+
+    def test_id_key(monitor):
+        """
+        Check if QMP's "id" key is handled correctly.
+        """
+        # The "id" key must be echoed back in error responses
+        id = "kvm-autotest"
+        resp = monitor.send_cmd({ "execute": "eject", "id": id,
+                                  "arguments": { "foobar": True }})
+        check_error_resp(resp)
+        check_str_key(resp, "id", id)
+
+        # The "id" key must be echoed back in success responses
+        resp = monitor.send_cmd({ "execute": "query-status", "id": id })
+        check_success_resp(resp)
+        check_str_key(resp, "id", id)
+
+        # The "id" key can be any json-object
+        for id in [ True, 1234, "string again!", [1, 2, 3, 4], { "key": {} } ]:
+            resp = monitor.send_cmd({ "execute": "query-status", "id": id })
+            check_success_resp(resp)
+            if resp["id"] != id:
+                raise error.TestFail("expected id '%s' but got '%s'"
+                                     % (str(id), str(resp["id"])))
+
+    def test_invalid_arg_key(monitor):
+        """
+        Currently, the only supported keys in the input object are: "execute",
+        "arguments" and "id". Although expansion is supported, invalid key
+        names must be detected.
+        """
+        resp = monitor.send_cmd({ "execute": "eject", "foobar": True })
+        check_error_resp(resp, "QMPExtraInputObjectMember",
+                         { "member": "foobar" })
+
+    def test_arguments_key(monitor):
+        """
+        The "arguments" key must be an json-object.
+        
+        We use the eject command to perform the tests, but that's a random
+        choice, any command that accepts arguments will do.
+        """
+        for item in [ True, [], 1, "foo" ]:
+            resp = monitor.send_cmd({ "execute": "eject", "arguments": item })
+            check_error_resp(resp, "QMPBadInputObjectMember",
+                             { "member": "arguments", "expected": "object" })
+
+    def test_execute_key_type(monitor):
+        """
+        The "execute" key must be a json-string.
+        """
+        for item in [ False, 1, {}, [] ]:
+            resp = monitor.send_cmd({ "execute": item })
+            check_error_resp(resp, "QMPBadInputObjectMember",
+                             { "member": "execute", "expected": "string" })
+
+    def test_no_execute_key(monitor):
+        """
+        The "execute" key must exist, we also test for some stupid parsing
+        errors.
+        """
+        for cmd in [ {}, { "execut": "qmp_capabilities" },
+                     { "executee": "qmp_capabilities" }, { "foo": "bar" }]:
+            resp = monitor.send_cmd(cmd)
+            check_error_resp(resp) # XXX: check class and data dict?
+
+    def test_input_obj_type(monitor):
+        """
+        The input object must be... an object.
+        """
+        for cmd in [ "foo", [], True, 1 ]:
+            resp = monitor.send_cmd(cmd)
+            check_error_resp(resp, "QMPBadInputObject", { "expected":"object" })
+
+    def input_object_suite(monitor):
+        """
+        Check QMP's input object which, according to QMP's spec section
+        '2.3 Issuing Commands', is:
+
+        { "execute": json-string, "arguments": json-object, "id": json-value }
+        """
+        test_input_obj_type(monitor)
+        test_no_execute_key(monitor)
+        test_execute_key_type(monitor)
+        test_arguments_key(monitor)
+        test_invalid_arg_key(monitor)
+        test_id_key(monitor)
+
+    def argument_checker_suite(monitor):
+        """
+        Checks if QMP's argument checker is detecting all possible errors.
+
+        We use a number of different commands to perform the checks, but most
+        of the time the command used doesn't matter because QMP performs the
+        argument checking _before_ calling the command.
+        """
+        # system_reset doesn't take arguments
+        resp = monitor.send_cmd({ "execute": "system_reset", "arguments": { "foo": 1 }})
+        check_error_resp(resp, "InvalidParameter", { "name": "foo" })
+
+    def unknown_commands_suite(monitor):
+        """
+        Check if QMP handles unknown commands correctly.
+        """
+        # We also call a HMP-only command, to be sure it will fail as expected
+        for cmd in [ "bar", "query-", "query-foo", "q", "help" ]:
+            resp = monitor.send_cmd({ "execute": cmd })
+            check_error_resp(resp, "CommandNotFound", { "name": cmd })
+
+
+    vm = kvm_test_utils.get_living_vm(env, params.get("main_vm"))
+
+    # Run all suites
+    greeting_suite(vm.monitor)
+    json_parsing_suite(vm.monitor)
+    input_object_suite(vm.monitor)
+    argument_checker_suite(vm.monitor)
+    unknown_commands_suite(vm.monitor)
+
+    # check if QMP is still alive
+    resp = vm.monitor.cmd("query-status")
+    check_bool_key(resp, "running", True)
diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
index 167e86d..8eaefca 100644
--- a/client/tests/kvm/tests_base.cfg.sample
+++ b/client/tests/kvm/tests_base.cfg.sample
@@ -456,6 +456,9 @@ variants:
             - fmt_raw:
                 image_format_stg = raw
 
+    - qmp_basic: install setup unattended_install.cdrom
+        type = qmp_basic
+
     - vlan_tag:  install setup unattended_install.cdrom
         type = vlan_tag
         # subnet should not be used by host
-- 
1.7.3.1.104.gc752e


^ permalink raw reply related

* [PATCH 2/3] QMPMonitor: Introduce the send() method
From: Luiz Capitulino @ 2010-10-07 19:52 UTC (permalink / raw)
  To: autotest; +Cc: kvm, lmr, ehabkost, armbru
In-Reply-To: <1286481127-24640-1-git-send-email-lcapitulino@redhat.com>

This method directly sends data to the QMP monitor and returns its
response without any kind of special treatment or sanity checking.

The send_cmd() method is also introduced. It's a simple wrapper
which sends a QMP command to the monitor.

Both methods are going to be used by the QMP test-suite.

TODO: Refactor _get_command_output() and/or cmd() to use the new
      methods.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 client/tests/kvm/kvm_monitor.py |   49 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 49 insertions(+), 0 deletions(-)

diff --git a/client/tests/kvm/kvm_monitor.py b/client/tests/kvm/kvm_monitor.py
index c23835c..9a66388 100644
--- a/client/tests/kvm/kvm_monitor.py
+++ b/client/tests/kvm/kvm_monitor.py
@@ -604,6 +604,55 @@ class QMPMonitor(Monitor):
         return self._greeting
 
 
+    def send(self, data, timeout=20):
+        """
+        Send data to the QMP monitor and return its response.
+
+        @param data: Data to send
+        @param timeout: Time duration to wait for response
+        @return: The response received
+        @raise MonitorLockError: Raised if the lock cannot be acquired
+        @raise MonitorSendError: Raised if the command cannot be sent
+        @raise MonitorProtocolError: Raised if no response is received
+        """
+        if not self._acquire_lock(20):
+            raise MonitorLockError("Could not acquire exclusive lock to send "
+                                   "QMP command '%s'" % cmd)
+        try:
+            self._read_objects()
+            self._socket.sendall(data)
+            end_time = time.time() + timeout
+            while time.time() < end_time:
+                for obj in self._read_objects():
+                    if isinstance(obj, dict):
+                        if "return" in obj or "error" in obj:
+                            return obj
+                time.sleep(0.1)
+            else:
+                 raise MonitorProtocolError("Received no response (data: %s)"
+                                            % str(data))
+        except socket.error:
+            raise MonitorSendError("Could not send data '%s'" % str(data))
+        finally:
+            self._lock.release()
+
+
+    def send_cmd(self, command, timeout=20):
+        """
+        Send a QMP command. This is a simple wrapper to send() method that does
+        JSON formatting.
+
+        @param command: QMP command to send
+        @param timeout: Time duration to wait for response
+        @return: The response received
+        @raise MonitorLockError: Raised if the lock cannot be acquired
+        @raise MonitorSendError: Raised if the command cannot be sent
+        @raise MonitorProtocolError: Raised if no response is received
+
+        """
+        return self.send(json.dumps(command) + "\n", timeout)
+
+
     # Command wrappers
     # Note: all of the following functions raise exceptions in a similar manner
     # to cmd() and _get_command_output().
-- 
1.7.3.1.104.gc752e


^ permalink raw reply related

* [PATCH 1/3] QMPMonitor: Introduce the get_greeting() method
From: Luiz Capitulino @ 2010-10-07 19:52 UTC (permalink / raw)
  To: autotest; +Cc: kvm, lmr, ehabkost, armbru
In-Reply-To: <1286481127-24640-1-git-send-email-lcapitulino@redhat.com>

It returns the QMP's greeting message as sent by the monitor.

Please, note that this commit also changes the QMPMonitor's constructor
to store the full greeting message (it currently stores only its
contents).

This new method is going to be used by the QMP test-suite, which fully
checks the greeting message.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 client/tests/kvm/kvm_monitor.py |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/client/tests/kvm/kvm_monitor.py b/client/tests/kvm/kvm_monitor.py
index 8440835..c23835c 100644
--- a/client/tests/kvm/kvm_monitor.py
+++ b/client/tests/kvm/kvm_monitor.py
@@ -408,7 +408,7 @@ class QMPMonitor(Monitor):
             while time.time() < end_time:
                 for obj in self._read_objects():
                     if "QMP" in obj:
-                        self._greeting = obj["QMP"]
+                        self._greeting = obj
                         break
                 if self._greeting:
                     break
@@ -597,6 +597,13 @@ class QMPMonitor(Monitor):
         self._lock.release()
 
 
+    def get_greeting(self):
+        """
+        Return QMP greeting message.
+        """
+        return self._greeting
+
+
     # Command wrappers
     # Note: all of the following functions raise exceptions in a similar manner
     # to cmd() and _get_command_output().
-- 
1.7.3.1.104.gc752e


^ permalink raw reply related

* [KVM_AUTOTEST][RFC 0/3]: QMP basic test-suite
From: Luiz Capitulino @ 2010-10-07 19:52 UTC (permalink / raw)
  To: autotest; +Cc: kvm, lmr, ehabkost, armbru

This series is an _initial_ work on having a full QMP test-suite in
kvm-autotest. I think it's very near of being in a mergeable state, but I
figured it would be a good idea to get some feedback before submitting the
final version.

You'll find all important details in the patches, being the last the most
important one.

Please, note that there are a number of TODO items to be addressed and I
need help to solve the following issues:

    1. A number of QMP commands are executed before the QMP suite is run,
       which means that some problems can be caught by non-test code (ie.
       real usage).

       Ideally, the QMP suite should be run before any command is executed,
       so that we avoid catching QMP bugs in other test suites and/or in
       kvm-autotest non-test code.

    2. The qmp_capabilities command is run by the QMPMonitor class
       constructor. This makes it impossible for me to test it in the QMP
       suite.

       I have tried destroying and recreating the QMPMonitor object from
       my test-suite, but that didn't seem to work very well.

I have other, more general comments, about kvm-autotest, but I'll send them
in a different thread.

Thanks.

^ permalink raw reply

* Re: [Qemu-devel] [PATCH] ceph/rbd block driver for qemu-kvm (v4)
From: Anthony Liguori @ 2010-10-07 19:51 UTC (permalink / raw)
  To: Yehuda Sadeh Weinraub
  Cc: Kevin Wolf, kvm, qemu-devel, ceph-devel, Christian Brunner
In-Reply-To: <AANLkTim2qfA+MncyF9Cx1oGYEzgW2TugG9sFTLP8T=J-@mail.gmail.com>

On 10/07/2010 01:41 PM, Yehuda Sadeh Weinraub wrote:
> On Thu, Oct 7, 2010 at 11:38 AM, Anthony Liguori<anthony@codemonkey.ws>  wrote:
>    
>> On 10/07/2010 01:08 PM, Yehuda Sadeh Weinraub wrote:
>>      
>>> On Thu, Oct 7, 2010 at 7:12 AM, Anthony Liguori<anthony@codemonkey.ws>
>>>   wrote:
>>>
>>>        
>>>> On 08/03/2010 03:14 PM, Christian Brunner wrote:
>>>>
>>>>          
>>>>> +#include "qemu-common.h"
>>>>> +#include "qemu-error.h"
>>>>> +#include<sys/types.h>
>>>>> +#include<stdbool.h>
>>>>> +
>>>>> +#include<qemu-common.h>
>>>>>
>>>>>
>>>>>            
>>>> This looks to be unnecessary.  Generally, system includes shouldn't be
>>>> required so all of these should go away except rado/librados.h
>>>>
>>>>          
>>> Removed.
>>>
>>>
>>>        
>>>>
>>>>          
>>>>> +
>>>>> +#include "rbd_types.h"
>>>>> +#include "module.h"
>>>>> +#include "block_int.h"
>>>>> +
>>>>> +#include<stdio.h>
>>>>> +#include<stdlib.h>
>>>>> +#include<rados/librados.h>
>>>>> +
>>>>> +#include<signal.h>
>>>>> +
>>>>> +
>>>>> +int eventfd(unsigned int initval, int flags);
>>>>>
>>>>>
>>>>>            
>>>> This is not quite right.  Depending on eventfd is curious but in the very
>>>> least, you need to detect the presence of eventfd in configure and
>>>> provide a
>>>> wrapper that redefines it as necessary.
>>>>
>>>>          
>>> Can fix that, though please see my later remarks.
>>>
>>>        
>>>>> +static int create_tmap_op(uint8_t op, const char *name, char
>>>>> **tmap_desc)
>>>>> +{
>>>>> +    uint32_t len = strlen(name);
>>>>> +    /* total_len = encoding op + name + empty buffer */
>>>>> +    uint32_t total_len = 1 + (sizeof(uint32_t) + len) +
>>>>> sizeof(uint32_t);
>>>>> +    char *desc = NULL;
>>>>>
>>>>>
>>>>>            
>>>> char is the wrong type to use here as it may be signed or unsigned.  That
>>>> can have weird effects with binary data when you're directly manipulating
>>>> it.
>>>>
>>>>          
>>> Well, I can change it to uint8_t, so that it matches the op type, but
>>> that'll require adding some other castings. In any case, you usually
>>> get such a weird behavior when you cast to types of different sizes
>>> and have the sign bit padded which is not the case in here.
>>>
>>>
>>>        
>>>>
>>>>          
>>>>> +
>>>>> +    desc = qemu_malloc(total_len);
>>>>> +
>>>>> +    *tmap_desc = desc;
>>>>> +
>>>>> +    *desc = op;
>>>>> +    desc++;
>>>>> +    memcpy(desc,&len, sizeof(len));
>>>>> +    desc += sizeof(len);
>>>>> +    memcpy(desc, name, len);
>>>>> +    desc += len;
>>>>> +    len = 0;
>>>>> +    memcpy(desc,&len, sizeof(len));
>>>>> +    desc += sizeof(len);
>>>>>
>>>>>
>>>>>            
>>>> Shouldn't endianness be a concern?
>>>>
>>>>          
>>> Right. Fixed that.
>>>
>>>
>>>        
>>>>
>>>>          
>>>>> +
>>>>> +    return desc - *tmap_desc;
>>>>> +}
>>>>> +
>>>>> +static void free_tmap_op(char *tmap_desc)
>>>>> +{
>>>>> +    qemu_free(tmap_desc);
>>>>> +}
>>>>> +
>>>>> +static int rbd_register_image(rados_pool_t pool, const char *name)
>>>>> +{
>>>>> +    char *tmap_desc;
>>>>> +    const char *dir = RBD_DIRECTORY;
>>>>> +    int ret;
>>>>> +
>>>>> +    ret = create_tmap_op(CEPH_OSD_TMAP_SET, name,&tmap_desc);
>>>>> +    if (ret<      0) {
>>>>> +        return ret;
>>>>> +    }
>>>>> +
>>>>> +    ret = rados_tmap_update(pool, dir, tmap_desc, ret);
>>>>> +    free_tmap_op(tmap_desc);
>>>>> +
>>>>> +    return ret;
>>>>> +}
>>>>>
>>>>>
>>>>>            
>>>> This ops are all synchronous?  IOW, rados_tmap_update() call blocks until
>>>> the operation is completed?
>>>>
>>>>          
>>> Yeah. And this is only called from the rbd_create() callback.
>>>
>>>
>>>        
>>>>> +            header_snap += strlen(header_snap) + 1;
>>>>> +            if (header_snap>      end)
>>>>> +                error_report("bad header, snapshot list broken");
>>>>>
>>>>>
>>>>>            
>>>> Missing curly braces here.
>>>>
>>>>          
>>> Fixed.
>>>
>>>
>>>        
>>>>> +    if (strncmp(hbuf + 68, RBD_HEADER_VERSION, 8)) {
>>>>> +        error_report("Unknown image version %s", hbuf + 68);
>>>>> +        r = -EMEDIUMTYPE;
>>>>> +        goto failed;
>>>>> +    }
>>>>> +
>>>>> +    RbdHeader1 *header;
>>>>>
>>>>>
>>>>>
>>>>>            
>>>> Don't mix variable definitions with code.
>>>>
>>>>          
>>> Fixed.
>>>
>>>
>>>        
>>>>> +    s->efd = eventfd(0, 0);
>>>>> +    if (s->efd<      0) {
>>>>> +        error_report("error opening eventfd");
>>>>> +        goto failed;
>>>>> +    }
>>>>> +    fcntl(s->efd, F_SETFL, O_NONBLOCK);
>>>>> +    qemu_aio_set_fd_handler(s->efd, rbd_aio_completion_cb, NULL,
>>>>> +        rbd_aio_flush_cb, NULL, s);
>>>>>
>>>>>
>>>>>            
>>>> It looks like you just use the eventfd to signal aio completion
>>>> callbacks.
>>>>   A better way to do this would be to schedule a bottom half.  eventfds
>>>> are
>>>> Linux specific and specific to recent kernels.
>>>>
>>>>          
>>> Digging back why we introduced the eventfd, it was due to some issues
>>> seen with do_savevm() hangs on qemu_aio_flush(). The reason seemed
>>> that we had no fd associated with the block device, which seemed to
>>> not work well with the qemu aio model. If that assumption is wrong,
>>> we'd be happy to change it. In any case, there are other more portable
>>> ways to generate fds, so if it's needed we can do that.
>>>
>>>        
>> There's no fd at all?   How do you get notifications about an asynchronous
>> event completion?
>>
>> Regards,
>>
>> Anthony Liguori
>>
>>      
> (resending to list, sorry)
>
> The fd is hidden deep under in librados. We get callback notifications
> for events completion.
>    

How is that possible?  Are the callbacks delivered in the context of a 
different thread?  If so, don't you need locking?

Regards,

Anthony Liguori

> Thanks,
> Yehuda
>    

^ permalink raw reply

* Re: [Qemu-devel] [PATCH] ceph/rbd block driver for qemu-kvm (v4)
From: Anthony Liguori @ 2010-10-07 19:51 UTC (permalink / raw)
  To: Yehuda Sadeh Weinraub
  Cc: Christian Brunner, malc, kvm, qemu-devel, Kevin Wolf, ceph-devel
In-Reply-To: <AANLkTim2qfA+MncyF9Cx1oGYEzgW2TugG9sFTLP8T=J-@mail.gmail.com>

On 10/07/2010 01:41 PM, Yehuda Sadeh Weinraub wrote:
> On Thu, Oct 7, 2010 at 11:38 AM, Anthony Liguori<anthony@codemonkey.ws>  wrote:
>    
>> On 10/07/2010 01:08 PM, Yehuda Sadeh Weinraub wrote:
>>      
>>> On Thu, Oct 7, 2010 at 7:12 AM, Anthony Liguori<anthony@codemonkey.ws>
>>>   wrote:
>>>
>>>        
>>>> On 08/03/2010 03:14 PM, Christian Brunner wrote:
>>>>
>>>>          
>>>>> +#include "qemu-common.h"
>>>>> +#include "qemu-error.h"
>>>>> +#include<sys/types.h>
>>>>> +#include<stdbool.h>
>>>>> +
>>>>> +#include<qemu-common.h>
>>>>>
>>>>>
>>>>>            
>>>> This looks to be unnecessary.  Generally, system includes shouldn't be
>>>> required so all of these should go away except rado/librados.h
>>>>
>>>>          
>>> Removed.
>>>
>>>
>>>        
>>>>
>>>>          
>>>>> +
>>>>> +#include "rbd_types.h"
>>>>> +#include "module.h"
>>>>> +#include "block_int.h"
>>>>> +
>>>>> +#include<stdio.h>
>>>>> +#include<stdlib.h>
>>>>> +#include<rados/librados.h>
>>>>> +
>>>>> +#include<signal.h>
>>>>> +
>>>>> +
>>>>> +int eventfd(unsigned int initval, int flags);
>>>>>
>>>>>
>>>>>            
>>>> This is not quite right.  Depending on eventfd is curious but in the very
>>>> least, you need to detect the presence of eventfd in configure and
>>>> provide a
>>>> wrapper that redefines it as necessary.
>>>>
>>>>          
>>> Can fix that, though please see my later remarks.
>>>
>>>        
>>>>> +static int create_tmap_op(uint8_t op, const char *name, char
>>>>> **tmap_desc)
>>>>> +{
>>>>> +    uint32_t len = strlen(name);
>>>>> +    /* total_len = encoding op + name + empty buffer */
>>>>> +    uint32_t total_len = 1 + (sizeof(uint32_t) + len) +
>>>>> sizeof(uint32_t);
>>>>> +    char *desc = NULL;
>>>>>
>>>>>
>>>>>            
>>>> char is the wrong type to use here as it may be signed or unsigned.  That
>>>> can have weird effects with binary data when you're directly manipulating
>>>> it.
>>>>
>>>>          
>>> Well, I can change it to uint8_t, so that it matches the op type, but
>>> that'll require adding some other castings. In any case, you usually
>>> get such a weird behavior when you cast to types of different sizes
>>> and have the sign bit padded which is not the case in here.
>>>
>>>
>>>        
>>>>
>>>>          
>>>>> +
>>>>> +    desc = qemu_malloc(total_len);
>>>>> +
>>>>> +    *tmap_desc = desc;
>>>>> +
>>>>> +    *desc = op;
>>>>> +    desc++;
>>>>> +    memcpy(desc,&len, sizeof(len));
>>>>> +    desc += sizeof(len);
>>>>> +    memcpy(desc, name, len);
>>>>> +    desc += len;
>>>>> +    len = 0;
>>>>> +    memcpy(desc,&len, sizeof(len));
>>>>> +    desc += sizeof(len);
>>>>>
>>>>>
>>>>>            
>>>> Shouldn't endianness be a concern?
>>>>
>>>>          
>>> Right. Fixed that.
>>>
>>>
>>>        
>>>>
>>>>          
>>>>> +
>>>>> +    return desc - *tmap_desc;
>>>>> +}
>>>>> +
>>>>> +static void free_tmap_op(char *tmap_desc)
>>>>> +{
>>>>> +    qemu_free(tmap_desc);
>>>>> +}
>>>>> +
>>>>> +static int rbd_register_image(rados_pool_t pool, const char *name)
>>>>> +{
>>>>> +    char *tmap_desc;
>>>>> +    const char *dir = RBD_DIRECTORY;
>>>>> +    int ret;
>>>>> +
>>>>> +    ret = create_tmap_op(CEPH_OSD_TMAP_SET, name,&tmap_desc);
>>>>> +    if (ret<      0) {
>>>>> +        return ret;
>>>>> +    }
>>>>> +
>>>>> +    ret = rados_tmap_update(pool, dir, tmap_desc, ret);
>>>>> +    free_tmap_op(tmap_desc);
>>>>> +
>>>>> +    return ret;
>>>>> +}
>>>>>
>>>>>
>>>>>            
>>>> This ops are all synchronous?  IOW, rados_tmap_update() call blocks until
>>>> the operation is completed?
>>>>
>>>>          
>>> Yeah. And this is only called from the rbd_create() callback.
>>>
>>>
>>>        
>>>>> +            header_snap += strlen(header_snap) + 1;
>>>>> +            if (header_snap>      end)
>>>>> +                error_report("bad header, snapshot list broken");
>>>>>
>>>>>
>>>>>            
>>>> Missing curly braces here.
>>>>
>>>>          
>>> Fixed.
>>>
>>>
>>>        
>>>>> +    if (strncmp(hbuf + 68, RBD_HEADER_VERSION, 8)) {
>>>>> +        error_report("Unknown image version %s", hbuf + 68);
>>>>> +        r = -EMEDIUMTYPE;
>>>>> +        goto failed;
>>>>> +    }
>>>>> +
>>>>> +    RbdHeader1 *header;
>>>>>
>>>>>
>>>>>
>>>>>            
>>>> Don't mix variable definitions with code.
>>>>
>>>>          
>>> Fixed.
>>>
>>>
>>>        
>>>>> +    s->efd = eventfd(0, 0);
>>>>> +    if (s->efd<      0) {
>>>>> +        error_report("error opening eventfd");
>>>>> +        goto failed;
>>>>> +    }
>>>>> +    fcntl(s->efd, F_SETFL, O_NONBLOCK);
>>>>> +    qemu_aio_set_fd_handler(s->efd, rbd_aio_completion_cb, NULL,
>>>>> +        rbd_aio_flush_cb, NULL, s);
>>>>>
>>>>>
>>>>>            
>>>> It looks like you just use the eventfd to signal aio completion
>>>> callbacks.
>>>>   A better way to do this would be to schedule a bottom half.  eventfds
>>>> are
>>>> Linux specific and specific to recent kernels.
>>>>
>>>>          
>>> Digging back why we introduced the eventfd, it was due to some issues
>>> seen with do_savevm() hangs on qemu_aio_flush(). The reason seemed
>>> that we had no fd associated with the block device, which seemed to
>>> not work well with the qemu aio model. If that assumption is wrong,
>>> we'd be happy to change it. In any case, there are other more portable
>>> ways to generate fds, so if it's needed we can do that.
>>>
>>>        
>> There's no fd at all?   How do you get notifications about an asynchronous
>> event completion?
>>
>> Regards,
>>
>> Anthony Liguori
>>
>>      
> (resending to list, sorry)
>
> The fd is hidden deep under in librados. We get callback notifications
> for events completion.
>    

How is that possible?  Are the callbacks delivered in the context of a 
different thread?  If so, don't you need locking?

Regards,

Anthony Liguori

> Thanks,
> Yehuda
>    


^ permalink raw reply

* Re: Odd memory usage in auditd
From: Steve Grubb @ 2010-10-07 19:51 UTC (permalink / raw)
  To: linux-audit
In-Reply-To: <DF69A264612A3D4B961979B6957E8CFB0186F4D3@NEXCHANGE.nexor.co.uk>

On Thursday, October 07, 2010 05:52:49 am Ross Kirk wrote:
> Has anybody got any advice for the following problem? As I'm seeing some
> very odd behaviour with the auditd daemon in RHEL5.2 where under heavy
> system load the auditd process doesn't free any resources until all memory
> is consumed and the kernel kills the process with an Out Of Memory error.

I seem to recall something about disk flushing causing auditd to look like its 
the culprit. Do you have barriers enabled on ext3? You might also try setting 
the flushing to something else like none and see if that does anything.


> The system I have is a heavily customised RHEL5.2 with some fairly
> stringent auditing rules specified, the config is attached. In addition to
> these rules there will be various SELinux AVCs being raised as well as
> events from my own software so the auditing system is kept quite busy, see
> the attached report.txt for the aureport summary .

I don't see anything terribly unusual. The audit rules didn't make it, but the 
backlog setting is the only thing I would be interested in seeing.



> I can reproduce this behaviour consistently by generating a heavy system
> load (CPU 100% usage) while also generating a significant number of audit
> events. After about 20 minutes the auditd process will have grown from 8Mb
> of memory to around 1Gb;
> 
>   PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
> 
> 3037 root      16  -3 2763m 921m   16 S  3.7 91.2   0:26.49 auditd
> 
> If the system is kept busy eventually auditd will consume all the memory
> available on the system and the process be killed by the kernel with an
> Out Of Memory error.

Try playing with the disk flushing and let us know how that works out. There 
are no known memory leaks in recent version of auditd. I try to keep malloc 
down to a minimum to prevent this and memory fragmentation to creep in.

-Steve

^ permalink raw reply

* Restricting USB access
From: Ryan Lawrie @ 2010-10-07 19:50 UTC (permalink / raw)
  To: linux-hotplug


Good afternoon,

Just wondering if I could get your assistance with something.

I need to secure the USB ports on my LAN workstations so they are not
writable by users (other than a certain group that I specify). Is this type
of restriction possible using udev rules?

I was using PolicyKit before but since we've changed OS (from openSUSE11.0
to 64-bit openSUSE11.2) that no longer seems to function properly.
Everybody has access to the USB ports now.

Any assistance you can offer would be greatly appreciated.

Take care,
Ryan Lawrie







^ permalink raw reply


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.