[Pdbg] [PATCH 5/7] libpdbg: Rescan fsi bus only once
Joel Stanley
joel at jms.id.au
Wed Jun 10 13:15:37 AEST 2020
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.
More information about the Pdbg
mailing list