All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gustavo Sousa <gustavo.sousa@intel.com>
To: Kamil Konieczny <kamil.konieczny@linux.intel.com>,
	Jani Nikula <jani.nikula@intel.com>
Cc: "Sebastian Brzezinka" <sebastian.brzezinka@intel.com>,
	igt-dev@lists.freedesktop.org, krzysztof.karas@intel.com,
	zbigniew.kempczynski@intel.com, x.wang@intel.com,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>
Subject: Re: [PATCH v4 1/2] lib/drmtest: add __drm_open_driver_path()
Date: Fri, 29 May 2026 10:37:19 -0300	[thread overview]
Message-ID: <87cxyes5f4.fsf@intel.com> (raw)
In-Reply-To: <20260527132247.oqxnekctlpttxoyc@kamilkon-DESK.igk.intel.com>

Kamil Konieczny <kamil.konieczny@linux.intel.com> writes:

> Hi Jani,
> On 2026-05-26 at 15:07:57 +0300, Jani Nikula wrote:
>> On Tue, 26 May 2026, "Sebastian Brzezinka" <sebastian.brzezinka@intel.com> wrote:
>> > Hi Jani,
>> >
>> > On Tue May 26, 2026 at 1:51 PM CEST, Jani Nikula wrote:
>> >> On Tue, 26 May 2026, Sebastian Brzezinka <sebastian.brzezinka@intel.com> wrote:
>> >>> Add __drm_open_driver_path() as a path-based DRM open helper. It opens
>> >>> the given path with O_RDWR, verifies the resulting fd is a DRM device by
>> >>> issuing DRM_IOCTL_VERSION via __get_drm_device_name() before proceeding
>> >>> (returning -1 and closing on failure), logs the opened device path, and
>> >>> populates the xe_device cache when the device is Xe.
>> >>>
>> >>> The __ prefix signals that the function does not throw assertions or
>> >>> igt_require() calls, consistent with the existing __drm_open_driver*
>> >>> family.
>> >>
>> >> FWIW, I think the __ prefix should indicate "implementation detail,
>> >> don't call directly" or something along those lines.
>> >>
>> >> I think it's problematic to encourage tests to call __ prefixed
>> >> functions.
>
>
>> > In general I agree with you, but in v3 Kamil comment on this:
>> > ```
>> >>>Could you rename it into __drm_open_driver_path?
>> >>>The idea is that all __functions should not throw asserts nor
>> >>>require.
>> > ```
>> >
>> > So I added an explanation in the comment.
>> 
>> I obviously disagree with all of that, but *shrug*.
>
> We could implement separete lib functions for tools but
> that will require duplicate effort.
>
> The idea with __function is that it should be implemented
> without any igt_assert nor igt_require so tools could use them.
> We could go with function() but then developers could
> later on change behaviour and break a tool.
>
> Or we could add some suffix to a name? function_safe()?

Given the number of assertions that already exist under lib/, perhaps
this would be somewhat hard to achieve, but I feel like we should go the
other way around: a suffix to denote that a function uses IGT
assertions.

I.o.w., do_something() would be usable from both test and tools code;
do_something_asserting() would be a version of the same function that
contains assertions.

"asserting" is a bit long for a prefix, we could try to come up with
something better.

--
Gustavo Sousa

>
> Btw why tool/igt_power couldn't just read sysfs? Why does it
> needs to open /dev/dri/card* to get any info? +cc Ville
>
> Regards,
> Kamil
>
>> 
>> BR,
>> Jani.
>> 
>> 
>> -- 
>> Jani Nikula, Intel

  parent reply	other threads:[~2026-05-29 13:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-26 11:39 [PATCH v4 0/2] tools/igt_power: fix Xe crash via drmtest path helpers Sebastian Brzezinka
2026-05-28 10:20 ` [PATCH i-g-t " Sebastian Brzezinka
2026-05-26 11:39 ` [PATCH v4 1/2] lib/drmtest: add __drm_open_driver_path() Sebastian Brzezinka
2026-05-28 10:20   ` [PATCH i-g-t " Sebastian Brzezinka
2026-05-26 11:39   ` [PATCH v4 2/2] tools/igt_power: fix crash on Xe devices by initializing xe_device cache Sebastian Brzezinka
2026-05-28 10:20     ` [PATCH i-g-t " Sebastian Brzezinka
2026-05-26 11:51   ` [PATCH v4 1/2] lib/drmtest: add __drm_open_driver_path() Jani Nikula
2026-05-26 11:59     ` Sebastian Brzezinka
2026-05-26 12:07       ` Jani Nikula
2026-05-27 13:22         ` Kamil Konieczny
2026-05-27 14:22           ` Ville Syrjälä
2026-05-29 13:37           ` Gustavo Sousa [this message]
2026-05-28 15:17   ` Kamil Konieczny
2026-05-27 14:32 ` [PATCH v4 0/2] tools/igt_power: fix Xe crash via drmtest path helpers Kamil Konieczny

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=87cxyes5f4.fsf@intel.com \
    --to=gustavo.sousa@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=krzysztof.karas@intel.com \
    --cc=sebastian.brzezinka@intel.com \
    --cc=ville.syrjala@linux.intel.com \
    --cc=x.wang@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.