diff mbox

[2/4] Enable sigbus_reraise for Solaris

Message ID 1332606390-3605-2-git-send-email-lee.essen@nowonline.co.uk
State New
Headers show

Commit Message

Lee Essen March 24, 2012, 4:26 p.m. UTC
sigbus_reraise is used by the kvm_wait_io_event function and is
needed on both Linux and Solaris. This patch adds CONFIG_SOLARIS
to the current CONFIG_LINUX only ifdef.

Signed-off-by: Lee Essen <lee.essen@nowonline.co.uk>
---
 cpus.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Comments

Stefan Hajnoczi March 27, 2012, 7:29 a.m. UTC | #1
On Sat, Mar 24, 2012 at 04:26:28PM +0000, Lee Essen wrote:
> sigbus_reraise is used by the kvm_wait_io_event function and is
> needed on both Linux and Solaris. This patch adds CONFIG_SOLARIS
> to the current CONFIG_LINUX only ifdef.
> 
> Signed-off-by: Lee Essen <lee.essen@nowonline.co.uk>
> ---
>  cpus.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)

I'm curious if this means Illumos KVM has MCE support?

Stefan
Lee Essen March 27, 2012, 11:41 a.m. UTC | #2
On 27/03/2012 08:29, Stefan Hajnoczi wrote:
> On Sat, Mar 24, 2012 at 04:26:28PM +0000, Lee Essen wrote:
>> sigbus_reraise is used by the kvm_wait_io_event function and is
>> needed on both Linux and Solaris. This patch adds CONFIG_SOLARIS
>> to the current CONFIG_LINUX only ifdef.
>>
>> Signed-off-by: Lee Essen<lee.essen@nowonline.co.uk>
>> ---
>>   cpus.c |    4 +++-
>>   1 files changed, 3 insertions(+), 1 deletions(-)
>
> I'm curious if this means Illumos KVM has MCE support?
>
> Stefan
>

KVM_CAP_MCE is defined and the supporting ioctl's seem to be there.

Not having this code enabled stops it working, and it was in the 
original illumos port .. but that's about as far as my knowledge goes on 
this.

Lee.
Andreas Färber March 27, 2012, 11:41 a.m. UTC | #3
Am 24.03.2012 17:26, schrieb Lee Essen:
> sigbus_reraise is used by the kvm_wait_io_event function and is
> needed on both Linux and Solaris. This patch adds CONFIG_SOLARIS
> to the current CONFIG_LINUX only ifdef.
> 
> Signed-off-by: Lee Essen <lee.essen@nowonline.co.uk>
> ---
>  cpus.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/cpus.c b/cpus.c
> index 25ba621..6550f22 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -455,7 +455,7 @@ static void cpu_signal(int sig)
>      exit_request = 1;
>  }
>  
> -#ifdef CONFIG_LINUX
> +#if defined(CONFIG_LINUX) || defined(CONFIG_SOLARIS)

As asked elsewhere: Linux was the only KVM platform so far. If
sigbus_reraise() is only used in some KVM function like you said, can't
this we guarded with #if defined(CONFIG_KVM) or similar so that we don't
have to expand this once FreeBSD etc. merge KVM support, i.e. feature-based?

Andreas

>  static void sigbus_reraise(void)
>  {
>      sigset_t set;
> @@ -491,7 +491,9 @@ static void qemu_init_sigbus(void)
>      action.sa_sigaction = (void (*)(int, siginfo_t*, void*))sigbus_handler;
>      sigaction(SIGBUS, &action, NULL);
>  
> +#if defined(CONFIG_LINUX)
>      prctl(PR_MCE_KILL, PR_MCE_KILL_SET, PR_MCE_KILL_EARLY, 0, 0);
> +#endif
>  }
>  
>  static void qemu_kvm_eat_signals(CPUArchState *env)
Jan Kiszka March 27, 2012, 11:45 a.m. UTC | #4
On 2012-03-27 13:41, Andreas Färber wrote:
> Am 24.03.2012 17:26, schrieb Lee Essen:
>> sigbus_reraise is used by the kvm_wait_io_event function and is
>> needed on both Linux and Solaris. This patch adds CONFIG_SOLARIS
>> to the current CONFIG_LINUX only ifdef.
>>
>> Signed-off-by: Lee Essen <lee.essen@nowonline.co.uk>
>> ---
>>  cpus.c |    4 +++-
>>  1 files changed, 3 insertions(+), 1 deletions(-)
>>
>> diff --git a/cpus.c b/cpus.c
>> index 25ba621..6550f22 100644
>> --- a/cpus.c
>> +++ b/cpus.c
>> @@ -455,7 +455,7 @@ static void cpu_signal(int sig)
>>      exit_request = 1;
>>  }
>>  
>> -#ifdef CONFIG_LINUX
>> +#if defined(CONFIG_LINUX) || defined(CONFIG_SOLARIS)
> 
> As asked elsewhere: Linux was the only KVM platform so far. If

