public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: PCI: add driver flag to opt into disabling SR-IOV on remove()
Date: Wed, 04 Mar 2026 08:40:15 +1000	[thread overview]
Message-ID: <review-patch1-20260303-rust-pci-sriov-v3-1-4443c35f0c88@redhat.com> (raw)
In-Reply-To: <20260303-rust-pci-sriov-v3-1-4443c35f0c88@redhat.com>

Patch Review

This is the linchpin of the series. The design is well thought out.

**`pci_iov_disable()` logic** is correct: short-circuit evaluation in `if (!dev->is_physfn || !iov->num_VFs || !drv->managed_sriov)` protects against dereferencing `iov` when `dev->sriov` is actually the `physfn` union member on VF devices.

**Ordering change in `pci_device_remove()`** is necessary and correct:

```c
+	pci_iov_disable(pci_dev);
 	if (drv->remove) {
 		...
 	}
 	pcibios_free_irq(pci_dev);
-	pci_dev->driver = NULL;
 	pci_iov_remove(pci_dev);
+	pci_dev->driver = NULL;
```

`pci_iov_remove()` now needs `dev->driver` to check `managed_sriov`, so the `driver = NULL` assignment must move after it. This is safe since the driver pointer was already valid during the preceding `drv->remove()` call.

**`pci_iov_remove()` behavior change**: For non-`managed_sriov` drivers, behavior is preserved (warn and return). For `managed_sriov` drivers, the `WARN_ON(iov->num_VFs)` + `sriov_disable()` at the end catches broken drivers that re-enable SR-IOV during `remove()`. Good defensive coding.

**Minor**: The `WARN_ON(!drv)` checks added to both functions are a good defensive addition, though if `drv` were ever NULL at this point there would be larger problems.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-03-03 22:40 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-03 21:15 [PATCH v3 00/10] rust: pci: add abstractions for SR-IOV capability Peter Colberg
2026-03-03 21:15 ` [PATCH v3 01/10] PCI: add driver flag to opt into disabling SR-IOV on remove() Peter Colberg
2026-03-03 22:40   ` Claude Code Review Bot [this message]
2026-03-03 21:15 ` [PATCH v3 02/10] fpga: dfl-pci: set driver flag to disable " Peter Colberg
2026-03-03 22:40   ` Claude review: " Claude Code Review Bot
2026-03-03 21:15 ` [PATCH v3 03/10] rust: pci: add {enable,disable}_sriov(), to control SR-IOV capability Peter Colberg
2026-03-03 22:40   ` Claude review: " Claude Code Review Bot
2026-03-03 21:15 ` [PATCH v3 04/10] rust: pci: add vtable attribute to pci::Driver trait Peter Colberg
2026-03-03 22:40   ` Claude review: " Claude Code Review Bot
2026-03-03 21:15 ` [PATCH v3 05/10] rust: pci: add bus callback sriov_configure(), to control SR-IOV from sysfs Peter Colberg
2026-03-03 22:40   ` Claude review: " Claude Code Review Bot
2026-03-03 21:15 ` [PATCH v3 06/10] rust: pci: add is_virtfn(), to check for VFs Peter Colberg
2026-03-03 22:40   ` Claude review: " Claude Code Review Bot
2026-03-03 21:15 ` [PATCH v3 07/10] rust: pci: add is_physfn(), to check for PFs Peter Colberg
2026-03-03 22:40   ` Claude review: " Claude Code Review Bot
2026-03-03 21:15 ` [PATCH v3 08/10] rust: pci: add num_vf(), to return number of VFs Peter Colberg
2026-03-03 22:40   ` Claude review: " Claude Code Review Bot
2026-03-03 21:15 ` [PATCH v3 09/10] rust: pci: add physfn(), to return PF device for VF device Peter Colberg
2026-03-03 22:40   ` Claude review: " Claude Code Review Bot
2026-03-03 21:15 ` [PATCH v3 10/10] samples: rust: add SR-IOV driver sample Peter Colberg
2026-03-03 22:40   ` Claude review: " Claude Code Review Bot
2026-03-03 22:40 ` Claude review: rust: pci: add abstractions for SR-IOV capability Claude Code Review Bot

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=review-patch1-20260303-rust-pci-sriov-v3-1-4443c35f0c88@redhat.com \
    --to=claude-review@example.com \
    --cc=dri-devel-reviews@example.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