From patchwork Thu Oct 25 14:35:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10655913 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D02C514BB for ; Thu, 25 Oct 2018 14:35:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFE5D2BC3B for ; Thu, 25 Oct 2018 14:35:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B36072BC39; Thu, 25 Oct 2018 14:35:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 701F02BC39 for ; Thu, 25 Oct 2018 14:35:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 89DAC6E295; Thu, 25 Oct 2018 14:35:43 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by gabe.freedesktop.org (Postfix) with ESMTPS id C6E486E28E for ; Thu, 25 Oct 2018 14:35:41 +0000 (UTC) Received: by mail-ed1-x542.google.com with SMTP id c15-v6so8707420eds.4 for ; Thu, 25 Oct 2018 07:35:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Q2PKLjXxX8kaxSZ4FA1HnAeCzr0txPjAafxecawYj+c=; b=UmjOkkslcogVa3Mo9v7DImK5bryuo3Mr2mx0PLRXWdHplg9MoaSyKULBtfyOM5URvW CJzZlzzPYiLfv/v6fFoODGDhP4Pa6GgzVjfpYLOWbWetFTDlqkBcgffp9h3u6ILEY6ip s9L8Zh5N97oBCJATPSqDNl//YtXQKSI4YF2hdaxhRECL9ACMvcAjmDjvWtUli95LhshJ vsr5xe268Ar1hgyZOBZR0eOrQKBt0YI9kE8LBFtdPIz8J0C4j7b+GM3BRygiSLrhsVGa mfF92FjYX4cg/mCJnf7J5joK+N1anmx06SeTKS4IEwVUIMIFfB/xWs24968Gt9wlLr9i keUg== X-Gm-Message-State: AGRZ1gI3c5zyqBHif9nsX+iy9ZZhBIfvJ2EX+L7/5374aluKPT8CvS7d f8mQPXpPvKqtrdavF02NKq+7Xw== X-Google-Smtp-Source: AJdET5cCz1tVzLMtex3SU/6KozvSvpe8ginWTmH1HMUfOvvxDQWt3V17aLPx8jp2UBC+9kMVZIJswg== X-Received: by 2002:a50:f573:: with SMTP id w48-v6mr1795627edm.230.1540478140291; Thu, 25 Oct 2018 07:35:40 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id k51-v6sm124353edb.85.2018.10.25.07.35.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Oct 2018 07:35:39 -0700 (PDT) From: Daniel Vetter To: DRI Development Date: Thu, 25 Oct 2018 16:35:26 +0200 Message-Id: <20181025143527.8575-6-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181025143527.8575-1-daniel.vetter@ffwll.ch> References: <20181025143527.8575-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 5/6] mm, notifier: Catch sleeping/blocking for !blockable X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Intel Graphics Development Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP We need to make sure implementations don't cheat and don't have a possible schedule/blocking point deeply burried where review can't catch it. Signed-off-by: Daniel Vetter --- mm/mmu_notifier.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mm/mmu_notifier.c b/mm/mmu_notifier.c index 744840e5636e..4d56e2645b6c 100644 --- a/mm/mmu_notifier.c +++ b/mm/mmu_notifier.c @@ -185,7 +185,13 @@ int __mmu_notifier_invalidate_range_start(struct mm_struct *mm, id = srcu_read_lock(&srcu); hlist_for_each_entry_rcu(mn, &mm->mmu_notifier_mm->list, hlist) { if (mn->ops->invalidate_range_start) { - int _ret = mn->ops->invalidate_range_start(mn, mm, start, end, blockable); + int _ret; + + if (IS_ENABLED(CONFIG_DEBUG_ATOMIC_SLEEP) && !blockable) + preempt_disable(); + _ret = mn->ops->invalidate_range_start(mn, mm, start, end, blockable); + if (IS_ENABLED(CONFIG_DEBUG_ATOMIC_SLEEP) && !blockable) + preempt_enable(); if (_ret) { pr_info("%pS callback failed with %d in %sblockable context.\n", mn->ops->invalidate_range_start, _ret,