Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp532310ybl; Thu, 15 Aug 2019 23:22:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqxlZXrHeHiLRYz64cJt4mavqkb5wCd4cywbDZd8KytdUAUfF6VtvYSLQfk2/OA8b9kvgoMf X-Received: by 2002:a63:c009:: with SMTP id h9mr6397160pgg.166.1565936523382; Thu, 15 Aug 2019 23:22:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565936523; cv=none; d=google.com; s=arc-20160816; b=EWutQsRfarfSvjNCZKBjDxlhDDLAwM0RGV4UnQi9pFd2GIwFFS3h1MtcM0/zbaDc66 34T41pwy9cVbymnmjXBTjUN5Q83lGlMgNwWrdP+kgWlhI/eKTus2DQQxybfbprjoIRbO 82C7QUrCaIGhHXif+2NLfYrY6EMjsXkfwELOkQjvf5Nd52y2zs2UuV9ccdvtITTC3dE3 SSXVhPy5X6IaS0DZzsrr6o++Xbbw9U/vjUEz6RMXHGHHI+2KyJBydhi5ehwgSgYLEWdY VkwxJFcBDg5Els3Tr0o3GcqfIk8jAViXb5pItIh0xjwDFxoT5lxhWhMKBvUZCdZWzoMe yFQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=bnzSBHY/JdeQAgbtdAEAW270/fKb4r8flWE61wbC5Lo=; b=JueS5mRtsrTSG9fnVmCjVh5LhaGMP8FA4HIWpAvmOM+qI2yzVTuiZuOJUZ0twXBD2R bqTawe1dc09fCz1bPQGS9hsSj6j9Fo7sJw+q+AAzj+4L74/zyv/w59rS0neN7wVtbrf+ cWV5U88UkoanYM8N+EIRAFImZue1lqQZ/0CN038KuReNiJ3471wuHirCU2+u4kv5tdou poJeTWyG/kD2l5pNHSlXPVsTyPNUZxtaxwzdBq5nOdUKvt9nwlwEkn4RWBcCdwLIgoqJ T0KPWI5eByA9Vc9VPAVsUirkV45gQRO4gSc3YMtLVyRgLEBcuEJAWIoOA3MKzLkTmunj ZMuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=UVlNUshc; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q11si2393572pjb.84.2019.08.15.23.21.47; Thu, 15 Aug 2019 23:22:03 -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; dkim=pass header.i=@ffwll.ch header.s=google header.b=UVlNUshc; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726736AbfHPGVJ (ORCPT + 99 others); Fri, 16 Aug 2019 02:21:09 -0400 Received: from mail-oi1-f196.google.com ([209.85.167.196]:40055 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725897AbfHPGVJ (ORCPT ); Fri, 16 Aug 2019 02:21:09 -0400 Received: by mail-oi1-f196.google.com with SMTP id h21so4055827oie.7 for ; Thu, 15 Aug 2019 23:21:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bnzSBHY/JdeQAgbtdAEAW270/fKb4r8flWE61wbC5Lo=; b=UVlNUshcEIlU+yobZlz2y42/ujMlRlo+ct+0p80oBP1RIOLjVgza5yLAH9kiWJ0ywH rn5w4IcTB48oHSkKlTlUwiOfhTg79xGXAcMQPEun+qGn+KaPE/v6hTzroIHT9rozR67E 6n0mNYDqP9fJbFBUtd9FG2uXYDGCCqC+daSJ0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bnzSBHY/JdeQAgbtdAEAW270/fKb4r8flWE61wbC5Lo=; b=L+zTHLkbVkjuCwfX9rHcYPSYCq5EgtP16jNgi01oDcAq/Z0XMWiZhAd/1aITNZW8uR geJdaOE+ZVUIubAYlO6euITjT+xrHos183nL2MwBJTOcW+9DkqBIJ4AszIpvEM99hU/C XNQIJpZoa9zIVJyeZ6Y14DOqm8fXG4SY6yTSi4eI6TjhXLjc+6c3dq/1hnSq7IUNlaUI fUvJKLTgZKbtjJ6gmlaWaLq29y4+b6GLSXYutzuHeizCe+vj7qkxwSMuvdE1Y4CVEFan Ofi1uRyVW/aF27NywxBCs1PFttM+GVEFLWrsDRZ9LJoCzaVdlsPMBFxelITy7vASDxip hUDQ== X-Gm-Message-State: APjAAAWJMsrRgbpQghdE8YiNIh+QcIxFWlyliXRKeAj8YFGbgsaZO6nu BLJ5dSEFVa2jyo66vLklDgMUUHGWC/1s2Fyl9wox5Q== X-Received: by 2002:aca:1a0b:: with SMTP id a11mr4149187oia.128.1565936467928; Thu, 15 Aug 2019 23:21:07 -0700 (PDT) MIME-Version: 1.0 References: <20190815155950.GN9477@dhcp22.suse.cz> <20190815165631.GK21596@ziepe.ca> <20190815174207.GR9477@dhcp22.suse.cz> <20190815182448.GP21596@ziepe.ca> <20190815190525.GS9477@dhcp22.suse.cz> <20190815191810.GR21596@ziepe.ca> <20190815193526.GT9477@dhcp22.suse.cz> <20190815202721.GV21596@ziepe.ca> <20190816010036.GA9915@ziepe.ca> In-Reply-To: <20190816010036.GA9915@ziepe.ca> From: Daniel Vetter Date: Fri, 16 Aug 2019 08:20:55 +0200 Message-ID: Subject: Re: [Intel-gfx] [PATCH 2/5] kernel.h: Add non_block_start/end() To: Jason Gunthorpe Cc: Michal Hocko , Feng Tang , Randy Dunlap , Kees Cook , Masahiro Yamada , Peter Zijlstra , Intel Graphics Development , Jann Horn , LKML , DRI Development , Linux MM , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Ingo Molnar , Thomas Gleixner , David Rientjes , Wei Wang , Daniel Vetter , Andrew Morton , Andy Shevchenko , =?UTF-8?Q?Christian_K=C3=B6nig?= Content-Type: text/plain; charset="UTF-8" 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 3:00 AM Jason Gunthorpe wrote: > On Thu, Aug 15, 2019 at 10:49:31PM +0200, Daniel Vetter wrote: > > On Thu, Aug 15, 2019 at 10:27 PM Jason Gunthorpe wrote: > > > On Thu, Aug 15, 2019 at 10:16:43PM +0200, Daniel Vetter wrote: > > > > So if someone can explain to me how that works with lockdep I can of > > > > course implement it. But afaics that doesn't exist (I tried to explain > > > > that somewhere else already), and I'm no really looking forward to > > > > hacking also on lockdep for this little series. > > > > > > Hmm, kind of looks like it is done by calling preempt_disable() > > > > Yup. That was v1, then came the suggestion that disabling preemption > > is maybe not the best thing (the oom reaper could still run for a long > > time comparatively, if it's cleaning out gigabytes of process memory > > or what not, hence this dedicated debug infrastructure). > > Oh, I'm coming in late, sorry > > Anyhow, I was thinking since we agreed this can trigger on some > CONFIG_DEBUG flag, something like > > /* This is a sleepable region, but use preempt_disable to get debugging > * for calls that are not allowed to block for OOM [.. insert > * Michal's explanation.. ] */ > if (IS_ENABLED(CONFIG_DEBUG_ATOMIC_SLEEP) && !mmu_notifier_range_blockable(range)) > preempt_disable(); > ops->invalidate_range_start(); I think we also discussed that, and some expressed concerns it would change behaviour/timing too much for testing. Since this does does disable preemption for real, not just for might_sleep. > And I have also been idly mulling doing something like > > if (IS_ENABLED(CONFIG_DEBUG_NOTIFIERS) && > rand && > mmu_notifier_range_blockable(range)) { > range->flags = 0 > if (!ops->invalidate_range_start(range)) > continue > > // Failed, try again as blockable > range->flags = MMU_NOTIFIER_RANGE_BLOCKABLE > } > ops->invalidate_range_start(range); > > Which would give coverage for this corner case without forcing OOM. Hm, this sounds like a neat idea to slap on top. The rand is going to be a bit tricky though, but I guess for this we could stuff another counter into task_struct and just e.g. do this every 1000th or so invalidate (well need to pick a prime so we cycle through notifiers in case there's multiple). I like. Michal, thoughts? -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch