Re: [RESEND v13 25/25] CXL/PCI: Disable CXL protocol error interrupts during CXL Port cleanup

dan.j.williams
2025-11-20T03:10:36Z

Terry Bowman wrote:
> During CXL device cleanup the CXL PCIe Port device interrupts remain
> enabled. This potentially allows unnecessary interrupt processing on
> behalf of the CXL errors while the device is destroyed.
>
> Disable CXL protocol errors by setting the CXL devices' AER mask register.
>
> Introduce pci_aer_mask_internal_errors() similar to pci_aer_unmask_internal_errors().
> Add to the AER service driver allowing other subsystems to use.
>
> Introduce cxl_mask_proto_interrupts() to call pci_aer_mask_internal_errors().
> Add calls to cxl_mask_proto_interrupts() within CXL Port teardown for CXL
> Root Ports, CXL Downstream Switch Ports, CXL Upstream Switch Ports, and CXL
> Endpoints. Follow the same "bottom-up" approach used during CXL Port
> teardown.

This comes across as too much special case sprinkling.

If it is just the cxl_port teardown case then the simple answer is only
enable interrupts at cxl_port::probe() time and disable them at
cxl_port::remove() time.

Can you clarify the exact nature of the unwanted interrupts because the
PCI core does not manage AER interrupts in the same way. It only ever
enables interrupts for root ports, so I am confused why CXL needs to
manage interrupts on a per-dport basis.

Maybe cxl_mask_proto_interrupts() is misnamed because the device is
never enabled to send interrupts. I think is just mask AER events,
right?

In any case I think this belongs right next to the code that maps and
unmaps dports. The endpoint case should be handled by the endpoint probe
and remove handlers.

Also, if this is really a problem this patch should be moved earlier in
the series before the kernel starts unmasking these new event sources.
Otherwiwse, a bisect run will start hitting spurious events if it lands
in the middle of this series.