Power, s390, soon also ARM? Also, this code is not KVM specific, MCE
forwarding is supposed to work with TCG as well.

That said, some generic HAVE_MCE_FORWARDING or so makes probably sense
when there are more platform supporting it.

Jan

> sigbus_reraise() is only used in some KVM function like you said, can't
> this we guarded with #if defined(CONFIG_KVM) or similar so that we don't
> have to expand this once FreeBSD etc. merge KVM support, i.e. feature-based?
> 
> Andreas
> 
>>  static void sigbus_reraise(void)
>>  {
>>      sigset_t set;
>> @@ -491,7 +491,9 @@ static void qemu_init_sigbus(void)
>>      action.sa_sigaction = (void (*)(int, siginfo_t*, void*))sigbus_handler;
>>      sigaction(SIGBUS, &action, NULL);
>>  
>> +#if defined(CONFIG_LINUX)
>>      prctl(PR_MCE_KILL, PR_MCE_KILL_SET, PR_MCE_KILL_EARLY, 0, 0);
>> +#endif
>>  }
>>  
>>  static void qemu_kvm_eat_signals(CPUArchState *env)
>
Jan Kiszka March 27, 2012, 11:47 a.m. UTC | #5
On 2012-03-27 13:45, Jan Kiszka wrote:
> On 2012-03-27 13:41, Andreas Färber wrote:
>> Am 24.03.2012 17:26, schrieb Lee Essen:
>>> sigbus_reraise is used by the kvm_wait_io_event function and is
>>> needed on both Linux and Solaris. This patch adds CONFIG_SOLARIS
>>> to the current CONFIG_LINUX only ifdef.
>>>
>>> Signed-off-by: Lee Essen <lee.essen@nowonline.co.uk>
>>> ---
>>>  cpus.c |    4 +++-
>>>  1 files changed, 3 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/cpus.c b/cpus.c
>>> index 25ba621..6550f22 100644
>>> --- a/cpus.c
>>> +++ b/cpus.c
>>> @@ -455,7 +455,7 @@ static void cpu_signal(int sig)
>>>      exit_request = 1;
>>>  }
>>>  
>>> -#ifdef CONFIG_LINUX
>>> +#if defined(CONFIG_LINUX) || defined(CONFIG_SOLARIS)
>>
>> As asked elsewhere: Linux was the only KVM platform so far. If
> 
> Power, s390, soon also ARM?

Err, forget about this part. :)

