public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@01.org, Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org, kbuild-all@01.org
Subject: Re: [Intel-gfx] [PATCH 3/9] drm/i915/selftests: Basic stress test for rapid context switching
Date: Wed, 5 Sep 2018 10:24:04 +0300	[thread overview]
Message-ID: <20180905072404.ekhm2vxtqlztnfcg@mwanda> (raw)
In-Reply-To: <20180830100731.23085-3-chris@chris-wilson.co.uk>

Hi Chris,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on v4.19-rc2 next-20180904]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Chris-Wilson/drm-i915-execlists-Avoid-kicking-priority-on-the-current-context/20180831-082719
base:   git://anongit.freedesktop.org/drm-intel for-linux-next

smatch warnings:
drivers/gpu/drm/i915/selftests/i915_gem_context.c:127 live_nop_switch() warn: double check that we're allocating correct size: 4 vs 1024
drivers/gpu/drm/i915/selftests/i915_gem_context.c:149 live_nop_switch() error: 'request' dereferencing possible ERR_PTR()

# https://github.com/0day-ci/linux/commit/8ec0505beb068f0efefd5ee91b75cd72db4abe6c
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 8ec0505beb068f0efefd5ee91b75cd72db4abe6c
vim +127 drivers/gpu/drm/i915/selftests/i915_gem_context.c

