Hello,
These patches fix a couple of small issues:
- generate a kobject change event so that udev is woken up on name
changes
- fix a crash after hot-unplug of the first console port and a
subsequent config update
But majorly, it reworks how ports are discovered: instead of numbering
the ports individually in the host and the guest by just incrementing
a number, we now switch to a bitmap in the config space exposed by the
host to identify active ports. This lets us maintain the same
numbering used by the host and also allows for hot-unplug via the
config space. This is needed for proper migration support after
several hot-plug/unplug operations.
I've tested these patches on my testsuite to catch any regression or
correctness issues. I've also tested all the hotplug-related changes
here.
These should go to 2.6.34, so that we don't push out a stable release
with the older interface. Michael, please forward these to Linus if
everyone is OK with these. I also have a git repo at
git://git.kernel.org/pub/scm/linux/kernel/git/amit/vs-kernel.git master
if you prefer to pull the patches.
Amit Shah (6):
virtio: console: Generate a kobject CHANGE event on adding 'name'
attribute
virtio: console: Check if port is valid in resize_console
virtio: console: Switch to using a port bitmap for port discovery
virtio: console: Separate out get_config in a separate function
virtio: console: Handle hot-plug/unplug config actions
virtio: console: Remove hot-unplug control message
drivers/char/virtio_console.c | 238 ++++++++++++++++++++++++----------------
include/linux/virtio_console.h | 15 ++-
2 files changed, 156 insertions(+), 97 deletions(-)
Amit Shah
2010-Mar-19 12:06 UTC
[PATCH 1/6] virtio: console: Generate a kobject CHANGE event on adding 'name' attribute
When the host lets us know what 'name' a port is assigned, we create the
sysfs 'name' attribute. Generate a 'change' event after this so
that
udev wakes up and acts on the rules for virtio-ports (currently there's
only one rule that creates a symlink from the 'name' to the actual char
device).
Signed-off-by: Amit Shah <amit.shah at redhat.com>
---
drivers/char/virtio_console.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index f404ccf..67b474b 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -947,11 +947,18 @@ static void handle_control_message(struct ports_device
*portdev,
*/
err = sysfs_create_group(&port->dev->kobj,
&port_attribute_group);
- if (err)
+ if (err) {
dev_err(port->dev,
"Error %d creating sysfs device attributes\n",
err);
-
+ } else {
+ /*
+ * Generate a udev event so that appropriate
+ * symlinks can be created based on udev
+ * rules.
+ */
+ kobject_uevent(&port->dev->kobj, KOBJ_CHANGE);
+ }
break;
case VIRTIO_CONSOLE_PORT_REMOVE:
/*
--
1.6.2.5
Amit Shah
2010-Mar-19 12:06 UTC
[PATCH 2/6] virtio: console: Check if port is valid in resize_console
The console port could have been hot-unplugged. Check if it is valid
before working on it.
Signed-off-by: Amit Shah <amit.shah at redhat.com>
---
drivers/char/virtio_console.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 67b474b..44288ce 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -681,6 +681,10 @@ static void resize_console(struct port *port)
struct virtio_device *vdev;
struct winsize ws;
+ /* The port could have been hot-unplugged */
+ if (!port)
+ return;
+
vdev = port->portdev->vdev;
if (virtio_has_feature(vdev, VIRTIO_CONSOLE_F_SIZE)) {
vdev->config->get(vdev,
--
1.6.2.5
On Fri, Mar 19, 2010 at 05:36:42PM +0530, Amit Shah wrote:> Hello, > > These patches fix a couple of small issues: > - generate a kobject change event so that udev is woken up on name > changes > - fix a crash after hot-unplug of the first console port and a > subsequent config update > > But majorly, it reworks how ports are discovered: instead of numbering > the ports individually in the host and the guest by just incrementing > a number, we now switch to a bitmap in the config space exposed by the > host to identify active ports. This lets us maintain the same > numbering used by the host and also allows for hot-unplug via the > config space. This is needed for proper migration support after > several hot-plug/unplug operations. > > I've tested these patches on my testsuite to catch any regression or > correctness issues. I've also tested all the hotplug-related changes > here. > > These should go to 2.6.34, so that we don't push out a stable release > with the older interface. > > Michael, please forward these to Linus if > everyone is OK with these.I have some concerns with the new ABI. I also expect Rusty to be back in a couple of days, maybe he'll find some time to review the patches. We'll also have to update the spec ... Would you like me to queue up the first 2 patches meanwhile?> I also have a git repo at > > git://git.kernel.org/pub/scm/linux/kernel/git/amit/vs-kernel.git master > > if you prefer to pull the patches. > Amit Shah (6): > virtio: console: Generate a kobject CHANGE event on adding 'name' > attribute > virtio: console: Check if port is valid in resize_console > virtio: console: Switch to using a port bitmap for port discovery > virtio: console: Separate out get_config in a separate function > virtio: console: Handle hot-plug/unplug config actions > virtio: console: Remove hot-unplug control message > > drivers/char/virtio_console.c | 238 ++++++++++++++++++++++++---------------- > include/linux/virtio_console.h | 15 ++- > 2 files changed, 156 insertions(+), 97 deletions(-)
Possibly Parallel Threads
- [PATCH 0/6] virtio: console: Fixes, abi update
- [PATCH 0/3] virtio: console: Handle multiple console port resizes
- [PATCH 0/3] virtio: console: Handle multiple console port resizes
- [PATCH v2 00/11] virtio: console: fixes for port unplug
- [PATCH v2 00/11] virtio: console: fixes for port unplug