Re: [Qemu-devel] [PATCH 3/3] qga: implement qmp_guest_set_vcpus() for Linux with sysfs

2013-03-06 Thread Eric Blake
On 03/05/2013 05:44 PM, Laszlo Ersek wrote: > > Anyway I'd prefer to avoid direct write()s with nbyte > 1 as I'd have to > handle partial transfers, if for nothing else than principle. (IIRC > avoiding that loop was my main motivation for stdio.) Fair enough - this code is not a hotspot, so stdio

Re: [Qemu-devel] [PATCH 3/3] qga: implement qmp_guest_set_vcpus() for Linux with sysfs

2013-03-06 Thread Paolo Bonzini
> On 03/06/13 00:37, Eric Blake wrote: > > > I guess I had in my mind %c instead of %u; still, I can't help but > > wonder if fprintf() and buffering is overkill, compared to just > > doing > > something like this: > > write(fd, &"01"[vcpu->online], 1); > > > > (okay, I hope you would favor read

Re: [Qemu-devel] [PATCH 3/3] qga: implement qmp_guest_set_vcpus() for Linux with sysfs

2013-03-05 Thread Laszlo Ersek
On 03/06/13 00:37, Eric Blake wrote: > I guess I had in my mind %c instead of %u; still, I can't help but > wonder if fprintf() and buffering is overkill, compared to just doing > something like this: > write(fd, &"01"[vcpu->online], 1); > > (okay, I hope you would favor readability over my comp

Re: [Qemu-devel] [PATCH 3/3] qga: implement qmp_guest_set_vcpus() for Linux with sysfs

2013-03-05 Thread Eric Blake
On 03/05/2013 04:23 PM, Laszlo Ersek wrote: > For an already online CPU: > > # dd of=/sys/devices/system/cpu/cpu1/online bs=1 count=1 <<<1 > dd: writing `/sys/devices/system/cpu/cpu1/online': Invalid argument > [...] So we really do have to read existing state to avoid an error when the user didn

Re: [Qemu-devel] [PATCH 3/3] qga: implement qmp_guest_set_vcpus() for Linux with sysfs

2013-03-05 Thread Laszlo Ersek
On 03/05/13 22:19, Eric Blake wrote: > On 03/04/2013 03:19 PM, Laszlo Ersek wrote: >> +} else { >> +unsigned online; >> + >> +if (fscanf(f, "%u", &online) != 1) { >> +error_setg(&local_err, "failed to read or parse \"%s\"", >> +

Re: [Qemu-devel] [PATCH 3/3] qga: implement qmp_guest_set_vcpus() for Linux with sysfs

2013-03-05 Thread Eric Blake
On 03/04/2013 03:19 PM, Laszlo Ersek wrote: > Signed-off-by: Laszlo Ersek > --- > qga/commands-posix.c | 51 > ++ > 1 files changed, 51 insertions(+), 0 deletions(-) > > diff --git a/qga/commands-posix.c b/qga/commands-posix.c > index d4b6bdc..1

Re: [Qemu-devel] [PATCH 3/3] qga: implement qmp_guest_set_vcpus() for Linux with sysfs

2013-03-05 Thread Laszlo Ersek
On 03/05/13 21:09, mdroth wrote: > Similar to comments in patch 2: is this supposed to be similar to the > /sys/devices/system/cpu/{probe,release} entries currently documented? I don't have those on RHEL-6, and they aren't mentioned in upstream "Documentation/cpu-hotplug.txt". "Documentation/ABI

Re: [Qemu-devel] [PATCH 3/3] qga: implement qmp_guest_set_vcpus() for Linux with sysfs

2013-03-05 Thread mdroth
On Mon, Mar 04, 2013 at 11:19:57PM +0100, Laszlo Ersek wrote: > > Signed-off-by: Laszlo Ersek > --- > qga/commands-posix.c | 51 > ++ > 1 files changed, 51 insertions(+), 0 deletions(-) > > diff --git a/qga/commands-posix.c b/qga/commands-posix

[Qemu-devel] [PATCH 3/3] qga: implement qmp_guest_set_vcpus() for Linux with sysfs

2013-03-04 Thread Laszlo Ersek
Signed-off-by: Laszlo Ersek --- qga/commands-posix.c | 51 ++ 1 files changed, 51 insertions(+), 0 deletions(-) diff --git a/qga/commands-posix.c b/qga/commands-posix.c index d4b6bdc..1848df8 100644 --- a/qga/commands-posix.c +++ b/qga/commands-