[Pdbg] [PATCH 5/7] libpdbg: Rescan fsi bus only once

Amitay Isaacs amitay at ozlabs.org
Wed Jun 10 15:21:07 AEST 2020


On Wed, 2020-06-10 at 03:15 +0000, Joel Stanley wrote:
> On Tue, 9 Jun 2020 at 14:16, Amitay Isaacs <amitay at ozlabs.org> wrote:
> > On Tue, 2020-06-09 at 07:28 +0000, Joel Stanley wrote:
> > > On Tue, 26 May 2020 at 05:13, Amitay Isaacs <amitay at ozlabs.org>
> > > wrote:
> > > > On rescan, kernel driver re-creates all the slave
> > > > devices.  This
> > > > invalidates all the slave deviced opened before the scan.
> > > > -       if (fsi->fd < 0) {
> > > > -               PR_ERROR("Unable to open %s\n", path);
> > > > +       /* Always scan the fsi bus once */
> > > > +       kernel_fsi_scan_devices();
> > > 
> > > As your comment says, this changes the behavior to always scan
> > > even
> > > if
> > > the sysfs hierarchy is present. Previously it would try to open
> > > the
> > > "raw" file on the first master and if it was present it wouldn't
> > > disturb the setup.
> > 
> > In the earlier case, we tried to open only one device, so
> > rescanning
> > didn't matter.  But if device 1 is opened and if device 2 cannot be
> > opened, then we cannot scan, as it makes the already open fd
> > invalid.
> > So the only way was to either scan once or no scan at all.
> > 
> > Doing a scan is probably harmful on a working system, as other
> > software
> > might have open fd for the raw device.  But on a broken system, you
> > would want to do a scan.  I am also fine with completely dropping
> > the
> > scanning of fsi bus from pdbg.
> 
> Thanks for the explanation.
> 
> I think we will need to drop the scan (or introduce a --scan option),
> or else pdbg becomes far less useful in inspecting a live system.
> 
> I would prefer a --scan option so users don't need to dig around in 
> sysfs.

Turns out it's not that difficult to scan only on the first probe. This
avoids the need for --scan option, which would be more difficult to
plumb through libpdbg. v2 patch set coming.

Amitay.
-- 

The earth is 98% full. Please delete anyone you can.



More information about the Pdbg mailing list