public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Dmitry V. Levin" <ldv@altlinux.org>
To: strace-devel@lists.sourceforge.net
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v4 4/5] drm: Add decoding of i915 ioctls
Date: Fri, 11 Sep 2015 15:04:14 +0300	[thread overview]
Message-ID: <20150911120414.GA6177@altlinux.org> (raw)
In-Reply-To: <20150911113102.GB28550@patrik-desktop.isw.intel.com>


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

On Fri, Sep 11, 2015 at 01:31:02PM +0200, Patrik Jakobsson wrote:
> On Tue, Sep 08, 2015 at 04:18:11AM +0300, Dmitry V. Levin wrote:
> > On Mon, Aug 24, 2015 at 02:42:49PM +0200, Patrik Jakobsson wrote:
> > > +static int i915_getparam(struct tcb *tcp, const unsigned int code, long arg)
> > > +{
> > > +	struct drm_i915_getparam param;
> > > +	int value;
> > > +
> > > +	if (umove(tcp, arg, &param))
> > > +		return RVAL_DECODED;
> > > +
> > > +	if (entering(tcp)) {
> > > +		tprints(", {param=");
> > > +		printxval(drm_i915_getparams, param.param, "I915_PARAM_???");
> > > +	} else if (exiting(tcp)) {
> > > +		if (umove(tcp, (long)param.value, &value))
> > > +			return RVAL_DECODED;
> > 
> > Since part of param has already been printed, RVAL_DECODED shouldn't be
> > returned here.  For the same reason, RVAL_DECODED shouldn't be returned
> > earlier in this function.
> 
> The usage of RVAL_DECODED is quite confusing. RVAL_DECODED to me should be "We
> decoded this don't do any fallback". How did you intent it to be used?

RVAL_DECODED itself is trivial: by setting this flag parser tells its
caller that decoding is finished on entering and it shouldn't be called on
exiting of this syscall.  Setting this flag on exiting has no effect.

With regards to ioctl parsers, there might be some confusion because they
also have this unusual return code +1 semantics.  In this example, the
problem with "return RVAL_DECODED" statements is that if they happen on
exiting, it means that something has already been printed on entering
already and by returning RVAL_DECODED parser tells its caller to perform
the default action that also prints something.

That is, ioctl parser should return
- on entering:
  + any value (it's ignored) without RVAL_DECODED flag set:
    continue processing on exiting;
  + RVAL_DECODED:
    skip processing on exiting and tell the caller
    to perform default processing on entering;
  + RVAL_DECODED | (1 + RVAL_*):
    skip processing on exiting and tell the caller
    to skip default processing;
- on exiting:
  + 0 (with or without RVAL_DECODED set, it's ignored anyway):
    tell the caller to perform default processing on exiting;
  + 1 + RVAL_* (RVAL_DECODED is ignored):
    tell the caller to skip default processing.

> > > +			break;
> > > +		default:
> > > +			tprintf("%d", value);
> > 
> > Likewise.
> > 
> > > +		}
> > > +		tprints("}");
> > > +	}
> > > +
> > > +	return RVAL_DECODED | 1;
> > 
> > This shouldn't be returned on entering(tcp).
> 
> If all decoding would be done when entering is finished, wouldn't it make sense
> to allow RVAL_DECODED here? Still don't understand how this is intended to work.

Usally only IOW parsers return codes with RVAL_DECODED set on entering.
IOWR also print something on exiting so they shouldn't normally return
RVAL_DECODED on entering.


-- 
ldv

[-- Attachment #1.2: Type: application/pgp-signature, Size: 181 bytes --]

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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-09-11 12:04 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-24 12:42 [PATCH v4 0/5] drm: Add decoding for DRM/KMS and i915 ioctls Patrik Jakobsson
2015-08-24 12:42 ` [PATCH v4 1/5] drm: Add config for detecting libdrm Patrik Jakobsson
2015-08-25 21:09   ` Mike Frysinger
2015-08-24 12:42 ` [PATCH v4 2/5] drm: Add private data field to trace control block Patrik Jakobsson
     [not found]   ` <1440420170-13337-3-git-send-email-patrik.jakobsson-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-08-25 21:12     ` Mike Frysinger
2015-08-26 13:26       ` Patrik Jakobsson
2015-08-31 12:37         ` Patrik Jakobsson
     [not found]           ` <20150831123707.GA22376-mbq0NjRWzOqzCX88HRwER2kA0OJWJZs2VpNB7YpNyf8@public.gmane.org>
2015-09-07 16:51             ` [Intel-gfx] " Dmitry V. Levin
2015-09-07 18:23               ` Patrik Jakobsson
     [not found]                 ` <CAMeQTsZWUPtGUkfVdvhu4bzjQOQ-WvqQ=xOQJzNOw+kOZLGExw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-11-24  5:46                   ` [Intel-gfx] " Dmitry V. Levin
2015-11-26 13:40                     ` Patrik Jakobsson
2016-07-20 14:50                   ` [Intel-gfx] " Dmitry V. Levin
2016-07-20 16:11                     ` Patrik Jakobsson
2015-08-24 12:42 ` [PATCH v4 3/5] drm: Add dispatcher and driver identification for DRM Patrik Jakobsson
2015-09-08  0:36   ` Dmitry V. Levin
2015-09-11 10:57     ` Patrik Jakobsson
2015-11-24  5:53       ` Dmitry V. Levin
2015-08-24 12:42 ` [PATCH v4 4/5] drm: Add decoding of i915 ioctls Patrik Jakobsson
2015-09-08  1:18   ` Dmitry V. Levin
2015-09-08  1:30     ` Dmitry V. Levin
2015-09-09 11:52       ` Dmitry V. Levin
2015-09-11 11:31     ` Patrik Jakobsson
2015-09-11 12:04       ` Dmitry V. Levin [this message]
2015-08-24 12:42 ` [PATCH v4 5/5] drm: Add decoding of DRM and KMS ioctls Patrik Jakobsson
2015-09-08 22:50   ` Dmitry V. Levin
2015-09-11 11:39     ` Patrik Jakobsson
2015-09-11 12:10       ` Dmitry V. Levin
     [not found]         ` <20150911121005.GB6177-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org>
2015-09-11 12:20           ` Patrik Jakobsson
2015-09-11 12:36             ` Dmitry V. Levin
2015-09-07  8:47 ` [PATCH v4 0/5] drm: Add decoding for DRM/KMS and i915 ioctls Gabriel Laskar

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=20150911120414.GA6177@altlinux.org \
    --to=ldv@altlinux.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=strace-devel@lists.sourceforge.net \
    /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