public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Rob Clark <robdclark@gmail.com>,
	linux-arm-msm <linux-arm-msm@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	Julia Lawall <julia.lawall@lip6.fr>,
	Vaishali Thakkar <vaishali.thakkar@oracle.com>,
	freedreno@lists.freedesktop.org
Subject: Re: Use of copy_from_user in msm_gem_submit.c while holding a spin_lock
Date: Thu, 18 Aug 2016 10:31:27 +0200	[thread overview]
Message-ID: <20160818083127.GX6232@phenom.ffwll.local> (raw)
In-Reply-To: <20160817193120.GG2356@ZenIV.linux.org.uk>

On Wed, Aug 17, 2016 at 08:31:20PM +0100, Al Viro wrote:
> On Wed, Aug 17, 2016 at 03:24:38PM -0400, Rob Clark wrote:
> 
> > hmm, looks like, at least on arm (not sure about arm64),
> > 
> > #define __copy_from_user_inatomic __copy_from_user
> > 
> > ie. copy_from_user() minus the access_ok() and memset in the
> > !access_ok() path.. but maybe what I want is just the
> > pagefault_disable() if that disables copy_from_user() being able to
> > block..
> 
> On a bunch of platforms copy_from_user() starts with might_sleep(); again,
> that'll spread to all of the pretty soon.
> 
> Right now those primitives are very badly out of sync; this will change,
> but let's not add more PITA sources.

That sounds great, as part of discussing this on irc with Rob I too
noticed that the the *copy*user* funcs are all rather out of sync. On
i915.ko we go full evil mode and pass (faulting) i915 buffer objects in as
targets for all these copy*user operations. And for added evilness we have
debugfs interfaces to force-unmap/evict these bo, which is used to make
sure that the fault handling in slow-paths (after dropping locks and
reacquiring them) also works - some of i915 code has slow-slow path
fallbacks ;-)

Oh and we have a debugfs knob to disable the prefaulting we do, since
without those the race is way too small.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

  reply	other threads:[~2016-08-18  8:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-17 11:40 Use of copy_from_user in msm_gem_submit.c while holding a spin_lock Vaishali Thakkar
2016-08-17 15:08 ` Rob Clark
2016-08-17 17:08   ` Al Viro
2016-08-17 18:49     ` Rob Clark
2016-08-17 18:58       ` Rob Clark
2016-08-17 19:15       ` Al Viro
2016-08-17 19:24         ` Rob Clark
2016-08-17 19:31           ` Al Viro
2016-08-18  8:31             ` Daniel Vetter [this message]
2016-08-17 21:29         ` Rob Clark
2016-08-18  8:36           ` Daniel Vetter
2016-08-18 10:55             ` Rob Clark
2016-08-18 13:08               ` Daniel Vetter
2016-08-18 13:14                 ` Rob Clark

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=20160818083127.GX6232@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=julia.lawall@lip6.fr \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robdclark@gmail.com \
    --cc=vaishali.thakkar@oracle.com \
    --cc=viro@ZenIV.linux.org.uk \
    /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