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 D150E7803D2 for ; Thu, 24 Aug 2023 08:06:52 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=kHa9HWkjtjpOoSm7qOg2JS7ZSq7sQondBavEuC2mQzU=; c=relaxed/simple; d=groups.io; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Disposition:Content-Transfer-Encoding; s=20140610; t=1692864411; v=1; b=etPv/iE99hFHaNGeksTWF8Ga2hD8qRUbQPI0X9kSF3Jqww/ACa+B0P6drs5G3UqD/RvX69xt JLIIL8Em7QWZ67Pi6t+8+Qd2z9Tbg2+LUeEd7KTxJwHAOTSM3Lz5lNmFILRVMaOqEmEXMseP/Hd +75277yy8fSTvDYrhWDQFCUs= X-Received: by 127.0.0.2 with SMTP id JgaqYY7687511xeSkHED9duh; Thu, 24 Aug 2023 01:06:51 -0700 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.web11.6091.1692864410800602242 for ; Thu, 24 Aug 2023 01:06:51 -0700 X-Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-637-zEH1Y9t_MWu9vmPZ6urhDw-1; Thu, 24 Aug 2023 04:06:44 -0400 X-MC-Unique: zEH1Y9t_MWu9vmPZ6urhDw-1 X-Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 223AC38035AE; Thu, 24 Aug 2023 08:06:44 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.155]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DBCBA6B2B3; Thu, 24 Aug 2023 08:06:43 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 9085D18003AB; Thu, 24 Aug 2023 10:06:42 +0200 (CEST) Date: Thu, 24 Aug 2023 10:06:42 +0200 From: "Gerd Hoffmann" To: Pedro Falcato Cc: devel@edk2.groups.io, ardb@kernel.org, Jiewen Yao , Michael Brown , Tom Lendacky , Michael Roth Subject: Re: [edk2-devel] [RFC/RFT PATCH] OvmfPkg/IoMmuDxe: don't rely on TPLs for re-entrancy Message-ID: References: <20230720134557.3903923-1-ardb@kernel.org> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.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,kraxel@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: ygGwg9KsQU2vtkOPd2ZPNiXmx7686176AA= Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b="etPv/iE9"; 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 Wed, Aug 23, 2023 at 07:10:52PM +0100, Pedro Falcato wrote: > On Wed, Aug 23, 2023 at 4:12 PM Ard Biesheuvel wrote: > > > > On Wed, 23 Aug 2023 at 13:08, Gerd Hoffmann wrote: > > > > > > Hmm, QE reports back it slows down the boot alot. No boot hangs yet > > > with 12 test runs so far, which isn't that much for a reproduce rate > > > below 20% ... > > > > > > https://bugzilla.redhat.com//show_bug.cgi?id=2211060#c28 > > > > > > So I guess we go with the TPL version for the coming stable tag and > > > leave any improvements for later ... > > > > Yeah, this was not going to make the stable tag in any case. > > > > The boot speed regression seems odd, though - this is effectively UP > > code so there shouldn't be any contention, the only thing this patch > > does is ensure that the critical section is restarted if it was > > interrupted QE reported back boot times without this patch are ~20-30 seconds, with this patch it can be more than 3 minutes. > FWIW: Given completely correct logic, straightforward logic, a lock > cmpxchg is much slower(3-4x) than an a non-lock cmpxchg, which itself > is around 2x as slow as a regular relaxed load + store. > See https://gist.github.com/heatd/49c9be23ccb1f4ad8dfeac231da2647a for > a nice fun test benchmark. Also note that IoMmuDxe is only used in case memory encryption is enabled (I/O uses unencrypted bounce buffers so the host can virtio emulation can read/write stuff there). Maybe that affects performance too. Cc'ing the AMD people for comments on that. > HOWEVER, given this is likely in IO paths, I would *really* not expect > this to make a difference, right? Even virtio drivers will themselves > trap with a VMEXIT whenever you touch a hardware register... It's only a single VMEXIT per I/O request (ring the doorbell after adding a request to the ring), but still, this is heavy enough that the cmpxchg difference should be in the noise. > Gerd, could you folks get a perf kvm (perf-kvm(1)) recording out of > that OVMF build? Assuming you can get that thing to work, that is, > personally it mysteriously stopped working 6 years ago for me :) I can try hack IoMmuDxe so it is used unconditionally and try reproduce locally (without sev-capable hardware), but most likely not this week. take care, Gerd -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108000): https://edk2.groups.io/g/devel/message/108000 Mute This Topic: https://groups.io/mt/100256049/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-