From nobody Mon May 6 05:53:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=yadro.com ARC-Seal: i=1; a=rsa-sha256; t=1585417588; cv=none; d=zohomail.com; s=zohoarc; b=gSiASM5x9gf7GsUjeYIBZxpXSWm+qS7EjZPnQeDtjVDTSxzpQiMqKpyBEA9royxI3mtcxoZhz3RnNv4g53CW7EQ0HDs42wdt2M/fkMUGfaBYxgXSibSZ+svZVEvisIVmlCkR+5Jj2EVPHtSO1gHzSaQSq+/74lOtytt1ALR8+AQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585417588; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=Xf/1nOXVs+JvwQyq7YQfhS4lux8E6n6rcc65pKCkiZM=; b=XTXUh7LaL87wztSmelhJytalM9RHAq/20vd2aWTxQpSthp0Z7e9D/N/MPdNT+WbDBZSW8o92dm7aDq7azuks0eyH51brW0G0/jf3em8ZfhXLuiVu5PZvYeCx/0LJQtOZjGAxb0RgRXGok6zARroUY/sUDi9NdxYE4+M1ZReQHkQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585417588476778.3378257920102; Sat, 28 Mar 2020 10:46:28 -0700 (PDT) Received: from localhost ([::1]:57580 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jIFXN-0006qC-6D for importer@patchew.org; Sat, 28 Mar 2020 13:46:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34090) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jIFWG-0006Hn-7u for qemu-devel@nongnu.org; Sat, 28 Mar 2020 13:45:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jIFWF-0000sP-1J for qemu-devel@nongnu.org; Sat, 28 Mar 2020 13:45:15 -0400 Received: from mta-02.yadro.com ([89.207.88.252]:40972 helo=mta-01.yadro.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jIFWE-0000nQ-QD for qemu-devel@nongnu.org; Sat, 28 Mar 2020 13:45:14 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id DA561412DA; Sat, 28 Mar 2020 17:45:10 +0000 (UTC) Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id i1DHzTqAqgd4; Sat, 28 Mar 2020 20:45:09 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id 059C5412CB; Sat, 28 Mar 2020 20:45:08 +0300 (MSK) Received: from localhost (172.17.204.212) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Sat, 28 Mar 2020 20:45:09 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :x-mailer:message-id:date:date:subject:subject:from:from :received:received:received; s=mta-01; t=1585417509; x= 1587231910; bh=Udyoa3LjlUgI1rSeYge8kutvebyYOeEvQGZR6iYpivw=; b=E pJOLEkWLWL8hxJL57dz8RygMmQtoMV5CigiyC4VAekzNE4DfzGX5z2YeE+l1Jl0G zvhM9rk3dKhMxJStEAkDcUPEotuPRj0jWOeDJfZLO6mKpgmWGBAs/4CzxAczehAs 0+l5r6S9sURQk9ye9tVoc0W5tiHlUBQ5sYu6Yy4XKE= X-Virus-Scanned: amavisd-new at yadro.com From: Roman Bolshakov To: Subject: [PATCH] i386: hvf: Reset IRQ inhibition after moving RIP Date: Sat, 28 Mar 2020 20:44:12 +0300 Message-ID: <20200328174411.51491-1-r.bolshakov@yadro.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 X-Originating-IP: [172.17.204.212] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 89.207.88.252 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Roman Bolshakov , Eduardo Habkost , Cameron Esfahani , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The sequence of instructions exposes an issue: sti hlt Interrupts cannot be delivered to hvf after hlt instruction cpu because HF_INHIBIT_IRQ_MASK is set just before hlt is handled and never reset after moving instruction pointer beyond hlt. So, after hvf_vcpu_exec() returns, CPU thread gets locked up forever in qemu_wait_io_event() (cpu_thread_is_idle() evaluates inhibition flag and considers the CPU idle if the flag is set). Cc: Cameron Esfahani Signed-off-by: Roman Bolshakov Reviewed-by: Cameron Esfahani --- target/i386/hvf/vmx.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/i386/hvf/vmx.h b/target/i386/hvf/vmx.h index 03d2c79b9c..ce2a1532d5 100644 --- a/target/i386/hvf/vmx.h +++ b/target/i386/hvf/vmx.h @@ -167,6 +167,8 @@ static inline void macvm_set_cr4(hv_vcpuid_t vcpu, uint= 64_t cr4) =20 static inline void macvm_set_rip(CPUState *cpu, uint64_t rip) { + X86CPU *x86_cpu =3D X86_CPU(cpu); + CPUX86State *env =3D &x86_cpu->env; uint64_t val; =20 /* BUG, should take considering overlap.. */ @@ -176,6 +178,7 @@ static inline void macvm_set_rip(CPUState *cpu, uint64_= t rip) val =3D rvmcs(cpu->hvf_fd, VMCS_GUEST_INTERRUPTIBILITY); if (val & (VMCS_INTERRUPTIBILITY_STI_BLOCKING | VMCS_INTERRUPTIBILITY_MOVSS_BLOCKING)) { + env->hflags &=3D ~HF_INHIBIT_IRQ_MASK; wvmcs(cpu->hvf_fd, VMCS_GUEST_INTERRUPTIBILITY, val & ~(VMCS_INTERRUPTIBILITY_STI_BLOCKING | VMCS_INTERRUPTIBILITY_MOVSS_BLOCKING)); --=20 2.24.1