linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Zhenzhong Duan <zhenzhong.duan@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	bhelgaas@google.com, hch@infradead.org,
	alex.williamson@redhat.com, cohuck@redhat.com
Subject: Re: [PATCH v3 0/2] avoid inserting duplicate IDs in dynids list
Date: Fri, 20 Nov 2020 15:57:11 -0600	[thread overview]
Message-ID: <20201120215711.GA281372@bjorn-Precision-5520> (raw)
In-Reply-To: <20201117054409.3428-1-zhenzhong.duan@gmail.com>

On Tue, Nov 17, 2020 at 01:44:07PM +0800, Zhenzhong Duan wrote:
> vfio-pci and pci-stub use new_id to bind devices. But one can add same IDs
> multiple times, for example:
> 
> # echo "1af4 1041" > /sys/bus/pci/drivers/vfio-pci/new_id
> # echo "1af4 1041" > /sys/bus/pci/drivers/vfio-pci/new_id
> # echo "1af4 1041" > /sys/bus/pci/drivers/vfio-pci/new_id
> # echo "1af4 1041" > /sys/bus/pci/drivers/vfio-pci/remove_id
> # echo "1af4 1041" > /sys/bus/pci/drivers/vfio-pci/remove_id
> # echo "1af4 1041" > /sys/bus/pci/drivers/vfio-pci/remove_id
> # echo "1af4 1041" > /sys/bus/pci/drivers/vfio-pci/remove_id
> -bash: echo: write error: No such device
> 
> This doesn't cause user-visible broken behavior, but not user friendly.
> he has to remove same IDs same times to ensure it's completely gone.
> 
> Changed to only allow one dynamic entry of the same kind, after fix:
> 
> # echo "1af4 1041" > /sys/bus/pci/drivers/vfio-pci/new_id
> # echo "1af4 1041" > /sys/bus/pci/drivers/vfio-pci/new_id
> -bash: echo: write error: File exists
> # echo "1af4 1041" > /sys/bus/pci/drivers/vfio-pci/remove_id
> # echo "1af4 1041" > /sys/bus/pci/drivers/vfio-pci/remove_id
> -bash: echo: write error: No such device
> 
> 
> v3: add a separate patch to process dependency issue per Bjorn
>     make commit log more clear per Bjorn
> v2: revert the export of pci_match_device() per Christoph
>     combind PATCH1 and PATCH2 into one.
> 
> v2 link:https://lkml.org/lkml/2020/10/25/347
> 
> Zhenzhong Duan (2):
>   PCI: move pci_match_device() ahead of new_id_store()
>   PCI: avoid duplicate IDs in dynamic IDs list
> 
>  drivers/pci/pci-driver.c | 146 +++++++++++++++++++++++------------------------
>  1 file changed, 73 insertions(+), 73 deletions(-)
> 
> -- 
> 1.8.3.1
> 
> 
> Zhenzhong Duan (2):
>   PCI: move pci_match_device() ahead of new_id_store()
>   PCI: avoid duplicate IDs in dynamic IDs list
> 
>  drivers/pci/pci-driver.c | 146 +++++++++++++++++++++++------------------------
>  1 file changed, 73 insertions(+), 73 deletions(-)

I corrected the subject lines:

  PCI: Move pci_match_device() ahead of new_id_store()
  PCI: Avoid duplicate IDs in driver dynamic IDs list

and applied both to pci/enumeration for v5.11, thanks!

      parent reply	other threads:[~2020-11-20 21:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-17  5:44 [PATCH v3 0/2] avoid inserting duplicate IDs in dynids list Zhenzhong Duan
2020-11-17  5:44 ` [PATCH v3 1/2] PCI: move pci_match_device() ahead of new_id_store() Zhenzhong Duan
2020-11-17  5:44 ` [PATCH v3 2/2] PCI: avoid duplicate IDs in dynamic IDs list Zhenzhong Duan
2020-11-20 21:57 ` Bjorn Helgaas [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=20201120215711.GA281372@bjorn-Precision-5520 \
    --to=helgaas@kernel.org \
    --cc=alex.williamson@redhat.com \
    --cc=bhelgaas@google.com \
    --cc=cohuck@redhat.com \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=zhenzhong.duan@gmail.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;
as well as URLs for NNTP newsgroup(s).