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=-5.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no 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 07B33C433E2 for ; Wed, 22 Jul 2020 07:55:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E21BA2077D for ; Wed, 22 Jul 2020 07:55:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727993AbgGVHzv (ORCPT ); Wed, 22 Jul 2020 03:55:51 -0400 Received: from mx2.suse.de ([195.135.220.15]:36452 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726153AbgGVHzv (ORCPT ); Wed, 22 Jul 2020 03:55:51 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 8D778AEDA; Wed, 22 Jul 2020 07:55:56 +0000 (UTC) Date: Wed, 22 Jul 2020 09:55:46 +0200 From: Joerg Roedel To: Mike Stunes Cc: Joerg Roedel , "x86@kernel.org" , Tom Lendacky , "hpa@zytor.com" , Andy Lutomirski , Dave Hansen , Peter Zijlstra , Jiri Slaby , Dan Williams , Juergen Gross , Kees Cook , David Rientjes , Cfir Cohen , Erdem Aktas , Masami Hiramatsu , Sean Christopherson , Martin Radev , "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , "virtualization@lists.linux-foundation.org" Subject: Re: [PATCH v4 51/75] x86/sev-es: Handle MMIO events Message-ID: <20200722075546.GG6132@suse.de> References: <20200714120917.11253-1-joro@8bytes.org> <20200714120917.11253-52-joro@8bytes.org> <40D5C698-1ED2-4CCE-9C1D-07620A021A6A@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <40D5C698-1ED2-4CCE-9C1D-07620A021A6A@vmware.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Hi Mike, On Tue, Jul 21, 2020 at 09:01:44PM +0000, Mike Stunes wrote: > I’m running into an MMIO-related bug when I try testing this on our hypervisor. > > During boot, probe_roms (arch/x86/kernel/probe_roms.c) uses > romchecksum over the video ROM and extension ROM regions. In my test > VM, the video ROM romchecksum starts at virtual address > 0xffff8880000c0000 and has length 65536. But, at address > 0xffff8880000c4000, we switch from being video-ROM-backed to being > unbacked by anything. > > With SEV-ES enabled, our platform handles reads and writes to unbacked > memory by treating them as MMIO. So, the read from 0xffff8880000c4000 > causes a #VC, which is handled by do_early_exception. > > In handling the #VC, vc_slow_virt_to_phys fails for that address. My > understanding is that the #VC handler should then add an entry to the > page tables and retry the faulting access. Somehow, that isn’t > happening. From the hypervisor side, it looks like the guest is > looping somehow. (I think the VCPU is mostly unhalted and making > progress, but the guest never gets past that romchecksum.) The guest > never actually makes an MMIO vmgexit for that address. That sounds like your guest is in a page-fault loop, but I can't yet explain why. Can you please find out the instruction which is causing the #VC exception? If a page-fault happens during #VC emulation it is forwared to the page-fault handler, so this should work. But somehow this isn't happening or the page-fault handler can't map the faulting address. Regards, Joerg