From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=FROM_EXCESS_BASE64, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BF96C04AA7 for ; Mon, 13 May 2019 13:51:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 578D920657 for ; Mon, 13 May 2019 13:51:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728943AbfEMNu7 (ORCPT ); Mon, 13 May 2019 09:50:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39298 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726866AbfEMNu7 (ORCPT ); Mon, 13 May 2019 09:50:59 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A9628307D91E; Mon, 13 May 2019 13:50:59 +0000 (UTC) Received: from flask (unknown [10.40.205.238]) by smtp.corp.redhat.com (Postfix) with SMTP id 947E05BBA1; Mon, 13 May 2019 13:50:57 +0000 (UTC) Received: by flask (sSMTP sendmail emulation); Mon, 13 May 2019 15:50:56 +0200 Date: Mon, 13 May 2019 15:50:56 +0200 From: Radim =?utf-8?B?S3LEjW3DocWZ?= To: Nadav Amit Cc: Paolo Bonzini , kvm@vger.kernel.org Subject: Re: [PATCH] x86: Halt on exit Message-ID: <20190513135055.GA8697@flask> References: <20190509195023.11933-1-nadav.amit@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190509195023.11933-1-nadav.amit@gmail.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 13 May 2019 13:50:59 +0000 (UTC) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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 > --- > 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.