diff mbox

[1/3] kvm tools: add signal placeholder to avoid balloon crash

Message ID 1313039267-25951-1-git-send-email-walimisdev@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

walimis Aug. 11, 2011, 5:07 a.m. UTC
If "kvm run" without balloon option, use "kvm balloon" may
crash kvm. Add signal placeholder to avoid this.

Signed-off-by: Liming Wang <walimisdev@gmail.com>
---
 tools/kvm/builtin-run.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

Comments

walimis Aug. 11, 2011, 7:21 a.m. UTC | #1
On Thu, Aug 11, 2011 at 10:29:05AM +0300, Sasha Levin wrote:
>On Thu, 2011-08-11 at 13:07 +0800, Liming Wang wrote:
>> If "kvm run" without balloon option, use "kvm balloon" may
>> crash kvm. Add signal placeholder to avoid this.
>> 
>> Signed-off-by: Liming Wang <walimisdev@gmail.com>
>> ---
>>  tools/kvm/builtin-run.c |    7 +++++++
>>  1 files changed, 7 insertions(+), 0 deletions(-)
>> 
>> diff --git a/tools/kvm/builtin-run.c b/tools/kvm/builtin-run.c
>> index fa5de27..d725834 100644
>> --- a/tools/kvm/builtin-run.c
>> +++ b/tools/kvm/builtin-run.c
>> @@ -280,6 +280,10 @@ static void handle_sigstop(int sig)
>>  	kvm_cpu__reboot();
>>  }
>>  
>> +static void handle_empty(int sig)
>> +{
>> +}
>> +
>>  static void *kvm_cpu_thread(void *arg)
>>  {
>>  	current_kvm_cpu		= arg;
>> @@ -469,6 +473,9 @@ int kvm_cmd_run(int argc, const char **argv, const char *prefix)
>>  	signal(SIGUSR2, handle_sigusr2);
>>  	signal(SIGKVMSTOP, handle_sigstop);
>>  	signal(SIGKVMRESUME, handle_sigusr2);
>> +	/* signal placeholder if not enable balloon */
>> +	signal(SIGKVMADDMEM, handle_empty);
>
>You can just do this:
>	signal(SIGKVMADDMEM, SIG_IGN);
>
>For both, and avoid the empty handler.
good. New patch will be sent.

walimis
>
>> +	signal(SIGKVMDELMEM, handle_empty);
>>  
>>  	nr_online_cpus = sysconf(_SC_NPROCESSORS_ONLN);
>>  
>
>-- 
>
>Sasha.
>
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sasha Levin Aug. 11, 2011, 7:29 a.m. UTC | #2
On Thu, 2011-08-11 at 13:07 +0800, Liming Wang wrote:
> If "kvm run" without balloon option, use "kvm balloon" may
> crash kvm. Add signal placeholder to avoid this.
> 
> Signed-off-by: Liming Wang <walimisdev@gmail.com>
> ---
>  tools/kvm/builtin-run.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/tools/kvm/builtin-run.c b/tools/kvm/builtin-run.c
> index fa5de27..d725834 100644
> --- a/tools/kvm/builtin-run.c
> +++ b/tools/kvm/builtin-run.c
> @@ -280,6 +280,10 @@ static void handle_sigstop(int sig)
>  	kvm_cpu__reboot();
>  }
>  
> +static void handle_empty(int sig)
> +{
> +}
> +
>  static void *kvm_cpu_thread(void *arg)
>  {
>  	current_kvm_cpu		= arg;
> @@ -469,6 +473,9 @@ int kvm_cmd_run(int argc, const char **argv, const char *prefix)
>  	signal(SIGUSR2, handle_sigusr2);
>  	signal(SIGKVMSTOP, handle_sigstop);
>  	signal(SIGKVMRESUME, handle_sigusr2);
> +	/* signal placeholder if not enable balloon */
> +	signal(SIGKVMADDMEM, handle_empty);

You can just do this:
	signal(SIGKVMADDMEM, SIG_IGN);

For both, and avoid the empty handler.

> +	signal(SIGKVMDELMEM, handle_empty);
>  
>  	nr_online_cpus = sysconf(_SC_NPROCESSORS_ONLN);
>
diff mbox

Patch

diff --git a/tools/kvm/builtin-run.c b/tools/kvm/builtin-run.c
index fa5de27..d725834 100644
--- a/tools/kvm/builtin-run.c
+++ b/tools/kvm/builtin-run.c
@@ -280,6 +280,10 @@  static void handle_sigstop(int sig)
 	kvm_cpu__reboot();
 }
 
+static void handle_empty(int sig)
+{
+}
+
 static void *kvm_cpu_thread(void *arg)
 {
 	current_kvm_cpu		= arg;
@@ -469,6 +473,9 @@  int kvm_cmd_run(int argc, const char **argv, const char *prefix)
 	signal(SIGUSR2, handle_sigusr2);
 	signal(SIGKVMSTOP, handle_sigstop);
 	signal(SIGKVMRESUME, handle_sigusr2);
+	/* signal placeholder if not enable balloon */
+	signal(SIGKVMADDMEM, handle_empty);
+	signal(SIGKVMDELMEM, handle_empty);
 
 	nr_online_cpus = sysconf(_SC_NPROCESSORS_ONLN);