From: Baolu Lu <baolu.lu@linux.intel.com>
To: "Tian, Kevin" <kevin.tian@intel.com>,
"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
"x86@kernel.org" <x86@kernel.org>,
"linux-coco@lists.linux.dev" <linux-coco@lists.linux.dev>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Cc: baolu.lu@linux.intel.com, Jason Gunthorpe <jgg@ziepe.ca>,
Kiryl Shutsemau <kas@kernel.org>,
"Edgecombe, Rick P" <rick.p.edgecombe@intel.com>,
"yilun.xu@linux.intel.com" <yilun.xu@linux.intel.com>,
"Li, Xiaoyao" <xiaoyao.li@intel.com>,
"Gao, Chao" <chao.gao@intel.com>,
Binbin Wu <binbin.wu@linux.intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 5/9] iommu/vt-d: Block GCMD and ECMD while acquired by the TDX module
Date: Wed, 2 Dec 2026 16:29:07 +0800 [thread overview]
Message-ID: <28dc9218-bf0b-4c9c-bde0-419c710200bb@linux.intel.com> (raw)
In-Reply-To: <CO1PR11MB483588F92DB2862C80F2311B8C4C2@CO1PR11MB4835.namprd11.prod.outlook.com>
On 12/2/2026 12:57 PM, Tian, Kevin wrote:
>> From: Baolu Lu<baolu.lu@linux.intel.com>
>> Sent: Thursday, November 26, 2026 10:11 AM
>>
>> On 11/25/2026 11:49 AM, Tian, Kevin wrote:
>>>> From: Lu Baolu<baolu.lu@linux.intel.com>
>>>> Sent: Thursday, November 12, 2026 12:31 PM
>>>>
>>>> + * context (e.g. perf pmu::start/stop), so don't sleep; just reject
>>>> + * the request.
>>>> + */
>>>> + if (iommu->tdxc_acquired) {
>>>> + ret = -EBUSY;
>>>> + goto err;
>>>> + }
>>>> +
>>> iommu_pmu_stop() doesn't check the return value of this. It's a void
>>> function. So returning error here still breaks the perf feature.
>>>
>>> we may need a way to disable iommu perf completely in the acquire
>>> function.
>> Good catch. Returning an error there leaves events that look like
>> they're running but never count, or that can't be stopped.
>>
>> I'll make perf events and TDX mode mutually exclusive instead:
>>
>> - The iommu pmu counts its live events under register_lock.
>> - event_init() fails with -EBUSY while the IOMMU is acquired.
>> - acquire() fails with -EBUSY while any event exists.
>>
>> Something like the following(compiled but not tested). Does this work
>> for you?
> we could simply unregister iommu pmu at acquisition time? that makes
> the entire capability disappeared when tdx is acquired, clearer than
> presenting a capability w/o any usable counters...
Good idea. It's simpler, and it also means an open perf session can no
longer block TDX acquisition.
perf_pmu_unregister() now detaches live events instead of failing, so
dmar_tdx_acquire() can tear the pmu down unconditionally:
ret = dmar_tdx_reserve_did(iommu);
if (ret)
return ret;
/*
* Perf issues enhanced commands from callbacks that can't
fail, and
* TDX mode blocks them.
*/
iommu_pmu_unregister(iommu);
free_iommu_pmu(iommu);
dmar_tdx_set_acquired(iommu, true);
Thanks,
baolu
next prev parent reply other threads:[~2026-12-02 8:29 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 4:30 [PATCH v3 0/9] coco/tdx-host: Introduce trusted DMA initialization support Lu Baolu
2026-11-12 4:30 ` [PATCH v3 1/9] x86/virt/tdx: Add SEAMCALL wrappers for IOMMU setup/clear Lu Baolu
2026-11-18 11:02 ` Binbin Wu
2026-11-23 4:03 ` Baolu Lu
2026-11-23 9:55 ` Xu Yilun
2026-11-24 5:46 ` Baolu Lu
2026-12-02 7:26 ` Xiaoyao Li
2026-12-02 8:45 ` Baolu Lu
2026-11-24 8:07 ` Tian, Kevin
2026-11-25 2:47 ` Baolu Lu
2026-11-25 3:08 ` Tian, Kevin
2026-11-25 4:26 ` Baolu Lu
2026-11-12 4:30 ` [PATCH v3 2/9] x86/virt/tdx: Read global metadata for trusted IOMMU Lu Baolu
2026-11-18 13:39 ` Binbin Wu
2026-11-23 4:09 ` Baolu Lu
2026-11-24 8:13 ` Tian, Kevin
2026-11-25 2:57 ` Baolu Lu
2026-11-12 4:30 ` [PATCH v3 3/9] x86/virt/tdx: Export Dynamic PAMT helpers to tdx-host Lu Baolu
2026-11-23 10:25 ` Xu Yilun
2026-11-23 16:28 ` Edgecombe, Rick P
2026-11-24 6:07 ` Baolu Lu
2026-11-12 4:30 ` [PATCH v3 4/9] iommu/vt-d: Add interface for tdx-host when enabling trusted DMA Lu Baolu
2026-11-23 15:08 ` Xu Yilun
2026-11-24 7:47 ` Baolu Lu
2026-11-25 3:32 ` Tian, Kevin
2026-11-25 3:29 ` Tian, Kevin
2026-11-25 23:33 ` Baolu Lu
[not found] ` <9a92bb91-3dac-4fc5-8f38-130b7442bdcc@linux.intel.com>
2026-11-27 7:59 ` Tian, Kevin
2026-12-02 0:22 ` Baolu Lu
2026-12-02 3:02 ` Tian, Kevin
2026-11-12 4:30 ` [PATCH v3 5/9] iommu/vt-d: Block GCMD and ECMD while acquired by the TDX module Lu Baolu
2026-11-25 3:49 ` Tian, Kevin
2026-11-26 2:10 ` Baolu Lu
2026-12-02 4:57 ` Tian, Kevin
2026-12-02 8:29 ` Baolu Lu [this message]
2026-11-12 4:30 ` [PATCH v3 6/9] iommu/vt-d: Refuse system suspend " Lu Baolu
2026-11-25 4:01 ` Tian, Kevin
2026-11-25 6:27 ` Baolu Lu
2026-11-12 4:30 ` [PATCH v3 7/9] coco/tdx-host: Add skeleton to support PCI link encryption Lu Baolu
2026-11-18 7:16 ` Chao Gao
2026-11-23 3:30 ` Baolu Lu
2026-11-23 15:26 ` Xu Yilun
2026-11-25 2:24 ` Baolu Lu
2026-11-19 2:52 ` Binbin Wu
2026-11-23 4:18 ` Baolu Lu
2026-11-23 15:43 ` Xu Yilun
2026-11-12 4:30 ` [PATCH v3 8/9] coco/tdx-host: Rename tdx-host.c to main.c Lu Baolu
2026-11-12 4:30 ` [PATCH v3 9/9] coco/tdx-host: Enable trusted DMA on IOMMUs on device connect Lu Baolu
2026-11-18 8:11 ` Chao Gao
2026-11-23 4:51 ` Baolu Lu
2026-11-27 9:57 ` Xu Yilun
2026-12-02 0:55 ` Baolu Lu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=28dc9218-bf0b-4c9c-bde0-419c710200bb@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=binbin.wu@linux.intel.com \
--cc=chao.gao@intel.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@ziepe.ca \
--cc=kas@kernel.org \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-coco@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=rick.p.edgecombe@intel.com \
--cc=x86@kernel.org \
--cc=xiaoyao.li@intel.com \
--cc=yilun.xu@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox