* [PATCH] x86: Halt on exit
@ 2019-05-09 19:50 Nadav Amit
2019-05-10 3:34 ` Nadav Amit
2019-05-13 13:50 ` Radim Krčmář
0 siblings, 2 replies; 5+ messages in thread
From: Nadav Amit @ 2019-05-09 19:50 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm, Nadav Amit
In some cases, shutdown through the test device and Bochs might fail.
Just hang in a loop that executes halt in such cases.
Signed-off-by: Nadav Amit <nadav.amit@gmail.com>
---
lib/x86/io.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/x86/io.c b/lib/x86/io.c
index f3e01f7..e6372c6 100644
--- a/lib/x86/io.c
+++ b/lib/x86/io.c
@@ -99,6 +99,10 @@ void exit(int code)
#else
asm volatile("out %0, %1" : : "a"(code), "d"((short)0xf4));
#endif
+ /* Fallback */
+ while (1) {
+ asm volatile ("hlt" ::: "memory");
+ }
__builtin_unreachable();
}
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] x86: Halt on exit
2019-05-09 19:50 [PATCH] x86: Halt on exit Nadav Amit
@ 2019-05-10 3:34 ` Nadav Amit
2019-05-13 6:05 ` Xiaoyao Li
2019-05-13 13:50 ` Radim Krčmář
1 sibling, 1 reply; 5+ messages in thread
From: Nadav Amit @ 2019-05-10 3:34 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm
Err… kvm-unit-tests patch if there is any doubt.
> On May 9, 2019, at 12:50 PM, Nadav Amit <nadav.amit@gmail.com> wrote:
>
> In some cases, shutdown through the test device and Bochs might fail.
> Just hang in a loop that executes halt in such cases.
>
> Signed-off-by: Nadav Amit <nadav.amit@gmail.com>
> ---
> lib/x86/io.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/lib/x86/io.c b/lib/x86/io.c
> index f3e01f7..e6372c6 100644
> --- a/lib/x86/io.c
> +++ b/lib/x86/io.c
> @@ -99,6 +99,10 @@ void exit(int code)
> #else
> asm volatile("out %0, %1" : : "a"(code), "d"((short)0xf4));
> #endif
> + /* Fallback */
> + while (1) {
> + asm volatile ("hlt" ::: "memory");
> + }
> __builtin_unreachable();
> }
>
> --
> 2.17.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86: Halt on exit
2019-05-10 3:34 ` Nadav Amit
@ 2019-05-13 6:05 ` Xiaoyao Li
2019-05-13 6:13 ` Nadav Amit
0 siblings, 1 reply; 5+ messages in thread
From: Xiaoyao Li @ 2019-05-13 6:05 UTC (permalink / raw)
To: Nadav Amit, Paolo Bonzini; +Cc: kvm
On 5/10/2019 11:34 AM, Nadav Amit wrote:
> Err… kvm-unit-tests patch if there is any doubt.
>
you should contain kvm-unit-tests in the subject as
[kvm-unit-tests PATCH]
otherwise, we don't know it's a kvm-unit-tests patch.
>> On May 9, 2019, at 12:50 PM, Nadav Amit <nadav.amit@gmail.com> wrote:
>>
>> In some cases, shutdown through the test device and Bochs might fail.
>> Just hang in a loop that executes halt in such cases.
>>
>> Signed-off-by: Nadav Amit <nadav.amit@gmail.com>
>> ---
>> lib/x86/io.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/lib/x86/io.c b/lib/x86/io.c
>> index f3e01f7..e6372c6 100644
>> --- a/lib/x86/io.c
>> +++ b/lib/x86/io.c
>> @@ -99,6 +99,10 @@ void exit(int code)
>> #else
>> asm volatile("out %0, %1" : : "a"(code), "d"((short)0xf4));
>> #endif
>> + /* Fallback */
>> + while (1) {
>> + asm volatile ("hlt" ::: "memory");
>> + }
>> __builtin_unreachable();
>> }
>>
>> --
>> 2.17.1
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86: Halt on exit
2019-05-13 6:05 ` Xiaoyao Li
@ 2019-05-13 6:13 ` Nadav Amit
0 siblings, 0 replies; 5+ messages in thread
From: Nadav Amit @ 2019-05-13 6:13 UTC (permalink / raw)
To: Xiaoyao Li; +Cc: Paolo Bonzini, kvm
> On May 12, 2019, at 11:05 PM, Xiaoyao Li <xiaoyao.li@intel.com> wrote:
>
> On 5/10/2019 11:34 AM, Nadav Amit wrote:
>> Err… kvm-unit-tests patch if there is any doubt.
> you should contain kvm-unit-tests in the subject as
> [kvm-unit-tests PATCH]
>
> otherwise, we don't know it's a kvm-unit-tests patch.
Thanks, I know. The “Err…” meant to say “Oops, I forgot the --subject-prefix,
please excuse me."
>
>>> On May 9, 2019, at 12:50 PM, Nadav Amit <nadav.amit@gmail.com> wrote:
>>>
>>> In some cases, shutdown through the test device and Bochs might fail.
>>> Just hang in a loop that executes halt in such cases.
>>>
>>> Signed-off-by: Nadav Amit <nadav.amit@gmail.com>
>>> ---
>>> lib/x86/io.c | 4 ++++
>>> 1 file changed, 4 insertions(+)
>>>
>>> diff --git a/lib/x86/io.c b/lib/x86/io.c
>>> index f3e01f7..e6372c6 100644
>>> --- a/lib/x86/io.c
>>> +++ b/lib/x86/io.c
>>> @@ -99,6 +99,10 @@ void exit(int code)
>>> #else
>>> asm volatile("out %0, %1" : : "a"(code), "d"((short)0xf4));
>>> #endif
>>> + /* Fallback */
>>> + while (1) {
>>> + asm volatile ("hlt" ::: "memory");
>>> + }
>>> __builtin_unreachable();
>>> }
>>>
>>> --
>>> 2.17.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86: Halt on exit
2019-05-09 19:50 [PATCH] x86: Halt on exit Nadav Amit
2019-05-10 3:34 ` Nadav Amit
@ 2019-05-13 13:50 ` Radim Krčmář
1 sibling, 0 replies; 5+ messages in thread
From: Radim Krčmář @ 2019-05-13 13:50 UTC (permalink / raw)
To: Nadav Amit; +Cc: Paolo Bonzini, kvm
2019-05-09 12:50-0700, Nadav Amit:
> In some cases, shutdown through the test device and Bochs might fail.
> Just hang in a loop that executes halt in such cases.
>
> Signed-off-by: Nadav Amit <nadav.amit@gmail.com>
> ---
> lib/x86/io.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/lib/x86/io.c b/lib/x86/io.c
> @@ -99,6 +99,10 @@ void exit(int code)
> #else
> asm volatile("out %0, %1" : : "a"(code), "d"((short)0xf4));
> #endif
> + /* Fallback */
> + while (1) {
> + asm volatile ("hlt" ::: "memory");
> + }
> __builtin_unreachable();
Looks good, we can also drop the __builtin_unreachable() now.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-05-13 13:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-09 19:50 [PATCH] x86: Halt on exit Nadav Amit
2019-05-10 3:34 ` Nadav Amit
2019-05-13 6:05 ` Xiaoyao Li
2019-05-13 6:13 ` Nadav Amit
2019-05-13 13:50 ` Radim Krčmář
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).