8ec0505b Chris Wilson 2018-08-30   97  
8ec0505b Chris Wilson 2018-08-30   98  static int live_nop_switch(void *arg)
8ec0505b Chris Wilson 2018-08-30   99  {
8ec0505b Chris Wilson 2018-08-30  100  	const unsigned int nctx = 1024;
8ec0505b Chris Wilson 2018-08-30  101  	struct drm_i915_private *i915 = arg;
8ec0505b Chris Wilson 2018-08-30  102  	struct intel_engine_cs *engine;
8ec0505b Chris Wilson 2018-08-30  103  	struct i915_gem_context **ctx;
8ec0505b Chris Wilson 2018-08-30  104  	enum intel_engine_id id;
8ec0505b Chris Wilson 2018-08-30  105  	struct drm_file *file;
8ec0505b Chris Wilson 2018-08-30  106  	struct live_test t;
8ec0505b Chris Wilson 2018-08-30  107  	unsigned long n;
8ec0505b Chris Wilson 2018-08-30  108  	int err = -ENODEV;
8ec0505b Chris Wilson 2018-08-30  109  
8ec0505b Chris Wilson 2018-08-30  110  	/*
8ec0505b Chris Wilson 2018-08-30  111  	 * Create as many contexts as we can feasibly get away with
8ec0505b Chris Wilson 2018-08-30  112  	 * and check we can switch between them rapidly.
8ec0505b Chris Wilson 2018-08-30  113  	 *
8ec0505b Chris Wilson 2018-08-30  114  	 * Serves as very simple stress test for submission and HW switching
8ec0505b Chris Wilson 2018-08-30  115  	 * between contexts.
8ec0505b Chris Wilson 2018-08-30  116  	 */
8ec0505b Chris Wilson 2018-08-30  117  
8ec0505b Chris Wilson 2018-08-30  118  	if (!DRIVER_CAPS(i915)->has_logical_contexts)
8ec0505b Chris Wilson 2018-08-30  119  		return 0;
8ec0505b Chris Wilson 2018-08-30  120  
8ec0505b Chris Wilson 2018-08-30  121  	file = mock_file(i915);
8ec0505b Chris Wilson 2018-08-30  122  	if (IS_ERR(file))
8ec0505b Chris Wilson 2018-08-30  123  		return PTR_ERR(file);
8ec0505b Chris Wilson 2018-08-30  124  
8ec0505b Chris Wilson 2018-08-30  125  	mutex_lock(&i915->drm.struct_mutex);
8ec0505b Chris Wilson 2018-08-30  126  
8ec0505b Chris Wilson 2018-08-30 @127  	ctx = kcalloc(sizeof(*ctx), nctx, GFP_KERNEL);
                                                      ^^^^^^^^^^^^^^^^^^^
This is harmless, but the arguments are swapped.  It should be
p = kcalloc(n, size, GFP);

8ec0505b Chris Wilson 2018-08-30  128  	if (!ctx) {
8ec0505b Chris Wilson 2018-08-30  129  		err = -ENOMEM;
8ec0505b Chris Wilson 2018-08-30  130  		goto out_unlock;
8ec0505b Chris Wilson 2018-08-30  131  	}
8ec0505b Chris Wilson 2018-08-30  132  
8ec0505b Chris Wilson 2018-08-30  133  	for (n = 0; n < nctx; n++) {
8ec0505b Chris Wilson 2018-08-30  134  		ctx[n] = i915_gem_create_context(i915, file->driver_priv);
8ec0505b Chris Wilson 2018-08-30  135  		if (IS_ERR(ctx[n])) {
8ec0505b Chris Wilson 2018-08-30  136  			err = PTR_ERR(ctx[n]);
8ec0505b Chris Wilson 2018-08-30  137  			goto out_unlock;
8ec0505b Chris Wilson 2018-08-30  138  		}
8ec0505b Chris Wilson 2018-08-30  139  	}
8ec0505b Chris Wilson 2018-08-30  140  
8ec0505b Chris Wilson 2018-08-30  141  	for_each_engine(engine, i915, id) {
8ec0505b Chris Wilson 2018-08-30  142  		struct i915_request *request;
8ec0505b Chris Wilson 2018-08-30  143  		unsigned long end_time, prime;
8ec0505b Chris Wilson 2018-08-30  144  		ktime_t times[2] = {};
8ec0505b Chris Wilson 2018-08-30  145  
8ec0505b Chris Wilson 2018-08-30  146  		times[0] = ktime_get_raw();
8ec0505b Chris Wilson 2018-08-30  147  		for (n = 0; n < nctx; n++) {
8ec0505b Chris Wilson 2018-08-30  148  			request = i915_request_alloc(engine, ctx[n]);
8ec0505b Chris Wilson 2018-08-30 @149  			i915_request_add(request);
                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^
No error handling for i915_request_alloc().

8ec0505b Chris Wilson 2018-08-30  150  		}
8ec0505b Chris Wilson 2018-08-30  151  		i915_request_wait(request,
8ec0505b Chris Wilson 2018-08-30  152  				  I915_WAIT_LOCKED,
8ec0505b Chris Wilson 2018-08-30  153  				  MAX_SCHEDULE_TIMEOUT);
8ec0505b Chris Wilson 2018-08-30  154  		times[1] = ktime_get_raw();
8ec0505b Chris Wilson 2018-08-30  155  

  reply	other threads:[~2018-09-05  7:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-30 10:07 [PATCH 1/9] drm/i915/execlists: Avoid kicking priority on the current context Chris Wilson
2018-08-30 10:07 ` [PATCH 2/9] drm/i915: Missed interrupt simulation is no more, tell the world Chris Wilson
2018-08-30 10:07 ` [PATCH 3/9] drm/i915/selftests: Basic stress test for rapid context switching Chris Wilson
2018-09-05  7:24   ` Dan Carpenter [this message]
2018-09-05  8:50   ` [PATCH] " Chris Wilson
2018-08-30 10:07 ` [PATCH 4/9] drm/i915/execlists: Delay updating ring register state after resume Chris Wilson
2018-08-30 10:07 ` [PATCH 5/9] drm/i915/execlists: Use coherent writes into the context image Chris Wilson
2018-08-30 10:07 ` [PATCH 6/9] drm/i915/execlists: Onion unwind for logical_ring_init() failure Chris Wilson
2018-08-30 10:07 ` [PATCH 7/9] drm/i915: Report the number of closed vma held by each context in debugfs Chris Wilson
2018-08-30 10:07 ` [PATCH 8/9] drm/i915: Remove debugfs/i915_ppgtt_info Chris Wilson
2018-08-30 10:07 ` [PATCH 9/9] drm/i915/execlists: Assert the queue is non-empty on unsubmitting Chris Wilson
2018-08-30 12:15 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/9] drm/i915/execlists: Avoid kicking priority on the current context Patchwork
2018-08-30 12:17 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-08-30 12:34 ` ✓ Fi.CI.BAT: success " Patchwork
2018-08-30 16:27 ` ✓ Fi.CI.IGT: " Patchwork
2018-09-05  9:01 ` ✗ Fi.CI.BAT: failure for series starting with [1/9] drm/i915/execlists: Avoid kicking priority on the current context (rev2) 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=20180905072404.ekhm2vxtqlztnfcg@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=kbuild-all@01.org \
    --cc=kbuild@01.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