Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752179AbaKZRWG (ORCPT ); Wed, 26 Nov 2014 12:22:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36259 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750881AbaKZRWE (ORCPT ); Wed, 26 Nov 2014 12:22:04 -0500 Date: Wed, 26 Nov 2014 19:21:39 +0200 From: "Michael S. Tsirkin" To: Christian Borntraeger Cc: David Hildenbrand , linuxppc-dev@lists.ozlabs.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, benh@kernel.crashing.org, paulus@samba.org, akpm@linux-foundation.org, heiko.carstens@de.ibm.com, schwidefsky@de.ibm.com, mingo@kernel.org Subject: Re: [RFC 0/2] Reenable might_sleep() checks for might_fault() when atomic Message-ID: <20141126172139.GA11746@redhat.com> References: <20141126070258.GA25523@redhat.com> <20141126110504.511b733a@thinkpad-w530> <20141126151729.GB9612@redhat.com> <20141126152334.GA9648@redhat.com> <20141126163207.63810fcb@thinkpad-w530> <20141126154717.GB10568@redhat.com> <5475FAB1.1000802@de.ibm.com> <20141126163216.GB10850@redhat.com> <547604FC.4030300@de.ibm.com> <20141126170447.GC11202@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20141126170447.GC11202@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 26, 2014 at 07:04:47PM +0200, Michael S. Tsirkin wrote: > On Wed, Nov 26, 2014 at 05:51:08PM +0100, Christian Borntraeger wrote: > > > But this one was > giving users in field false positives. > > > > So lets try to fix those, ok? If we cant, then tough luck. > > Sure. > I think the simplest way might be to make spinlock disable > premption when CONFIG_DEBUG_ATOMIC_SLEEP is enabled. Specifically maybe DEBUG_ATOMIC_SLEEP should select PREEMPT_COUNT? > As a result, userspace access will fail and caller will > get a nice error. > > > > > But coming up with wrong statements is not helpful. > > True. Sorry that I did that. > > > > > > > The point is that *_user is safe with preempt off. > > > It returns an error gracefully. > > > It does not sleep. > > > It does not trigger the scheduler in that context. > > > > There are special cases where your statement is true. But its not in general. > > copy_to_user might fault and that fault might sleep and reschedule. > > Yes. But not if called inatomic. > > > > > For example handle_mm_fault might go down to pud_alloc, pmd_alloc etc and all these functions could do an GFP_KERNEL allocation. Which might sleep. Which will schedule. > > > > > > > > > > > > > David's patch makes it say it does, so it's wrong. > > > > > > > > > > > Absolutely. > I think you can already debug your case easily, by enabling CONFIG_PREEMPT. > This seems counter-intuitive, and distro debug kernels don't seem to do this. > > -- > MST -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/