Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Piorkowski, Piotr" <piotr.piorkowski@intel.com>
To: "igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
	"chris@chris-wilson.co.uk" <chris@chris-wilson.co.uk>
Subject: Re: [igt-dev] [PATCH v2 2/2] tests/debugfs_test: Add subtest guc_log_relay
Date: Tue, 24 Apr 2018 13:24:41 +0000	[thread overview]
Message-ID: <1524576280.27968.22.camel@intel.com> (raw)
In-Reply-To: <152455884489.12387.4829764259332975897@mail.alporthouse.com>


[-- Attachment #1.1: Type: text/plain, Size: 3984 bytes --]

On Tue, 2018-04-24 at 09:34 +0100, Chris Wilson wrote:
> Quoting Piotr Piorkowski (2018-04-24 08:50:04)
> > From: Piotr Piórkowski <piotr.piorkowski@intel.com>
> > 
> > We doesn't have any tests to verify functionality of
> > i915_guc_log_relay.
> > I think we should test this component.
> > 
> > Let's add simple subtest to debugfs_test, which will test if guc
> > is enabled:
> > - opening the i915_guc_log_relay and creating a file guc_log0,
> > - flushing GuC log buffer,
> > - closing i915_guc_log_relay with removing from debugfs guc_log0.
> > Otherwise, the test will check if the attempt to open the
> > guc_log_relay
> > returns an error ENODEV.
> > 
> > v2:
> > - guc isn't required for run the subtest (Chris)
> > - rewrite subtest as function (Michal Winiarski)
> > - add case when the guc is not enabled
> > 
> > Signed-off-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
> > Cc: Sagar Arun Kamble <sagar.a.kamble@intel.com>
> > Cc: Lukasz Fiedorowicz <lukasz.fiedorowicz@intel.com>
> > Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> > Cc: Michał Winiarski <michal.winiarski@intel.com>
> > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> > ---
> >  tests/debugfs_test.c | 93
> > ++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 93 insertions(+)
> > 
> > diff --git a/tests/debugfs_test.c b/tests/debugfs_test.c
> > index 2e87e442..c7a953b1 100644
> > --- a/tests/debugfs_test.c
> > +++ b/tests/debugfs_test.c
> > @@ -26,6 +26,7 @@
> >  #include <fcntl.h>
> >  #include <sys/types.h>
> >  #include <dirent.h>
> > +#include <errno.h>
> >  
> >  static void read_and_discard_sysfs_entries(int path_fd, int
> > indent)
> >  {
> > @@ -87,6 +88,95 @@ static void read_and_discard_sysfs_entries(int
> > path_fd, int indent)
> >         closedir(dir);
> >  }
> >  
> > +static bool is_guc_loaded(int gfx_fd)
> > +{
> > +       bool load;
> > +
> > +       load = igt_debugfs_search(gfx_fd, "i915_guc_load_status",
> > +                               "    status: fetch SUCCESS, load
> > SUCCESS");
> > +       igt_debug("GuC %s loaded\n", load ? "is" : "is not");
> > +
> > +       return load;
> > +}
> > +
> > +#define I915_GUC_LOG_RELAY_FILE  "i915_guc_log_relay"
> > +#define GUC_LOG_FILE  "guc_log0"
> > +
> > +static void check_guc_log_relay(int gfx_fd)
> > +{
> > +
> > +       int page_size = getpagesize();
> > +       int fd_relay = -1, fd_log = -1;
> > +       ssize_t read_size;
> > +       uint8_t *buffer;
> > +       bool guc_is_loaded;
> > +       int debugfs;
> > +
> > +       guc_is_loaded = is_guc_loaded(gfx_fd);
> > +
> > +       debugfs = igt_debugfs_dir(gfx_fd);
> > +       fd_relay = openat(debugfs, I915_GUC_LOG_RELAY_FILE,
> > O_RDWR);
> > +
> > +       if (!guc_is_loaded) {
> > +               igt_debug("Case when GuC is disabled\n");
> 
> Debugging left over? Lots of fluff messages.
> 
> > +               igt_debug("Attempt open file %s return value: %d (
> > %m )\n",
> > +                         I915_GUC_LOG_RELAY_FILE, errno);
> 
> Push this into the failure message.
> 
> > +
> > +               igt_assert(errno == ENODEV);
> 
> errno may have been scribbled over many times, and would have only
> been
> valid if fd_relay is -1.
> 
> Use igt_assert_eq, but you really want igt_assert_f() if you want
> informative error messages rather than igt_debug spam.
> 
> But is this the interface you really want to enforce? If the guc log
> relay is accessible is up to the kernel, not you. If the kernel tells
> you it is not available, skip and move on.

This subtest is to check if guc_log_relay works correctly, no matter if
the guc works or not. The correct behavior of guc_log_relay, when the
guc is disabled, is to return the error ENODEV, and this subtest checks
it (with fix if fd_relay is -1). So do you think that this way to
realize the subtest is wrong, and I should change it? 

Piotr

[-- Attachment #1.2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 3278 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2018-04-24 13:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-10 13:52 [igt-dev] [PATCH i-g-t 1/2] lib/igt_debugfs: Add function to check if file exists in debugfs Piotr Piórkowski
2018-04-10 13:52 ` [igt-dev] [PATCH i-g-t 2/2] tests/debugfs_test: Add subtest guc_log_relay Piotr Piórkowski
2018-04-10 14:06   ` Chris Wilson
2018-04-10 14:02 ` [igt-dev] [PATCH i-g-t 1/2] lib/igt_debugfs: Add function to check if file exists in debugfs Chris Wilson
2018-04-10 14:46 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] " Patchwork
2018-04-10 16:57 ` [igt-dev] ✗ Fi.CI.IGT: warning " Patchwork
2018-04-24  7:50 ` [igt-dev] [PATCH v2 1/2] " Piotr Piorkowski
2018-04-24  8:27   ` Chris Wilson
2018-05-15 15:29   ` [igt-dev] [PATCH v3 " Piotr Piorkowski
2018-05-21 12:55   ` Piotr Piorkowski
2018-05-21 12:55   ` [igt-dev] [PATCH v3 2/2] tests/debugfs_test: Add subtest guc_log_relay Piotr Piorkowski
2018-04-24  7:50 ` [igt-dev] [PATCH v2 " Piotr Piorkowski
2018-04-24  8:34   ` Chris Wilson
2018-04-24 13:24     ` Piorkowski, Piotr [this message]
2018-04-24  8:52 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [v2,1/2] lib/igt_debugfs: Add function to check if file exists in debugfs (rev2) Patchwork
2018-05-15 15:57 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [v3,1/2] lib/igt_debugfs: Add function to check if file exists in debugfs (rev3) Patchwork
2018-05-21 15:08 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [v3,2/2] tests/debugfs_test: Add subtest guc_log_relay (rev5) 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=1524576280.27968.22.camel@intel.com \
    --to=piotr.piorkowski@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    /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