From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 146937803CE for ; Tue, 23 Jan 2024 14:13:32 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=acuE3A4sQ+tCldIqHoJ3txNw4BeYFLy3avh1qB5Ooog=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1706019211; v=1; b=BdY4JBCpJd7aR5vuaibuYVBiJ0TbSf2iw368ZhV1UrOJTlqHqU4rIgVePg4WCMIwV7L/U2u8 9qGT5mroc+C0Z/RhUE2jm6HOhFfSV7EGsDFcbscV6TLvwsv6ZTnX9AN6cVoCa5eHkb3xw4+NJWe 8818YcDio/zT8JreHt2GV5+g= X-Received: by 127.0.0.2 with SMTP id KvtAYY7687511xfcK2RHNVcu; Tue, 23 Jan 2024 06:13:31 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.13109.1706019211121431257 for ; Tue, 23 Jan 2024 06:13:31 -0800 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-203-c7DILbXLMjGtlaIiGFJlhw-1; Tue, 23 Jan 2024 09:13:26 -0500 X-MC-Unique: c7DILbXLMjGtlaIiGFJlhw-1 X-Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 72CE9916D62; Tue, 23 Jan 2024 14:13:25 +0000 (UTC) X-Received: from [10.39.194.212] (unknown [10.39.194.212]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AAFBC51D5; Tue, 23 Jan 2024 14:13:23 +0000 (UTC) Message-ID: <1708ba2b-c969-ee8a-2cbe-fdc9acd31998@redhat.com> Date: Tue, 23 Jan 2024 15:13:22 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH V1 1/1] UefiCpuPkg/ResetVector: Cache Disable should not be set by default in CR0 To: devel@edk2.groups.io, kraxel@redhat.com, "Brian J. Johnson" Cc: "West, Catharine" , "Xu, Min M" , "Ni, Ray" , "Wu, MingliangX" , "Yao, Jiewen" , "Xue, Shengfeng" , "Dong, Eric" , "Kumar, Rahul R" , "De, Debkumar" References: <20230726094754.171-1-xueshengfeng@byosoft.com.cn> <177562550EF0534C.27380@groups.io> <3505f62e-cc54-490e-983f-7b4312e41509@hpe.com> <3lxerlg6g5gbzsxyh2v4qqqxru34ewytbge2wm6s7quyx3itx6@xlajojgm73qe> From: "Laszlo Ersek" In-Reply-To: <3lxerlg6g5gbzsxyh2v4qqqxru34ewytbge2wm6s7quyx3itx6@xlajojgm73qe> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: qMl93rBqbnoVoKOEIfOUJI2nx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=BdY4JBCp; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io On 1/23/24 11:52, Gerd Hoffmann wrote: > On Mon, Jan 22, 2024 at 01:11:52PM -0600, Brian J. Johnson wrote: >> On 1/18/24 09:46, Gerd Hoffmann wrote: >>> On Wed, Jan 10, 2024 at 04:43:47PM +0000, West, Catharine wrote: >>>> Disabling cache by default results in violation of BTG protections (if= BTG enabled). >>>> BIOS cannot assume that cache is disabled before it executes as ACM ma= y be required to enable NEM. >>>> >>>> Whatever solution needs to be done here cannot evict ACM-enabled NEM. >>> >>> Well, it's OVMF in a virtual machine. No boot guard involved. >>> So we could probably go for a OVMF-specific patch here. >>> >>> But I'd prefer to figure what exactly is happening here before going >>> down that route. An extreme slowdown just because we flip that bit >>> doesn't make sense to me. >>> >>>> Why is boot time increasing? >>> >>> Not clear. It seems to be the lzma uncompress of the firmware volume >>> in rom / pflash which is very slow. Also it is apparently only >>> triggered in case pci device assignment is used. >> >> I've seen extreme slowness on physical platforms when we've mixed up the >> MTRRs or page tables, causing code to be mapped uncached. >> >> Lzma uncompress of ROM could be pretty slow as well, if the ROM is being >> read uncached. Lzma probably reads the data a byte at a time, which is = the >> worst case for uncached accesses. Since this is a VM, it's not actually >> uncached at the hardware level, but I don't know how QEMU/KVM handles >> uncached guest mappings.... It may be doing a VMEXIT for every byte. >> >> Anyway, I suggest double-checking your page tables and MTRRs. >=20 > It happens very early at boot, before MTRRs are setup, running on the > initial page tables created by the OVMF reset vector. The initial page > tables have just 'accessed', 'dirty', 'read/write' and 'present' bits > set for the 0-4G identity mapping. >=20 > It seems to have something to do with EPT. It does not happen on AMD > processors. It also does not happen when disabling EPT support in kvm > on the host machine. >=20 > looked at kvm kernel traces, I don't see excessive vmexits. This discussion evokes vague memories in me. I'll dump them here, but I have no idea if they will be useful. (They probably won't.) - edk2 commit 98f378a7be12 ("OvmfPkg/ResetVector: enable caching in initial page tables", 2013-09-24) - Linux (host) commit 879ae1880449 ("KVM: x86: obey KVM_X86_QUIRK_CD_NW_CLEARED in kvm_set_cr0()", 2015-11-04) Laszlo -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114202): https://edk2.groups.io/g/devel/message/114202 Mute This Topic: https://groups.io/mt/100367559/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-