> Also, this code is not KVM specific, MCE
> forwarding is supposed to work with TCG as well.
> 
> That said, some generic HAVE_MCE_FORWARDING or so makes probably sense
> when there are more platform supporting it.
> 
> Jan
> 
>> sigbus_reraise() is only used in some KVM function like you said, can't
>> this we guarded with #if defined(CONFIG_KVM) or similar so that we don't
>> have to expand this once FreeBSD etc. merge KVM support, i.e. feature-based?
>>
>> Andreas
>>
>>>  static void sigbus_reraise(void)
>>>  {
>>>      sigset_t set;
>>> @@ -491,7 +491,9 @@ static void qemu_init_sigbus(void)
>>>      action.sa_sigaction = (void (*)(int, siginfo_t*, void*))sigbus_handler;
>>>      sigaction(SIGBUS, &action, NULL);
>>>  
>>> +#if defined(CONFIG_LINUX)
>>>      prctl(PR_MCE_KILL, PR_MCE_KILL_SET, PR_MCE_KILL_EARLY, 0, 0);
>>> +#endif
>>>  }
>>>  
>>>  static void qemu_kvm_eat_signals(CPUArchState *env)
>>
>
Jan Kiszka March 27, 2012, 11:54 a.m. UTC | #6
On 2012-03-27 13:47, Jan Kiszka wrote:
> On 2012-03-27 13:45, Jan Kiszka wrote:
>> On 2012-03-27 13:41, Andreas Färber wrote:
>>> Am 24.03.2012 17:26, schrieb Lee Essen:
>>>> sigbus_reraise is used by the kvm_wait_io_event function and is
>>>> needed on both Linux and Solaris. This patch adds CONFIG_SOLARIS
>>>> to the current CONFIG_LINUX only ifdef.
>>>>
>>>> Signed-off-by: Lee Essen <lee.essen@nowonline.co.uk>
>>>> ---
>>>>  cpus.c |    4 +++-
>>>>  1 files changed, 3 insertions(+), 1 deletions(-)
>>>>
>>>> diff --git a/cpus.c b/cpus.c
>>>> index 25ba621..6550f22 100644
>>>> --- a/cpus.c
>>>> +++ b/cpus.c
>>>> @@ -455,7 +455,7 @@ static void cpu_signal(int sig)
>>>>      exit_request = 1;
>>>>  }
>>>>  
>>>> -#ifdef CONFIG_LINUX
>>>> +#if defined(CONFIG_LINUX) || defined(CONFIG_SOLARIS)
>>>
>>> As asked elsewhere: Linux was the only KVM platform so far. If
>>
>> Power, s390, soon also ARM?
> 
> Err, forget about this part. :)
> 
>> Also, this code is not KVM specific, MCE
>> forwarding is supposed to work with TCG as well.

Hmm, but it's not implemented yet... Forgot about this minor detail.

Jan
Jan Kiszka March 27, 2012, 1:49 p.m. UTC | #7
On 2012-03-24 17:26, Lee Essen wrote:
> sigbus_reraise is used by the kvm_wait_io_event function and is
> needed on both Linux and Solaris. This patch adds CONFIG_SOLARIS
> to the current CONFIG_LINUX only ifdef.
> 
> Signed-off-by: Lee Essen <lee.essen@nowonline.co.uk>
> ---
>  cpus.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/cpus.c b/cpus.c
> index 25ba621..6550f22 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -455,7 +455,7 @@ static void cpu_signal(int sig)
>      exit_request = 1;
>  }
>  
> -#ifdef CONFIG_LINUX
> +#if defined(CONFIG_LINUX) || defined(CONFIG_SOLARIS)
>  static void sigbus_reraise(void)
>  {
>      sigset_t set;
> @@ -491,7 +491,9 @@ static void qemu_init_sigbus(void)
>      action.sa_sigaction = (void (*)(int, siginfo_t*, void*))sigbus_handler;
>      sigaction(SIGBUS, &action, NULL);
>  
> +#if defined(CONFIG_LINUX)
>      prctl(PR_MCE_KILL, PR_MCE_KILL_SET, PR_MCE_KILL_EARLY, 0, 0);
> +#endif

BTW, this looks suspicious. Are you sure Solaris delivers a compatible
SIGBUS with all the information KVM needs to translate it to a MCE? That
is not a KVM subsystem feature, it's a kernel feature that Solaris would
either have to provide in the same way as Linux, or you need some glue
code to translate the differences.

Jan
diff mbox

Patch

diff --git a/cpus.c b/cpus.c
index 25ba621..6550f22 100644
--- a/cpus.c
+++ b/cpus.c
@@ -455,7 +455,7 @@  static void cpu_signal(int sig)
     exit_request = 1;
 }
 
-#ifdef CONFIG_LINUX
+#if defined(CONFIG_LINUX) || defined(CONFIG_SOLARIS)
 static void sigbus_reraise(void)
 {
     sigset_t set;
@@ -491,7 +491,9 @@  static void qemu_init_sigbus(void)
     action.sa_sigaction = (void (*)(int, siginfo_t*, void*))sigbus_handler;
     sigaction(SIGBUS, &action, NULL);
 
+#if defined(CONFIG_LINUX)
     prctl(PR_MCE_KILL, PR_MCE_KILL_SET, PR_MCE_KILL_EARLY, 0, 0);
+#endif
 }
 
 static void qemu_kvm_eat_signals(CPUArchState *env)