From patchwork Mon Dec 10 10:36:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10721067 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 C4847112E for ; Mon, 10 Dec 2018 10:36:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B077529B1A for ; Mon, 10 Dec 2018 10:36:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A23C829BC2; Mon, 10 Dec 2018 10:36:56 +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=unavailable 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 4D62429BC1 for ; Mon, 10 Dec 2018 10:36:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8EFF26E987; Mon, 10 Dec 2018 10:36:54 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id B614B6E981 for ; Mon, 10 Dec 2018 10:36:50 +0000 (UTC) Received: by mail-ed1-x543.google.com with SMTP id z28so9014585edi.8 for ; Mon, 10 Dec 2018 02:36:50 -0800 (PST) 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=YV7Au+Xoi18K0aIfE4y7asb18jxEh8D3vpzvdu6CgE4=; b=BF8wHdX2EO956QpyNBNj7OK8BbLeyTHH2O6HM9ct8XsrWK+fG+xXgwJn9MCsfMHROY P/eCeYLfUa+97BSHyDZl12LopNPUDtYPixfsrz9vFYc9ivDIakYGXVZm2elJCTA+PebF UCOLvCuldOXusG2eUp+YZW/aKSGtPjI+4rnSa6E/08tPVDbsGGubuME0sQnhIxzHXpyd ETzXIs+kiZFPKoJbOcaSJsEsKnDMwpDhqiPqRksoOOwJjiOyKXr8nX2Mj5EA54a/sj1A HbN3h+5FHiaLyQZ+t6C8nvadeGbeBptKBSr9iabhvZg89SmYUsW5r/PcgqijGJIp0IlK cJfQ== X-Gm-Message-State: AA+aEWY2NotccSoFKduY0z6isjpetArMxffe2MGkTPz/CqTn3/xyw+/F 0QJV6NG9OVVADY71RqO0QO/BFg== X-Google-Smtp-Source: AFSGD/WTiRBF+bnXbP47+tF0zKNIaU09U2WUgwi3pvFZef2cryiPBMTWKH+CBkawc01/ebuF3XXHbg== X-Received: by 2002:a50:cf41:: with SMTP id d1mr11169344edk.242.1544438209386; Mon, 10 Dec 2018 02:36:49 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id q50sm3223862edd.66.2018.12.10.02.36.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Dec 2018 02:36:48 -0800 (PST) From: Daniel Vetter To: Intel Graphics Development Subject: [PATCH 1/4] mm: Check if mmu notifier callbacks are allowed to fail Date: Mon, 10 Dec 2018 11:36:38 +0100 Message-Id: <20181210103641.31259-2-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.0.rc1 In-Reply-To: <20181210103641.31259-1-daniel.vetter@ffwll.ch> References: <20181210103641.31259-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michal Hocko , Daniel Vetter , Daniel Vetter , LKML , DRI Development , linux-mm@kvack.org, =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , David Rientjes , Paolo Bonzini , Andrew Morton , =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Just a bit of paranoia, since if we start pushing this deep into callchains it's hard to spot all places where an mmu notifier implementation might fail when it's not allowed to. Inspired by some confusion we had discussing i915 mmu notifiers and whether we could use the newly-introduced return value to handle some corner cases. Until we realized that these are only for when a task has been killed by the oom reaper. An alternative approach would be to split the callback into two versions, one with the int return value, and the other with void return value like in older kernels. But that's a lot more churn for fairly little gain I think. Summary from the m-l discussion on why we want something at warning level: This allows automated tooling in CI to catch bugs without humans having to look at everything. If we just upgrade the existing pr_info to a pr_warn, then we'll have false positives. And as-is, no one will ever spot the problem since it's lost in the massive amounts of overall dmesg noise. v2: Drop the full WARN_ON backtrace in favour of just a pr_warn for the problematic case (Michal Hocko). Cc: Andrew Morton Cc: Michal Hocko Cc: "Christian König" Cc: David Rientjes Cc: Daniel Vetter Cc: "Jérôme Glisse" Cc: linux-mm@kvack.org Cc: Paolo Bonzini Signed-off-by: Daniel Vetter --- mm/mmu_notifier.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/mmu_notifier.c b/mm/mmu_notifier.c index 5119ff846769..ccc22f21b735 100644 --- a/mm/mmu_notifier.c +++ b/mm/mmu_notifier.c @@ -190,6 +190,9 @@ int __mmu_notifier_invalidate_range_start(struct mm_struct *mm, pr_info("%pS callback failed with %d in %sblockable context.\n", mn->ops->invalidate_range_start, _ret, !blockable ? "non-" : ""); + if (blockable) + pr_warn("%pS callback failure not allowed\n", + mn->ops->invalidate_range_start); ret = _ret; } }