Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp309581ybh; Wed, 22 Jul 2020 00:56:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8ntokF7/LS3PbGPsh2apTMt1Ig0tIQVQCF9QtIlUOsX3KHXqnjOhtpISiswYrWplzoLBe X-Received: by 2002:a17:906:4341:: with SMTP id z1mr28225634ejm.392.1595404605019; Wed, 22 Jul 2020 00:56:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595404605; cv=none; d=google.com; s=arc-20160816; b=xNeW5lQhw91y5JYGs17f0eriLQ1nSu1bXBBN1l9AAsckiPYWF5xXToKVWG+gKMMBgX ESkcPOpbMaI/B6hoOmm4NRnQl3fV1NP1PCaMKtMzRHHCWcQyk7zW72Z3kN5ROLFcUAom jvKFX6byTG607MCT5c4JyKk+CySyLG41EaA34mKQb48gg5aI6pFW3+y9ndF5/yruIsX1 rQD0G4ZZbvVcVIfqBCFJA/8HxdjsosvkvWURNICzJpGRTVh5Aiv04ICw4ldYmjWhSZfK V7jgEhr6l7pnupYeSnqh72JpAu7rR5q3XVkpw1DId9YpXHu3obK2EQZfD3EfZmgVm3s7 zUDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=NO0MllCVIfF5lvnjJuvoM2uEKzMc5xkv348G04yH8Eg=; b=H94yjSRQpRmRoCHoZjsJnI1rN27X1ihBbRnslcg98ik+4JHFpNm9tvgxoLYMOX0jLG Iu6ipHDGqCh0sYyLFXD3d/qAVHiswAsDV7z6mUsUzN9HhbOfrlShzPwvkaTWa4WJK3Ea mHPDnqe5hrrCbcS+kfsxmNOUpeOvJFSZm2SqnN6YsimHqfpMDJbHFEWfkwSQzNoIQXli 9hPYHHoLILekkWgyEgf4IFQzu8yKvktjMt4CqMVcclP6/euCeWHnOBvpRSpU4JSTECeC rCkbJnKi9H0oOuziF8D98WV89UCVKiJsFtk/K86bR8xqZKtlTQcdb9yKwPTHqIh8hEbI 9w8w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bd16si13504053edb.20.2020.07.22.00.56.21; Wed, 22 Jul 2020 00:56:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728053AbgGVHzv (ORCPT + 99 others); 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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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