public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: "Kempczynski, Zbigniew" <zbigniew.kempczynski@intel.com>
Cc: "igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
	"Latvala, Petri" <petri.latvala@intel.com>,
	"daniel@ffwll.ch" <daniel@ffwll.ch>
Subject: Re: [igt-dev] [PATCH i-g-t v1 1/1] Introduce new method of device selection
Date: Mon, 15 Jul 2019 11:31:15 +0200	[thread overview]
Message-ID: <20190715093115.GQ15868@phenom.ffwll.local> (raw)
In-Reply-To: <665bbc3bca27c4524da0d23ab36b4e270a5cb511.camel@intel.com>

On Mon, Jul 15, 2019 at 06:25:04AM +0000, Kempczynski, Zbigniew wrote:
> On Thu, 2019-07-11 at 14:43 +0200, Daniel Vetter wrote:
> > Instead of text, can we somehow integrate into our gtkdoc stuff? I know
> > gtkdoc isn't as flexible as the kernel by far, but random .txt files isn't
> > better either ...
> 
> Agree. I'll rewrite this to gtkdoc.
> 
> > 
> > >  lib/Makefile.sources            |    2 +
> > >  lib/drmtest.c                   |  151 +++-
> > >  lib/drmtest.h                   |    9 +
> > >  lib/igt_core.c                  |   13 +
> > >  lib/igt_device_scan.c           | 1425 +++++++++++++++++++++++++++++++
> > >  lib/igt_device_scan.h           |   72 ++
> > >  lib/meson.build                 |    1 +
> > >  tools/Makefile.sources          |    1 +
> > >  tools/lsgpu.c                   |  285 +++++++
> > >  tools/meson.build               |    1 +
> > >  11 files changed, 2073 insertions(+), 2 deletions(-)
> > >  create mode 100644 docs/multi-device-selection.txt
> > >  create mode 100644 lib/igt_device_scan.c
> > >  create mode 100644 lib/igt_device_scan.h
> > >  create mode 100644 tools/lsgpu.c
> > 
> > Wrt the design itself: I thought the last discussion on this we agreed on
> > basing this on udev filters. Not reinvinting an entire device
> > parser/filter ourselves (which this does here), because that means more
> > work on arm and anywhere else. Do we have a case of lost in communication
> > between all the various mail threads going on here?
> 
> I've used udev filters for scanning separate bus and returning all devices 
> on it. I haven't use all of its filters when I realized that it doesn't allow 
> filtering properly on some sysattrs. It resolves symbolic links only 
> for limited set of attributes what is a real problem - you can't set 
> sysattr filter because value of such attribute is NULL. 
> 
> Another thing is that udev provides properties / attributes as list instead 
> of key / value hash table. So if you use --device ... multiple times 
> you'll iterate over such lists multiple time to get appropriate 'key=value'
> instead getting it directly from hashtable. 
> 
> That's why I decided resolve each udev device to internal igt_device
> once, allowing people who want to write filter just direct access to 
> properties / sysattrs. Missing symbolic links resolving is also done
> in that step so filter author doesn't need to do this on his own 
> each time he would iterate over udev prop/sysattrs lists.
> 
> So regarding your sentence in lost communication - I didn't wanted to 
> bother anyone with problems described above. I'm not sure even if 
> I would send a patch to udev team regarding symbolic links they
> would accept it (someone maybe relies on this behavior now, so it
> could break compatibility). And we don't have single udev implementation
> (eudev) too.

The entire point of review is to create a shared understanding of the
problems involved. Dropping that stuff is pretty crucial.

Also, I'm not really following your description. Maybe there's a gap
between the udev library interface and what I can get at the command line.
But if I look at

# udevadm info -e

And for a specific device, the pile of links/higher level directories,
then I think we should be able to find everything.

Maybe another part of the misunderstanding: Imo we don't want to identify
physical devices, we want to identify drm_devices. Module reload is very
much the exception, and the trickery we have to let igt/lib load the
module if it's not there is imo a bit a hack. Aside from for vgem, where
it makes some sense at least.

So rough algorithimg I had in mind:
1. iterate all drm_devices in sysfs
2. walk the link to physical device
3. go up the hierarchy

Anywhere where we spot a name=value pair that matches what we filter, we
stop, and use that device. Plus augmented with the udevadm info -e stuff,
so you can add arbitrary additional stuff on top. Zero reinvented wheel
needed in igt.

Aside: Maybe we should ditch the module autoload stuff again, except for
vgem. Really no idea why that's needed.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2019-07-15  9:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-11 10:30 [igt-dev] [PATCH i-g-t v1 0/1] Add device selection methods Zbigniew Kempczyński
2019-07-11 10:30 ` [igt-dev] [PATCH i-g-t v1 1/1] Introduce new method of device selection Zbigniew Kempczyński
2019-07-11 12:43   ` Daniel Vetter
2019-07-15  6:25     ` Kempczynski, Zbigniew
2019-07-15  9:31       ` Daniel Vetter [this message]
2019-07-15 11:22         ` Kempczynski, Zbigniew
2019-07-12  8:20   ` Vasilev, Oleg
2019-07-12  9:18     ` Zbigniew Kempczyński
2019-07-11 15:13 ` [igt-dev] ✓ Fi.CI.BAT: success for Add device selection methods Patchwork
2019-07-12 10:08 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

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=20190715093115.GQ15868@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=petri.latvala@intel.com \
    --cc=zbigniew.kempczynski@intel.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