All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Alexander Graf <agraf@suse.de>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [PATCH] Activate Virtualization On Demand
Date: Wed, 18 Mar 2009 08:43:46 +0200	[thread overview]
Message-ID: <49C09822.1000300@redhat.com> (raw)
In-Reply-To: <95BBDC8C-D5CD-4B46-A3F2-4C22C55AB113@suse.de>

Alexander Graf wrote:
>>
>> Please make sure cpu hotplug/hotunplug (and this suspend/resume) 
>> still work.
>
> Make sure as in test?

I use this:

#!/usr/bin/python

import commands, time, random

processors = int(commands.getoutput('getconf _NPROCESSORS_CONF'))

def fname(cpu):
    return '/sys/devices/system/cpu/cpu%s/online' % (cpu,)

def get_state(cpu):
    return int(file(fname(cpu)).read())

def set_state(cpu, state):
        file(fname(cpu), 'w').write(str(state))

try:
    while True:
        cpu = random.randint(1, processors - 1)
        state = 1 - get_state(cpu)
        set_state(cpu, state)
        time.sleep(1)
except KeyboardInterrupt:
    for cpu in range(1, processors):
        if not get_state(cpu):
            set_state(cpu, 1)


-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


  reply	other threads:[~2009-03-18  6:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-17  8:47 [PATCH] Activate Virtualization On Demand Alexander Graf
2009-03-17 12:04 ` Avi Kivity
2009-03-17 15:48   ` Alexander Graf
2009-03-18  6:43     ` Avi Kivity [this message]
2009-09-09 14:18 Alexander Graf
2009-09-14  5:05 ` Avi Kivity
2009-09-14 13:23 ` Marcelo Tosatti
2009-09-14 15:52   ` Alexander Graf
2009-09-14 16:14     ` Marcelo Tosatti
2009-09-14 16:25       ` Alexander Graf
2009-09-14 16:46         ` Marcelo Tosatti
2009-09-14 16:54           ` Alexander Graf
2009-09-15  9:37 Alexander Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49C09822.1000300@redhat.com \
    --to=avi@redhat.com \
    --cc=agraf@suse.de \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.