From: "Gupta, Anshuman" <anshuman.gupta@intel.com>
To: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
Cc: "Latvala, Petri" <petri.latvala@intel.com>,
"Wilson, Chris P" <chris.p.wilson@intel.com>,
"igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
"Nilawar, Badal" <badal.nilawar@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t v2 4/4] i915_pm_rpm: rpm resume by user forcewake
Date: Wed, 18 May 2022 06:28:02 +0000 [thread overview]
Message-ID: <508c7e9e8506471eb9cf047ac6ad9d81@intel.com> (raw)
In-Reply-To: <87o7zwf5to.wl-ashutosh.dixit@intel.com>
> -----Original Message-----
> From: Dixit, Ashutosh <ashutosh.dixit@intel.com>
> Sent: Tuesday, May 17, 2022 10:35 PM
> To: Gupta, Anshuman <anshuman.gupta@intel.com>
> Cc: igt-dev@lists.freedesktop.org; Nilawar, Badal <badal.nilawar@intel.com>;
> Ewins, Jon <jon.ewins@intel.com>; Latvala, Petri <petri.latvala@intel.com>;
> Tangudu, Tilak <tilak.tangudu@intel.com>; Wilson, Chris P
> <chris.p.wilson@intel.com>
> Subject: Re: [PATCH i-g-t v2 4/4] i915_pm_rpm: rpm resume by user forcewake
>
> On Wed, 11 May 2022 04:37:34 -0700, Anshuman Gupta wrote:
> >
> > Few gem rpm tests relies on enabling kms crtc in order to trigger rpm
> > resume but on headless platforms these tests skip. Let it trigger the
> > rpm resume by taking user forcewake.
> >
> > v2:
> > - removed has_runtime_pm cond from
> > enable_one_screen_or_forcewake_and_wait(). [Ashutosh]
> > - removed if (ms_data.res) cond from basic_subtest(). [Ashutosh]
> > - clear forcewake in both only for headless. [Ashutosh]
> >
> > Cc: Chris Wilson <chris.p.wilson@intel.com>
> > Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
> > ---
> > tests/i915/i915_pm_rpm.c | 80
> > ++++++++++++++++++++++++++++++----------
> > 1 file changed, 61 insertions(+), 19 deletions(-)
> >
> > diff --git a/tests/i915/i915_pm_rpm.c b/tests/i915/i915_pm_rpm.c index
> > a6035e60b..de71dd41c 100644
> > --- a/tests/i915/i915_pm_rpm.c
> > +++ b/tests/i915/i915_pm_rpm.c
> > @@ -99,6 +99,7 @@ struct mode_set_data {
> > igt_display_t display;
> >
> > uint32_t devid;
> > + int fw_fd;
> > };
> >
> > /* Stuff we query at different times so we can compare. */ @@ -369,6
> >+370,44 @@ static void enable_one_screen(struct mode_set_data *data)
> > igt_assert(wait_for_active()); \
> > } while (0)
> >
> > +static void
> > +enable_one_screen_or_forcewake_and_wait(struct mode_set_data *data) {
> > + bool headless;
> > +
> > + /* Try to resume by enabling any type of display */
> > + headless = !enable_one_screen_with_type(data, SCREEN_TYPE_ANY);
> > +
> > + /*
> > + * Get User Forcewake to trigger rpm resume in case of headless
> > + * as well as no display being connected.
> > + */
> > + if (headless) {
> > + data->fw_fd = igt_open_forcewake_handle(drm_fd);
> > + igt_require(data->fw_fd > 0);
> > + }
> > + igt_assert(wait_for_active());
> > +}
> > +
> > +static void clear_forcewake(struct mode_set_data *data) {
> > + if (data->fw_fd <= 0)
> > + return;
> > +
> > + data->fw_fd = close(data->fw_fd);
> > + igt_assert_eq(data->fw_fd, 0);
> > +}
> > +
> > +static void
> > +disable_all_screens_or_clr_forcewake_and_wait(struct mode_set_data
> > +*data) {
> > + if (!default_mode_params)
>
> Why introduce this new unrelated check here? Now someone needs to check if
> this check is valid for headless. If we are introducing this here can we also
> introduce it in enable_one_screen_or_forcewake_and_wait()?
This check is already present in enable_one_screen_with_type() in switch case.
Just introduced this to make both enable_one_screen_or_forcewake_and_wait() /disable_all_screens_or_clr_forcewake_and_wait()
symmetric to address the comment.
>
> Can we not just do:
>
> if (data->fw_fd)
> clear_forcewake(data);
>
> as I was suggesting, or even unconditional is ok since clear_forcewake() already
> has the check. Let's just drop the if () here then as you previously had?
Sure I will drop this check as it is not needed.
Thanks,
Anshuman Gupta.
>
> Also I have another comment. The kernel increments/decrements a reference
> count when "i915_forcewake_user" debugfs is open/closed. So closing the file
> doesn't necessary clear forcewake if a previous fd is open. How about changing
> function names with get/put to make this clear. E.g.
>
> * enable_one_screen_or_forcewake_get_and_wait
> * forcewake_put instead of clear_forcewake
> * disable_all_screens_or_forcewake_put_and_wait
>
> But not strictly needed, you decide, just a suggestion.
>
> Rest everything looks good.
>
> With the if () dropped this is:
>
> Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
next prev parent reply other threads:[~2022-05-18 6:28 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-11 11:37 [igt-dev] [PATCH i-g-t v2 0/4] RPM Test on HEADLESS Anshuman Gupta
2022-05-11 11:37 ` [igt-dev] [PATCH i-g-t v2 1/4] test: i915_pm_rpm: init devid in setup_envirnoment Anshuman Gupta
2022-05-11 11:37 ` [igt-dev] [PATCH i-g-t v2 2/4] i915_pm_rpm: %s/display_disabled/display_enabled Anshuman Gupta
2022-05-17 15:43 ` Dixit, Ashutosh
2022-05-11 11:37 ` [igt-dev] [PATCH i-g-t v2 3/4] test: i915_pm_rpm: conditional initialization of igt_display_t Anshuman Gupta
2022-05-17 15:52 ` Dixit, Ashutosh
2022-05-11 11:37 ` [igt-dev] [PATCH i-g-t v2 4/4] i915_pm_rpm: rpm resume by user forcewake Anshuman Gupta
2022-05-17 17:05 ` Dixit, Ashutosh
2022-05-18 6:28 ` Gupta, Anshuman [this message]
2022-05-11 12:17 ` [igt-dev] ✓ Fi.CI.BAT: success for RPM Test on HEADLESS (rev2) Patchwork
2022-05-11 15:39 ` [igt-dev] ✗ Fi.CI.IGT: failure " 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=508c7e9e8506471eb9cf047ac6ad9d81@intel.com \
--to=anshuman.gupta@intel.com \
--cc=ashutosh.dixit@intel.com \
--cc=badal.nilawar@intel.com \
--cc=chris.p.wilson@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=petri.latvala@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.