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 3ABEDAC1416 for ; Mon, 24 Jul 2023 14:21:38 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=M72JDQ2PJQOV/BaMaUmGaAy5DThu1THikj68/zJKgHg=; c=relaxed/simple; d=groups.io; h=X-Received:X-Received:X-Received:X-Received:X-Received:X-Gm-Message-State:X-Google-Smtp-Source:X-Received:MIME-Version:References:In-Reply-To:From:Date:X-Gmail-Original-Message-ID:Message-ID:Subject:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding; s=20140610; t=1690208496; v=1; b=K2X5XOccXqZSxbbkpW5Moyf2THmWLCv/4A8Nvd3qzdILNj5N1RhY/GukkmJmy6+IZY5iefWe ddTU+zPsE/Vf1eBvCZnHa4PasbusbLi1L2+6y8Hmo+jWrcoBiE94gyAaNHMgbtFV/bMKjbNSf1I IJhcQUg2jTNJRr1/KRg8YO7c= X-Received: by 127.0.0.2 with SMTP id 8hCkYY7687511xDrzy6trbmK; Mon, 24 Jul 2023 07:21:36 -0700 X-Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web11.49002.1690208496353629561 for ; Mon, 24 Jul 2023 07:21:36 -0700 X-Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C903B61229 for ; Mon, 24 Jul 2023 14:21:35 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F92AC433CD for ; Mon, 24 Jul 2023 14:21:35 +0000 (UTC) X-Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-2b700e85950so61929531fa.3 for ; Mon, 24 Jul 2023 07:21:35 -0700 (PDT) X-Gm-Message-State: IvwkBEkZB2axpwQoBAabeRghx7686176AA= X-Google-Smtp-Source: APBJJlHchah7oSK3QqtMBppkLfwBHZeigcWDWDkAmFp/eMqsbYXzjsdxSWbyvquiF8cUcs4o+auXjH4BAroMHcEpB8c= X-Received: by 2002:a2e:9649:0:b0:2b7:14d4:ce6d with SMTP id z9-20020a2e9649000000b002b714d4ce6dmr6622985ljh.48.1690208493219; Mon, 24 Jul 2023 07:21:33 -0700 (PDT) MIME-Version: 1.0 References: <20230720134557.3903923-1-ardb@kernel.org> In-Reply-To: From: "Ard Biesheuvel" Date: Mon, 24 Jul 2023 16:21:22 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [edk2-devel] [RFC/RFT PATCH] OvmfPkg/IoMmuDxe: don't rely on TPLs for re-entrancy To: Pedro Falcato Cc: devel@edk2.groups.io, Gerd Hoffmann , Jiewen Yao , Michael Brown 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,ardb@kernel.org List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: 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=K2X5XOcc; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (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 Sat, 22 Jul 2023 at 00:55, Pedro Falcato wrote= : > > On Thu, Jul 20, 2023 at 2:46=E2=80=AFPM Ard Biesheuvel = wrote: > > > > Instead of relying on raising the TPL to protect the critical sections > > that manipulate the global bitmask that keeps track of bounce buffer > > allocations, use compare-and-exchange to manage the global variable, an= d > > tweak the logic to line up with that. > > > > Given that IoMmuDxe implements a singleton protocol that is shared > > between multiple drivers, and considering the elaborate and confusing > > requirements in the UEFP spec regarding TPL levels at which protocol > > methods may be invoked, not relying on TPL levels at all is a more > > Really good change (I had thought of this when reading through the > other IoMmuDxe thread), but I'm wondering if this warrants the > addition of bit ops (AND, OR at least) to SynchronizationLib? > Thanks. Atomic AND/OR would only help on the free path in this case. > Sidenote: the compiler can detect if atomic intrinsics use the "fetch" > value in (fetch_or, or_fetch, etc) and thus use smaller, more > efficient instruction sequences (https://godbolt.org/z/zWTTWacEd). if > only we could use those... > In principle, I'd agree but these are rarely used so I'm not sure it's worth the effort refactoring this. -=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 (#107171): https://edk2.groups.io/g/devel/message/107171 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] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-