All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Chengwen Feng" <fengchengwen@huawei.com>
Cc: kvm@vger.kernel.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH v21 13/13] vfio/pci: Expose per-device TPH state via debugfs
Date: Wed, 18 Nov 2026 12:27:45 +0000	[thread overview]
Message-ID: <sashiko-outbox-220913@kernel.org> (raw)
In-Reply-To: <20261118091238.45992-14-fengchengwen@huawei.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] vfio/pci: stale tph_opt_in and tph_vcap reported in
  vfio_pci_core_debugfs_tph()
--

commit 7e557b3e2af5cdc6c9056a9f2dd3cbe532f029c5
Author: Chengwen Feng <fengchengwen@huawei.com>

vfio/pci: Expose per-device TPH state via debugfs

This commit adds a read-only "tph" debugfs file under the per-device pci
debugfs directory to report the device's TPH policy, virtual capability
value, and user opt-in state.

> diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c
> index 8d3d532cd51ab..a9cdcb0f95a01 100644
> --- a/drivers/vfio/pci/vfio_pci_core.c
> +++ b/drivers/vfio/pci/vfio_pci_core.c
> @@ -130,10 +130,20 @@ static int vfio_pci_core_debugfs_disable_idle_d3(struct seq_file *seq,
>  	return 0;
>  }
>  
> +static int vfio_pci_core_debugfs_tph(struct seq_file *seq,
> +					    void *data)
> +{
> +	struct vfio_pci_core_device *vdev = vfio_pci_core_debugfs_private(seq);
> +
> +	seq_printf(seq, "policy=%u cap-virt=0x%x opt-in=%u\n",
> +		vdev->tph_policy, vdev->tph_vcap, vdev->tph_opt_in);
> +	return 0;
> +}

[Severity: Low]
Can vfio_pci_core_debugfs_tph() report stale vdev->tph_vcap and
vdev->tph_opt_in values after the device is closed?

The debugfs entry is created during device registration, but tph_vcap and
tph_opt_in are only initialized when the device is opened in
vfio_pci_core_enable() and are not cleared by vfio_pci_tph_dev_deinit() or
vfio_config_free() during vfio_pci_core_disable().  After a session that
enabled TPH via VFIO_DEVICE_FEATURE_TPH closes the device, reading the tph
debugfs file continues to report opt-in=1 and the previous session's
cap-virt value even though virtual config space has been freed and PCIe
TPH is disabled.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261118091238.45992-1-fengchengwen@huawei.com?part=13

      reply	other threads:[~2026-11-18 12:27 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18  9:12 [PATCH v21 00/13] vfio/pci: Add PCIe TPH support Chengwen Feng
2026-11-18  9:12 ` [PATCH v21 01/13] PCI/TPH: Fix pcie_tph_get_st_table_loc() field extraction Chengwen Feng
2026-11-18  9:29   ` sashiko-bot
2026-11-18  9:12 ` [PATCH v21 02/13] PCI/TPH: Fix tph_enabled concurrent update race by bitfield packing Chengwen Feng
2026-11-18  9:38   ` sashiko-bot
2026-11-18  9:12 ` [PATCH v21 03/13] PCI/TPH: Cache negotiated max requester type at probe time Chengwen Feng
2026-11-18  9:45   ` sashiko-bot
2026-11-18  9:12 ` [PATCH v21 04/13] PCI/TPH: Refactor pcie_enable_tph and add requester variant Chengwen Feng
2026-11-18  9:48   ` sashiko-bot
2026-11-18  9:12 ` [PATCH v21 05/13] PCI/TPH: Refactor pcie_tph_get_cpu_st & " Chengwen Feng
2026-11-18  9:53   ` sashiko-bot
2026-11-18  9:12 ` [PATCH v21 06/13] PCI/TPH: Add macros to check standard and extended TPH support Chengwen Feng
2026-11-18 10:06   ` sashiko-bot
2026-11-19  6:25     ` fengchengwen
2026-11-18  9:12 ` [PATCH v21 07/13] PCI/TPH: Add pcie_tph_set_st_entries() batch ST entry programming helper Chengwen Feng
2026-11-18 10:15   ` sashiko-bot
2026-11-18  9:12 ` [PATCH v21 08/13] PCI/TPH: Add pci_tph_dsm_supported() helper to detect device TPH ST _DSM Chengwen Feng
2026-11-18 10:29   ` sashiko-bot
2026-11-18  9:12 ` [PATCH v21 09/13] vfio/pci: Add basic NO-ST TPH VFIO device feature support Chengwen Feng
2026-11-18 10:51   ` sashiko-bot
2026-11-19  8:21     ` fengchengwen
2026-11-19  7:50   ` kernel test robot
2026-11-18  9:12 ` [PATCH v21 10/13] vfio/pci: Add IV-ST TPH policy and TPH_PROGRAM batch programming support Chengwen Feng
2026-11-18 11:21   ` sashiko-bot
2026-11-19  9:27     ` fengchengwen
2026-11-18  9:12 ` [PATCH v21 11/13] vfio/pci: Add DS-ST TPH policy and TPH_RESOLVE capability Chengwen Feng
2026-11-18 11:43   ` sashiko-bot
2026-11-19 11:17     ` fengchengwen
2026-11-18  9:12 ` [PATCH v21 12/13] vfio/pci: Reset PCIe TPH state on device open and close Chengwen Feng
2026-11-18 12:20   ` sashiko-bot
2026-11-19 11:30     ` fengchengwen
2026-11-18  9:12 ` [PATCH v21 13/13] vfio/pci: Expose per-device TPH state via debugfs Chengwen Feng
2026-11-18 12:27   ` sashiko-bot [this message]

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=sashiko-outbox-220913@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=fengchengwen@huawei.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.