From: Thomas Hellstrom <thellstrom@vmware.com>
To: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Daniel Vetter <daniel.vetter@ffwll.ch>,
Dave Airlie <airlied@linux.ie>,
intel-gfx <intel-gfx@lists.freedesktop.org>,
dri-devel <dri-devel@lists.freedesktop.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ben Skeggs <bskeggs@redhat.com>,
Alex Deucher <alexander.deucher@amd.com>
Subject: Re: [RFC PATCH] drm/nouveau: fix nested locking in mmap handler
Date: Tue, 24 Sep 2013 19:53:57 +0200 [thread overview]
Message-ID: <5241D1B5.90707@vmware.com> (raw)
In-Reply-To: <52415EDD.6030508@canonical.com>
On 09/24/2013 11:43 AM, Maarten Lankhorst wrote:
> Op 24-09-13 11:03, Thomas Hellstrom schreef:
>> On 09/24/2013 09:34 AM, Maarten Lankhorst wrote:
>>> Op 24-09-13 09:22, Thomas Hellstrom schreef:
>>>> Actually, it's not the locking order bo:reserve -> mmap_sem that triggers the lockdep warning, right? but the fact that copy_from_user could recurse into the fault handler? Grabbing bo:reseves recursively? which should leave us free to choose locking order at this point.
>>> Same thing.
>>>
>>> When PROVE_LOCKING is enabled the might_fault calls in copy_to/from_user do a fake locking of mmap_sem, which means all locking errors, provided that the reservation lock is taken at least once with mmap_sem held (eg the ttm fault handler is called at least once, it can be done separately, it doesn't need to be done in the same syscall). So any bugs will be found. The only thing to worry about is that lockdep turns off after finding 1 error, so you have to make sure it doesn't bomb out before completing tests, which is sometimes a problem on early rc kernels. ;)
>> My point was that when we only have copy_[to|from]_user_inatomic inside any bo:reservations, the might_fault would never be called inside any reservations and we should, in principle, be free to choose locking order, provided of course it could be done cleanly in fault()?
> I think it makes sense to keep mmap_sem the outer lock here, and not do scary things in fault. Especially if the mm locking is going to be changed in the future. But you're correct, if holding reservations only inatomic should be used.
>
> ~Maarten
Now that we after all were forced to enter the dark realm of copy-user
slowpaths, I don't really have a strong opinion anymore, other than that
we should try to avoid building too much code in that depends on either
locking order, so that we could change it if _really_ needed.
/Thomas
prev parent reply other threads:[~2013-09-24 17:54 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-12 15:06 [BUG] completely bonkers use of set_need_resched + VM_FAULT_NOPAGE Peter Zijlstra
2013-09-12 15:11 ` Maarten Lankhorst
2013-09-12 15:14 ` Peter Zijlstra
2013-09-12 15:36 ` Daniel Vetter
2013-09-12 15:43 ` Peter Zijlstra
2013-09-12 15:58 ` Daniel Vetter
2013-09-12 16:22 ` Peter Zijlstra
2013-09-12 16:35 ` Chris Wilson
2013-09-12 20:30 ` Peter Zijlstra
2013-09-12 20:37 ` Thomas Gleixner
2013-09-12 19:52 ` Daniel Vetter
2013-09-12 19:58 ` Thomas Gleixner
2013-09-12 20:04 ` Daniel Vetter
2013-09-12 20:20 ` Thomas Gleixner
2013-09-12 20:23 ` Daniel Vetter
2013-09-12 20:39 ` Thomas Gleixner
2013-09-12 20:48 ` Thomas Hellstrom
2013-09-12 16:33 ` Thomas Hellstrom
2013-09-12 15:45 ` Maarten Lankhorst
2013-09-12 16:44 ` Thomas Hellstrom
2013-09-12 19:48 ` Daniel Vetter
2013-09-12 21:50 ` Maarten Lankhorst
2013-09-13 5:33 ` Thomas Hellstrom
2013-09-13 8:26 ` Daniel Vetter
2013-10-08 14:14 ` [RFC PATCH] drm/radeon: fixup locking inversion between mmap_sem and reservations Maarten Lankhorst
2013-10-08 14:33 ` Jerome Glisse
2013-10-08 14:45 ` Christian König
2013-10-08 14:55 ` Jerome Glisse
2013-10-08 16:29 ` Thomas Hellstrom
2013-10-08 16:47 ` Jerome Glisse
2013-10-08 16:58 ` Thomas Hellstrom
2013-10-09 12:36 ` [RFC PATCH v2] drm/radeon: fixup locking inversion between, " Maarten Lankhorst
2013-10-09 10:58 ` [RFC PATCH] drm/radeon: fixup locking inversion between " Maarten Lankhorst
2013-10-08 14:45 ` Maarten Lankhorst
2013-09-13 6:44 ` [BUG] completely bonkers use of set_need_resched + VM_FAULT_NOPAGE Thomas Hellstrom
2013-09-13 7:16 ` Maarten Lankhorst
2013-09-13 7:46 ` Thomas Hellstrom
2013-09-13 7:51 ` Maarten Lankhorst
2013-09-13 8:23 ` Thomas Hellstrom
2013-09-13 8:32 ` Daniel Vetter
2013-09-13 8:39 ` Thomas Hellstrom
2013-09-13 8:58 ` Maarten Lankhorst
2013-09-13 9:21 ` Thomas Hellstrom
2013-09-13 8:29 ` Peter Zijlstra
2013-09-13 8:41 ` Daniel Vetter
2013-09-13 9:00 ` Peter Zijlstra
2013-09-23 15:33 ` [RFC PATCH] drm/nouveau: fix nested locking in mmap handler Maarten Lankhorst
2013-09-24 7:22 ` Thomas Hellstrom
2013-09-24 7:34 ` Maarten Lankhorst
2013-09-24 8:20 ` Ingo Molnar
2013-09-24 9:03 ` Thomas Hellstrom
2013-09-24 9:36 ` Daniel Vetter
2013-09-24 10:11 ` Maarten Lankhorst
2013-09-24 10:33 ` Thomas Hellstrom
2013-09-24 11:32 ` Maarten Lankhorst
2013-09-24 17:04 ` Thomas Hellstrom
2013-09-24 9:43 ` Maarten Lankhorst
2013-09-24 17:53 ` Thomas Hellstrom [this message]
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=5241D1B5.90707@vmware.com \
--to=thellstrom@vmware.com \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=bskeggs@redhat.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@canonical.com \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).