Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1047905ybl; Fri, 16 Aug 2019 08:06:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqyfMrEq0O6KKNbtfxdLmqaWBbO7Oxul6tm1kZ7vOek0UWHABP48Lck6/GYeRYNYtUmJO0gM X-Received: by 2002:a62:1ad4:: with SMTP id a203mr11008872pfa.210.1565967984241; Fri, 16 Aug 2019 08:06:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565967984; cv=none; d=google.com; s=arc-20160816; b=Fp0aiCnefxGGYtvI45NXbp6DwxHCdpuHHiSpdDCQm1zADHh7TlBHYz3uQNJLHGf+0p H89fwtTsn1wYkZ5WuAi1/uyl4ALKi3NkxSuSOGlICqwZO2yZtu1PNePNZG1K5pdbFI57 q1Ljfgf2B8G0EICyepDFZuyFO3xEBeVb73UwZbyzwOGtPYSzMt71ADszqGQVwgvF5pp+ S30o4YafH5BnXXkc5WbJcQk1LazoArkQWLctUdWS5EbS1vzaCjLbjNfH9q5vx/gbY0Rc XfDPd91/HksTcRF8R7IYY5DLci3T32rvMQPFS0eJm1gZdyJZuTCfN+2OVwiNWHC9iFUh YYFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=mCPArggAQsoIfUpAcbzrNS20WbuPvinS2i7qO2whgSc=; b=r1v5nvsa/ERiNgg/27YYGvCgOyNGle7fd5CZHicdWsgqa3VdcWhfUzGK99VnbOP6n9 KJYroKcE6o+QzxMWwlejpIyuUTWCmQ0H9znRkQwqm/sFnIlGvA424Nq1OrXQ+HxmSIlm bd7pqG+7L+WUVuN7tjWlElDhPGSsJcF4VAem03NOQsFDwpt3iAemIp1PXYV4Q6fr4BmK 0lJ6p6JK+vzVzm9MWcYprbMos9UaoNb4IVlKvPPrQqsQr809Na8M+Y8HlzcW0ol7Nku6 cUqumviEjscrwtIgFd0lLFqQQiBq+Mnek4Wzu7cNQS2Hd0GJFk+G8TpT/Fjlfj9St0JO TWYw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f7si4019025pgv.135.2019.08.16.08.06.08; Fri, 16 Aug 2019 08:06:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727457AbfHPPFG (ORCPT + 99 others); Fri, 16 Aug 2019 11:05:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60580 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727217AbfHPPFG (ORCPT ); Fri, 16 Aug 2019 11:05:06 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 82BA23001472; Fri, 16 Aug 2019 15:05:05 +0000 (UTC) Received: from redhat.com (ovpn-123-168.rdu2.redhat.com [10.10.123.168]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0B2FA18780; Fri, 16 Aug 2019 15:05:02 +0000 (UTC) Date: Fri, 16 Aug 2019 11:05:01 -0400 From: Jerome Glisse To: Jason Gunthorpe Cc: Michal Hocko , LKML , "linux-mm@kvack.org DRI Development" , Intel Graphics Development , Peter Zijlstra , Ingo Molnar , Andrew Morton , David Rientjes , Christian =?iso-8859-1?Q?K=F6nig?= , Masahiro Yamada , Wei Wang , Andy Shevchenko , Thomas Gleixner , Jann Horn , Feng Tang , Kees Cook , Randy Dunlap , Daniel Vetter Subject: Re: [PATCH 2/5] kernel.h: Add non_block_start/end() Message-ID: <20190816150501.GA3149@redhat.com> References: <20190815174207.GR9477@dhcp22.suse.cz> <20190815182448.GP21596@ziepe.ca> <20190815190525.GS9477@dhcp22.suse.cz> <20190815191810.GR21596@ziepe.ca> <20190815193526.GT9477@dhcp22.suse.cz> <20190815201323.GU21596@ziepe.ca> <20190816081029.GA27790@dhcp22.suse.cz> <20190816121906.GC5398@ziepe.ca> <20190816122625.GA10499@dhcp22.suse.cz> <20190816143145.GD5398@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190816143145.GD5398@ziepe.ca> User-Agent: Mutt/1.12.1 (2019-06-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Fri, 16 Aug 2019 15:05:06 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 16, 2019 at 11:31:45AM -0300, Jason Gunthorpe wrote: > On Fri, Aug 16, 2019 at 02:26:25PM +0200, Michal Hocko wrote: > > On Fri 16-08-19 09:19:06, Jason Gunthorpe wrote: > > > On Fri, Aug 16, 2019 at 10:10:29AM +0200, Michal Hocko wrote: > > > > On Thu 15-08-19 17:13:23, Jason Gunthorpe wrote: > > > > > On Thu, Aug 15, 2019 at 09:35:26PM +0200, Michal Hocko wrote: [...] > > > I would like to inject it into the notifier path as this is very > > > difficult for driver authors to discover and know about, but I'm > > > worried about your false positive remark. > > > > > > I think I understand we can use only GFP_ATOMIC in the notifiers, but > > > we need a strategy to handle OOM to guarentee forward progress. > > > > Your example is from the notifier registration IIUC. > > Yes, that is where this commit hit it.. Triggering this under an > actual notifier to get a lockdep report is hard. > > > Can you pre-allocate before taking locks? Could you point me to some > > examples when the allocation is necessary in the range notifier > > callback? > > Hmm. I took a careful look, I only found mlx5 as obviously allocating > memory: > > mlx5_ib_invalidate_range() > mlx5_ib_update_xlt() > __get_free_pages(gfp, get_order(size)); > > However, I think this could be changed to fall back to some small > buffer if allocation fails. The existing scheme looks sketchy > > nouveau does: > > nouveau_svmm_invalidate > nvif_object_mthd > kmalloc(GFP_KERNEL) > > But I think it reliably uses a stack buffer here > > i915 I think Daniel said he audited. > > amd_mn.. The actual invalidate_range_start does not allocate memory, > but it is entangled with so many locks it would need careful analysis > to be sure. > > The others look generally OK, which is good, better than I hoped :) It is on my TODO list to get rid of allocation in notifier callback (iirc nouveau already use the stack unless it was lost in all the revision it wants through). Anyway i do not think we need allocation in notifier. Cheers, J?r?me