From patchwork Fri Jan 31 16:37:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 11360271 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A99C292A for ; Fri, 31 Jan 2020 16:38:33 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8F9A0206F0 for ; Fri, 31 Jan 2020 16:38:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8F9A0206F0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ixZIJ-0007PP-8U; Fri, 31 Jan 2020 16:37:23 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ixZII-0007PK-8X for xen-devel@lists.xenproject.org; Fri, 31 Jan 2020 16:37:22 +0000 X-Inumbo-ID: f3cb125c-4447-11ea-8396-bc764e2007e4 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id f3cb125c-4447-11ea-8396-bc764e2007e4; Fri, 31 Jan 2020 16:37:21 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 9F137AD3C; Fri, 31 Jan 2020 16:37:20 +0000 (UTC) From: Jan Beulich To: "xen-devel@lists.xenproject.org" Message-ID: Date: Fri, 31 Jan 2020 17:37:22 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 Content-Language: en-US Subject: [Xen-devel] [PATCH v4 0/7] x86/HVM: implement memory read caching X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: George Dunlap , Andrew Cooper , Paul Durrant , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Emulation requiring device model assistance uses a form of instruction re-execution, assuming that the second (and any further) pass takes exactly the same path. This is a valid assumption as far as use of CPU registers goes (as those can't change without any other instruction executing in between), but is wrong for memory accesses. In particular it has been observed that Windows might page out buffers underneath an instruction currently under emulation (hitting between two passes). If the first pass translated a linear address successfully, any subsequent pass needs to do so too, yielding the exact same translation. Introduce a cache to make sure above described assumption holds. This is a very simplistic implementation for now: Only exact matches are satisfied (no overlaps or partial reads or anything). There's also some perhaps seemingly unrelated cleanup here which was found desirable on the way - the 3 initial patches are truly prereqs (at least in a contextual way), while the 2 last ones are just for things noticed along the way. 1: SVM: drop asm/hvm/emulate.h inclusion from vmcb.h 2: x86/HVM: rename a variable in __hvm_copy() 3: x86/HVM: introduce "curr" into hvmemul_rep_{mov,sto}s() 4: x86/HVM: implement memory read caching for insn emulation 5: x86/mm: use cache in guest_walk_tables() 6: x86/mm: drop p2mt parameter from map_domain_gfn() 7: x86/HVM: reduce scope of pfec in hvm_emulate_init_per_insn() Compared to v3 this is a major re-work to avoid passing around "cache" arguments, as is my understanding of the main feedback aspect for v3. I've also dropped (at least for the time being) add-on patches to seed the cache with PAE PDPTE values. Jan