All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Lyude <lyude@redhat.com>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t 3/3] tests/kms_chamelium: Introduce HPD short storm tests
Date: Tue, 11 Dec 2018 19:34:26 +0200	[thread overview]
Message-ID: <20181211173426.GZ9144@intel.com> (raw)
In-Reply-To: <20181211170926.GX9144@intel.com>

On Tue, Dec 11, 2018 at 07:09:26PM +0200, Ville Syrjälä wrote:
> On Tue, Nov 20, 2018 at 07:33:38PM -0500, Lyude wrote:
> > From: Lyude Paul <lyude@redhat.com>
> > 
> > This is to follow up with the changes that were recently made to HPD
> > storm detection in https://patchwork.freedesktop.org/patch/260597/ , as
> > now there are systems which will be counting short IRQs towards HPD
> > storms. As such, we introduce helpers to control HPD short storm
> > detection, along with some new kms_chamelium tests for it.
> > 
> > Please note that at the time of writing this: these tests currently
> > fail. That is because the i915_hpd_storm_ctl debugfs currently forgets
> > to synchronize with all IRQs and hotplugging work before returning the
> > HPD storm status to the user. A patch for this will be sent onto the ML
> > very shortly.
> 
> That went in no? If yes, this paragraph seems pointless now.
> 
> > 
> > Signed-off-by: Lyude Paul <lyude@redhat.com>
> > ---
> >  lib/igt_debugfs.c     | 85 +++++++++++++++++++++++++++++++++++++++++++
> >  lib/igt_debugfs.h     |  4 ++
> >  tests/kms_chamelium.c | 45 +++++++++++++++++++++++
> >  3 files changed, 134 insertions(+)
> > 
> > diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
> > index 358b4cab..530b70b7 100644
> > --- a/lib/igt_debugfs.c
> > +++ b/lib/igt_debugfs.c
> > @@ -543,6 +543,7 @@ static void igt_hpd_storm_exit_handler(int sig)
> >  	int fd = drm_open_driver(DRIVER_INTEL);
> >  
> >  	/* Here we assume that only one i915 device will be ever present */
> > +	igt_hpd_short_storm_reset(fd);
> >  	igt_hpd_storm_reset(fd);
> >  
> >  	close(fd);
> > @@ -660,6 +661,90 @@ void igt_require_hpd_storm_ctl(int drm_fd)
> >  
> >  	igt_require_f(fd > 0, "No i915_hpd_storm_ctl found in debugfs\n");
> >  	close(fd);
> > +
> > +	fd = igt_debugfs_open(drm_fd, "i915_hpd_short_storm_ctl", O_RDONLY);
> > +	igt_require_f(fd > 0, "No i915_hpd_short_storm_ctl found in debugfs\n");
> > +	close(fd);
> > +}
> > +
> > +/**
> > + * igt_hpd_short_storm_set_enabled:
> > + *
> > + * Convienence helper to enable or disable HPD short storm detection. If hotplug
> > + * detection was disabled on any ports due to an HPD storm, it will be
> > + * immediately re-enabled.
> > + *
> > + * If the system does not support HPD storm detection, this function does
> > + * nothing.
> > + *
> > + * See: https://01.org/linuxgraphics/gfx-docs/drm/gpu/i915.html#hotplug
> > + */
> > +void igt_hpd_short_storm_set_enabled(int drm_fd, bool enabled)
> > +{
> > +	int fd = igt_debugfs_open(drm_fd, "i915_hpd_short_storm_ctl", O_WRONLY);
> > +	const char *buf = enabled ? "y" : "n";
> > +
> > +	if (fd < 0)
> > +		return;
> > +
> > +	igt_debug("%sabling HPD short storm detection\n",
> > +		  enabled ? "En" : "Dis");
> > +	igt_assert_eq(write(fd, buf, strlen(buf)), strlen(buf));
> > +
> > +	close(fd);
> > +}
> > +
> > +/**
> > + * igt_hpd_short_storm_reset:
> > + *
> > + * Convienence helper to reset HPD short storm detection to it's default settings.
> > + * If hotplug detection was disabled on any ports due to an HPD storm, it will
> > + * be immediately re-enabled. Always called on exit if the HPD storm detection
> > + * threshold was modified during any tests.
> > + *
> > + * If the system does not support HPD storm detection, this function does
> > + * nothing.
> > + *
> > + * See: https://01.org/linuxgraphics/gfx-docs/drm/gpu/i915.html#hotplug
> > + */
> > +void igt_hpd_short_storm_reset(int drm_fd)
> > +{
> > +	int fd = igt_debugfs_open(drm_fd, "i915_hpd_short_storm_ctl", O_WRONLY);
> > +	const char *buf = "reset";
> > +
> > +	if (fd < 0)
> > +		return;
> > +
> > +	igt_debug("Resetting HPD short storm detection\n");
> > +	igt_assert_eq(write(fd, buf, strlen(buf)), strlen(buf));
> > +
> > +	close(fd);
> > +}
> > +
> > +/**
> > + * igt_require_hpd_short_storm_on_by_default:
> > + *
> > + * Skips the current test if the system does not have HPD short storm detection
> > + * enabled by default.
> > + *
> > + * See: https://01.org/linuxgraphics/gfx-docs/drm/gpu/i915.html#hotplug
> > + */
> > +void igt_require_hpd_short_storm_on_by_default(int drm_fd)
> > +{
> > +	int fd;
> > +	char buf[16] = {0};
> > +
> > +	/* First reset short storm detection to the system default */
> > +	igt_hpd_short_storm_reset(drm_fd);
> > +
> > +	/* Now check if the default is enabled or not */
> > +	fd = igt_debugfs_open(drm_fd, "i915_hpd_short_storm_ctl", O_RDONLY);
> > +
> > +	igt_require_f(fd > 0, "No i915_hpd_short_storm_ctl found in debugfs\n");
> > +	igt_assert_lt(0, read(fd, buf, sizeof(buf)));
> > +	igt_require_f(strncmp(buf, "Enabled: yes\n", sizeof(buf)) == 0,
> > +		      "System keeps HPD short storm detection disabled by default\n");
> > +	close(fd);
> >  }
> >  
> >  static igt_pipe_crc_t *
> > diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
> > index 1233cd8f..21b382a3 100644
> > --- a/lib/igt_debugfs.h
> > +++ b/lib/igt_debugfs.h
> > @@ -143,6 +143,10 @@ void igt_hpd_storm_reset(int fd);
> >  bool igt_hpd_storm_detected(int fd);
> >  void igt_require_hpd_storm_ctl(int fd);
> >  
> > +void igt_hpd_short_storm_set_enabled(int fd, bool enabled);
> > +void igt_hpd_short_storm_reset(int fd);
> > +void igt_require_hpd_short_storm_on_by_default(int fd);
> > +
> >  /*
> >   * Drop caches
> >   */
> > diff --git a/tests/kms_chamelium.c b/tests/kms_chamelium.c
> > index 0097dbcc..7ab33830 100644
> > --- a/tests/kms_chamelium.c
> > +++ b/tests/kms_chamelium.c
> > @@ -45,6 +45,7 @@ typedef struct {
> >  #define HOTPLUG_TIMEOUT 20 /* seconds */
> >  
> >  #define HPD_STORM_PULSE_INTERVAL_DP 100 /* ms */
> > +#define HPD_SHORT_STORM_PULSE_INTERVAL_DP 2 /* ms */
> 
> A sink should deassert hpd for .5 to 1 ms to generate a short hpd.
> 2 ms is the max short pulse duration accepted by a source device.
> So if if we want to guarantee that we generate a short hpd as
> opposed to a long hpd we should probably not aim for the full
> 2 ms here.

Ah. So we split it 1:1 for the deassert and assert phases.
But the docs do not explain how the resulting pulse will
look like.

Ie. do we get
 _________
/         \_________
<- D ms -><- A ms ->
or
          _________
_________/         \
<- D ms -><- A ms ->
or
 __________________
/                  \
<- D ms -><- A ms ->
or

_________/\_________
<- D ms -><- A ms ->

I'm guessin it's not the last one :). The third one would also be
a bit weird perhaps but could be the case I suppose, and that would
give us the full 2 ms pulse. My money would be on the first option
though, in which case the 2ms total duration seems fine.

