kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH v2] x86: Halt on exit
@ 2019-05-13  9:58 Nadav Amit
  2019-05-20 14:21 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Nadav Amit @ 2019-05-13  9:58 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kvm, rkrcmar, 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. Remove the
__builtin_unreachable() as it is not needed anymore.

Signed-off-by: Nadav Amit <nadav.amit@gmail.com>
---
 lib/x86/io.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/x86/io.c b/lib/x86/io.c
index f3e01f7..f4ffb44 100644
--- a/lib/x86/io.c
+++ b/lib/x86/io.c
@@ -99,7 +99,11 @@ void exit(int code)
 #else
         asm volatile("out %0, %1" : : "a"(code), "d"((short)0xf4));
 #endif
-	__builtin_unreachable();
+
+	/* Fallback */
+	while (1) {
+		asm volatile("hlt" ::: "memory");
+	}
 }
 
 void __iomem *ioremap(phys_addr_t phys_addr, size_t size)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [kvm-unit-tests PATCH v2] x86: Halt on exit
  2019-05-13  9:58 [kvm-unit-tests PATCH v2] x86: Halt on exit Nadav Amit
@ 2019-05-20 14:21 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2019-05-20 14:21 UTC (permalink / raw)
  To: Nadav Amit; +Cc: kvm, rkrcmar

On 13/05/19 11:58, Nadav Amit wrote:
> In some cases, shutdown through the test device and Bochs might fail.
> Just hang in a loop that executes halt in such cases. Remove the
> __builtin_unreachable() as it is not needed anymore.
> 
> Signed-off-by: Nadav Amit <nadav.amit@gmail.com>
> ---
>  lib/x86/io.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/x86/io.c b/lib/x86/io.c
> index f3e01f7..f4ffb44 100644
> --- a/lib/x86/io.c
> +++ b/lib/x86/io.c
> @@ -99,7 +99,11 @@ void exit(int code)
>  #else
>          asm volatile("out %0, %1" : : "a"(code), "d"((short)0xf4));
>  #endif
> -	__builtin_unreachable();
> +
> +	/* Fallback */
> +	while (1) {
> +		asm volatile("hlt" ::: "memory");
> +	}
>  }
>  
>  void __iomem *ioremap(phys_addr_t phys_addr, size_t size)
> 

Queued, thanks.

Paolo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-20 14:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-13  9:58 [kvm-unit-tests PATCH v2] x86: Halt on exit Nadav Amit
2019-05-20 14:21 ` Paolo Bonzini

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).