Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1356430ybl; Wed, 14 Aug 2019 15:35:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqwftAPoMnHgl5Ibok+ohdYGCdIAOppd4jgEcxPAPUpdne1xkcxGChx5gCIyFsQ3ahpgJk+R X-Received: by 2002:a63:ec13:: with SMTP id j19mr1110215pgh.369.1565822154620; Wed, 14 Aug 2019 15:35:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565822154; cv=none; d=google.com; s=arc-20160816; b=GnzfU98FpNeOVpo0b8cwFxoQCohJvVk1HrDXUzh5f0AZMvhuQ3ekUBepdTM7RAQDfd L2/rHC5IV2ZyCvG6AgE7m1+7OJmO27YsZ2TzHnPqLasRuBcHLbk1CWsVGXuuFU1y5S4h ihfAwn+0sjpp02U8/x12jRiAGmZxzZBrK+I2JneYKaTGlbAtap9jwxKNwF2c0X6p7RAE fETXqYW3pczL20N2D2iezHkoaLz+cpEbYX1g01PsblMigKBpzpycmUpIbxMuX0uiU43M 7l2xoj35ShY0vLc/LNR6w6fdp0i8sfMhURkGSIU2dfNL6BnlTvaGye9XPjc3oaWIDLtL V0uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=oVVltBXmJgcZd+iX4FFvEcm/MddOM/wVcmT/EIxDeDQ=; b=opuVmjJN0qnF3TQYOU/7ruyroOVr6b0M0ddWJknSPG+NKhZIU4AfCkwS0LQfdNzvA3 yRo1G1pK/U34MLb0UoZqon2+Q0Rp/vBLOl4UWrjsfI+UYrdlvUygeA9NjZyZTcTsONLA Tv7n+JEs+H5WY7ciDkJvTs+vw0zDurcEHf/zQpAx3G5qdBek3uhtn0eCCXtHrT4s8Emm F4J8ZeMS4cJi0WpQJENB8WV/7zdsTxX+anZMAOOdsUVapsuaxeMI5zo+cZfjWQ+LKYdD keFE9lurN7EwNuHDqdmO0Nf8iOCOxLJqRo3FuzB5/sx5Zb0/PUzwv4QTlAKFkI2Q181Z VbVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kgdL+2Si; 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 1si624403pgu.504.2019.08.14.15.35.38; Wed, 14 Aug 2019 15:35:54 -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=@kernel.org header.s=default header.b=kgdL+2Si; 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 S1729937AbfHNWOt (ORCPT + 99 others); Wed, 14 Aug 2019 18:14:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:59140 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727937AbfHNWOt (ORCPT ); Wed, 14 Aug 2019 18:14:49 -0400 Received: from localhost.localdomain (c-73-223-200-170.hsd1.ca.comcast.net [73.223.200.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 97C652064A; Wed, 14 Aug 2019 22:14:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565820888; bh=UI7guIwUhxj2d7avxjaE7hMxiiSK2A0bwoAKP8qw2sk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=kgdL+2SiVRNwSW1JH17ZCHCofzHSIpTR4YWsnpsl1DebWSKDpe5dUCISgu8Up/S+V wgHLmG+J9tdZ0hOfZk+W2Gz3gtDTZ1kwYLUSkUSYDNbrgubOrLmnymmaQQqM86LjYb 4pgir0WNhhiFRt0JrlAp8mqwek9vmFjP5iLFjw8w= Date: Wed, 14 Aug 2019 15:14:47 -0700 From: Andrew Morton To: Daniel Vetter Cc: LKML , linux-mm@kvack.org, DRI Development , Intel Graphics Development , Michal Hocko , Christian =?ISO-8859-1?Q?K=F6nig?= , David Rientjes , =?ISO-8859-1?Q?J=E9r=F4me?= Glisse , Paolo Bonzini , Jason Gunthorpe , Daniel Vetter Subject: Re: [PATCH 1/5] mm: Check if mmu notifier callbacks are allowed to fail Message-Id: <20190814151447.e9ab74f4c7ed4297e39321d1@linux-foundation.org> In-Reply-To: <20190814202027.18735-2-daniel.vetter@ffwll.ch> References: <20190814202027.18735-1-daniel.vetter@ffwll.ch> <20190814202027.18735-2-daniel.vetter@ffwll.ch> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 14 Aug 2019 22:20:23 +0200 Daniel Vetter wrote: > 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. > > ... > > --- a/mm/mmu_notifier.c > +++ b/mm/mmu_notifier.c > @@ -179,6 +179,8 @@ int __mmu_notifier_invalidate_range_start(struct mmu_notifier_range *range) > pr_info("%pS callback failed with %d in %sblockable context.\n", > mn->ops->invalidate_range_start, _ret, > !mmu_notifier_range_blockable(range) ? "non-" : ""); > + WARN_ON(mmu_notifier_range_blockable(range) || > + ret != -EAGAIN); > ret = _ret; > } > } A problem with WARN_ON(a || b) is that if it triggers, we don't know whether it was because of a or because of b. Or both. So I'd suggest WARN_ON(a); WARN_ON(b);