From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753911AbcHRIcA (ORCPT ); Thu, 18 Aug 2016 04:32:00 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:36785 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753785AbcHRIbc (ORCPT ); Thu, 18 Aug 2016 04:31:32 -0400 Date: Thu, 18 Aug 2016 10:31:27 +0200 From: Daniel Vetter To: Al Viro Cc: Rob Clark , linux-arm-msm , Linux Kernel Mailing List , "dri-devel@lists.freedesktop.org" , Julia Lawall , Vaishali Thakkar , freedreno@lists.freedesktop.org Subject: Re: Use of copy_from_user in msm_gem_submit.c while holding a spin_lock Message-ID: <20160818083127.GX6232@phenom.ffwll.local> Mail-Followup-To: Al Viro , Rob Clark , linux-arm-msm , Linux Kernel Mailing List , "dri-devel@lists.freedesktop.org" , Julia Lawall , Vaishali Thakkar , freedreno@lists.freedesktop.org References: <57B44D2E.2030301@oracle.com> <20160817170827.GC2356@ZenIV.linux.org.uk> <20160817191534.GF2356@ZenIV.linux.org.uk> <20160817193120.GG2356@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160817193120.GG2356@ZenIV.linux.org.uk> X-Operating-System: Linux phenom 4.6.0-1-amd64 User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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