> 
> >  #define HPD_STORM_PULSE_INTERVAL_HDMI 200 /* ms */
> >  
> >  #define HPD_TOGGLE_COUNT_VGA 5
> > @@ -775,6 +776,44 @@ test_hpd_storm_disable(data_t *data, struct chamelium_port *port, int width)
> >  	igt_hpd_storm_reset(data->drm_fd);
> >  }
> >  
> > +static void
> > +test_hpd_short_storm_detect(data_t *data, struct chamelium_port *port)
> > +{
> > +	igt_require_hpd_storm_ctl(data->drm_fd);
> > +	igt_require_hpd_short_storm_on_by_default(data->drm_fd);
> > +	reset_state(data, port);
> > +
> > +	/* Leave room in the threshold for the two long pulses this might
> > +	 * cause
> > +	 */
> > +	igt_hpd_storm_set_threshold(data->drm_fd, 21);
> > +	chamelium_fire_hpd_pulses(data->chamelium, port,
> > +				  HPD_SHORT_STORM_PULSE_INTERVAL_DP, 25, false);
> > +	igt_assert(igt_hpd_storm_detected(data->drm_fd));
> > +
> > +	igt_hpd_storm_reset(data->drm_fd);
> > +}
> > +
> > +static void
> > +test_hpd_short_storm_disable(data_t *data, struct chamelium_port *port)
> > +{
> > +	igt_require_hpd_storm_ctl(data->drm_fd);
> > +	reset_state(data, port);
> > +
> > +	igt_hpd_short_storm_set_enabled(data->drm_fd, false);
> > +
> > +	/* Leave room in the threshold for the two long pulses this might
> > +	 * cause
> > +	 */
> > +	igt_hpd_storm_set_threshold(data->drm_fd, 21);
> > +	chamelium_fire_hpd_pulses(data->chamelium, port,
> > +				  HPD_SHORT_STORM_PULSE_INTERVAL_DP, 25, false);
> > +	igt_assert(!igt_hpd_storm_detected(data->drm_fd));
> > +
> > +	igt_hpd_short_storm_reset(data->drm_fd);
> > +	igt_hpd_storm_reset(data->drm_fd);
> > +}
> > +
> >  #define for_each_port(p, port)            \
> >  	for (p = 0, port = data.ports[p]; \
> >  	     p < data.port_count;         \
> > @@ -856,6 +895,12 @@ igt_main
> >  			test_hpd_storm_disable(&data, port,
> >  					       HPD_STORM_PULSE_INTERVAL_DP);
> >  
> > +		connector_subtest("dp-hpd-short-storm", DisplayPort)
> > +			test_hpd_short_storm_detect(&data, port);
> > +
> > +		connector_subtest("dp-hpd-short-storm-disable", DisplayPort)
> > +			test_hpd_short_storm_disable(&data, port);
> > +
> >  		connector_subtest("dp-edid-change-during-suspend", DisplayPort)
> >  			test_suspend_resume_edid_change(&data, port,
> >  							SUSPEND_STATE_MEM,
> > -- 
> > 2.19.1
> > 
> > _______________________________________________
> > igt-dev mailing list
> > igt-dev@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/igt-dev
> 
> -- 
> Ville Syrjälä
> Intel

-- 
Ville Syrjälä
Intel
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2018-12-11 17:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-21  0:33 [igt-dev] [PATCH i-g-t 0/3] Add tests for HPD short storm detection Lyude
2018-11-21  0:33 ` [igt-dev] [PATCH i-g-t 1/3] lib/kms_chamelium: Use FireHpdPulse for chamelium_hpd_send_pulses() Lyude
2018-12-11 16:52   ` Ville Syrjälä
2018-12-11 21:28     ` Lyude Paul
2018-11-21  0:33 ` [igt-dev] [PATCH i-g-t 2/3] tests/kms_chamelium: Increase HPD storm threshold to 10 from 1 Lyude
2018-12-11 16:56   ` Ville Syrjälä
2018-11-21  0:33 ` [igt-dev] [PATCH i-g-t 3/3] tests/kms_chamelium: Introduce HPD short storm tests Lyude
2018-12-11 17:09   ` Ville Syrjälä
2018-12-11 17:34     ` Ville Syrjälä [this message]
2018-12-11 21:39       ` Lyude Paul
2018-11-21  1:21 ` [igt-dev] ✓ Fi.CI.BAT: success for Add tests for HPD short storm detection Patchwork
2018-11-21 12:07 ` [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=20181211173426.GZ9144@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=lyude@redhat.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.