All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: ville.syrjala@linux.intel.com, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/dp: Allow signals to interrupt drm_aux-dev reads/writes
Date: Thu, 28 Apr 2016 11:49:12 +0300	[thread overview]
Message-ID: <87bn4ui0dz.fsf@intel.com> (raw)
In-Reply-To: <1461786225-7790-1-git-send-email-ville.syrjala@linux.intel.com>

On Wed, 27 Apr 2016, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Let's be nice and interrupt the dpcd aux-dev reads/writes when there's
> a signal pending. Much nicer if the user can hit ^C instead of having to
> sit around waiting for the read/write to finish.
>
> time dd if=/dev/drm_dp_aux0 bs=$((1024*1024))
> ^C
>
> before:
>  real	0m34.681s
>  user	0m0.003s
>  sys	0m6.880s
>
> after:
>  real	0m0.222s
>  user	0m0.006s
>  sys	0m0.057s
>
> Cc: Rafael Antognolli <rafael.antognolli@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>


> ---
>  drivers/gpu/drm/drm_dp_aux_dev.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_dp_aux_dev.c b/drivers/gpu/drm/drm_dp_aux_dev.c
> index f73b38b33a8e..3334baacf43d 100644
> --- a/drivers/gpu/drm/drm_dp_aux_dev.c
> +++ b/drivers/gpu/drm/drm_dp_aux_dev.c
> @@ -159,6 +159,12 @@ static ssize_t auxdev_read(struct file *file, char __user *buf, size_t count,
>  		uint8_t localbuf[DP_AUX_MAX_PAYLOAD_BYTES];
>  		ssize_t todo = min_t(size_t, bytes_pending, sizeof(localbuf));
>  
> +		if (signal_pending(current)) {
> +			res = num_bytes_processed ?
> +				num_bytes_processed : -ERESTARTSYS;
> +			goto out;
> +		}
> +
>  		res = drm_dp_dpcd_read(aux_dev->aux, *offset, localbuf, todo);
>  		if (res <= 0) {
>  			res = num_bytes_processed ? num_bytes_processed : res;
> @@ -202,6 +208,12 @@ static ssize_t auxdev_write(struct file *file, const char __user *buf,
>  		uint8_t localbuf[DP_AUX_MAX_PAYLOAD_BYTES];
>  		ssize_t todo = min_t(size_t, bytes_pending, sizeof(localbuf));
>  
> +		if (signal_pending(current)) {
> +			res = num_bytes_processed ?
> +				num_bytes_processed : -ERESTARTSYS;
> +			goto out;
> +		}
> +
>  		if (__copy_from_user(localbuf,
>  				     buf + num_bytes_processed, todo)) {
>  			res = num_bytes_processed ?

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-04-28  8:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-27 19:43 [PATCH] drm/dp: Allow signals to interrupt drm_aux-dev reads/writes ville.syrjala
2016-04-28  8:49 ` Jani Nikula [this message]
2016-04-28  9:48   ` Daniel Vetter

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=87bn4ui0dz.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ville.syrjala@linux.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.