Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp703044imw; Fri, 8 Jul 2022 10:08:26 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vn+t3fD0hFZYfHvEu9eObKQfa6IKPq6B04C+ix+BwIr8AXpzw+qymZsCALR4smSw27yeAK X-Received: by 2002:a17:90b:388b:b0:1ed:406:492c with SMTP id mu11-20020a17090b388b00b001ed0406492cmr920936pjb.31.1657300105487; Fri, 08 Jul 2022 10:08:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657300105; cv=none; d=google.com; s=arc-20160816; b=Dfg9CWJ20QkO7XDVhCmbfIGJTZfF9eiLXqM9j9rF6qloWzRuKbLo6CRTuC2WstY9vI +YDIL/qYSdpnftAfebpkSe5hakFLp5yxIsrt9tBfAPeFXccULKmzOAAl4CRhvV4KlfaZ OK8k1Rup3Tv3zGK+NbZhFfQadYs0/CYei+ckR7tD9pUuIKgGhAePtboEg8yfCh7WZxF2 2qpk+uzNIvlGHG5RmSZgrNMnL5Nb+2tDTYayzyLtzJGwUb5ioGZNbeMPcfrtvwOwefNB iIXkHD8429tRb8E8hsQapFlMO7AaClcy1jiRYfB/BRhGxdXJwV9bZS0IJ5gxS6WrqXOJ SlHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=Y+RlhIU6vcdXRbbN1vVgH9bjMqskW29Y/EffMgEqJZQ=; b=qdKAEiildFTcQGv5S4Dv+0ydw7DgkbrAocrtOwlaYOTr0aRCPXdinqu+1N6p+zXvz4 XkzqOz/LEJuK7KJcySBiR1QURPuKx1zvX2wnexvb5UvvT+atliegApD0GkQekthqj+5o VXOxG5w0/X3/PxEAtQzOFYfH/OvKVD7Yy7HewjrqbsbtP1rLodoCy/3KS0D6MsILy5N/ g06OW5zfVTvAtwQc+htW/cSZwCvUURVk7oQe/1sA6CiZyDIRWAh0wVnMvnvfD3SuRM++ b0eDm5tmlcA2YHenGnWQ3h/gaJSuPjQUoCOStPpx8CxlGyD3VzDUruSDL02f9SS3wb9a JF7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@invisiblethingslab.com header.s=fm2 header.b="i0/UL2zj"; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=UsExiFmm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q4-20020a632a04000000b00411955bceb6si37066028pgq.578.2022.07.08.10.08.02; Fri, 08 Jul 2022 10:08:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@invisiblethingslab.com header.s=fm2 header.b="i0/UL2zj"; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=UsExiFmm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239176AbiGHQja (ORCPT + 99 others); Fri, 8 Jul 2022 12:39:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238504AbiGHQj2 (ORCPT ); Fri, 8 Jul 2022 12:39:28 -0400 Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8365237C3; Fri, 8 Jul 2022 09:39:27 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 795D63200991; Fri, 8 Jul 2022 12:39:26 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 08 Jul 2022 12:39:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= invisiblethingslab.com; h=cc:cc:content-transfer-encoding:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm2; t= 1657298365; x=1657384765; bh=Y+RlhIU6vcdXRbbN1vVgH9bjMqskW29Y/Ef fMgEqJZQ=; b=i0/UL2zjjaZXX/VULC54735TU47noiExIU73NHexI5Bxj2aiX0F PjAdIyLfS5znmLt3U1EGUiwZEdG1A6flSJXWRrMUCa2tkjwlI543rATLXmAUNsrI pH1Ds2+O0W8FbSA6Ij/JSpjmzJpcmHLj6/RmOg5Zgxu5ZnTNQnV3lR/tZLItROmH hX8FIXzq+o4uo6H2xTZZVCwwxd8EORCvTEpkmvlOVd/bobdCWkSFCI/1n5+f0gj9 GoJZ38iv25vQfBxx2Xw5rF1QdSwCXAeJwqDRnTJ/XBIXgn7G6ML8PfwdiFCgh/iO zAqAfbSgIdZfPeN2BoYmok605G8ljA7/7Cw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1657298365; x=1657384765; bh=Y+RlhIU6vcdXR bbN1vVgH9bjMqskW29Y/EffMgEqJZQ=; b=UsExiFmmlq5Bhu1AZQbdi1EhWgfBR raj6TZCIoz3BqdlBkU8FnClfQyAswdg2uPwh4SwBA0lS9QJCb4WIv/6SD3oLYTK5 cIWCyhVU/KmdjWMxaoYU3tZc0Bg1cKnF8z1kibyqnUDvtD5vzZciVrMrt2bm1XYv odBZRxmKeM0axP7J85s/7c6WM9wzminmaU1SaR/EH6HbBpjDkcZsH3dKEysBWiOZ nrvkWxJcuolGzP3jOtgCDoM+ZIKZ/oiiK0EH1TKmgY/YhsqAcpjxL5YWVTG287s8 syxYcvHp1BGRpe94zwHU6e8Yp+kq/djehOfu/DDXH8rvT7jz2WXpofDhw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudeijedguddtfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeffvghm ihcuofgrrhhivgcuqfgsvghnohhurhcuoeguvghmihesihhnvhhishhisghlvghthhhinh hgshhlrggsrdgtohhmqeenucggtffrrghtthgvrhhnpeejffejgffgueegudevvdejkefg hefghffhffejteekleeufeffteffhfdtudehteenucevlhhushhtvghrufhiiigvpedune curfgrrhgrmhepmhgrihhlfhhrohhmpeguvghmihesihhnvhhishhisghlvghthhhinhhg shhlrggsrdgtohhm X-ME-Proxy: Feedback-ID: iac594737:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 8 Jul 2022 12:39:25 -0400 (EDT) From: Demi Marie Obenour To: Juergen Gross , Greg KH , Stefano Stabellini , Oleksandr Tyshchenko , Demi Marie Obenour Cc: Linux kernel regressions , stable@vger.kernel.org, Linux kernel mailing list , Xen developer discussion Subject: [PATCH master] Ignore failure to unmap INVALID_GRANT_HANDLE Date: Fri, 8 Jul 2022 12:37:51 -0400 Message-Id: <20220708163750.2005-8-demi@invisiblethingslab.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220708163750.2005-1-demi@invisiblethingslab.com> References: <20220708163750.2005-1-demi@invisiblethingslab.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The error paths of gntdev_mmap() can call unmap_grant_pages() even though not all of the pages have been successfully mapped. This will trigger the WARN_ON()s in __unmap_grant_pages_done(). The number of warnings can be very large; I have observed thousands of lines of warnings in the systemd journal. Avoid this problem by only warning on unmapping failure if the handle being unmapped is not INVALID_GRANT_HANDLE. The handle field of any page that was not successfully mapped will be INVALID_GRANT_HANDLE, so this catches all cases where unmapping can legitimately fail. Suggested-by: Juergen Gross Cc: stable@vger.kernel.org Signed-off-by: Demi Marie Obenour Fixes: dbe97cff7dd9 ("xen/gntdev: Avoid blocking in unmap_grant_pages()") --- drivers/xen/gntdev.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c index 4b56c39f766d4da68570d08d963f6ef40c8d9c37..22fcd503f4a4487d0aed147c94f432683dad8c73 100644 --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c @@ -396,13 +396,17 @@ static void __unmap_grant_pages_done(int result, unsigned int offset = data->unmap_ops - map->unmap_ops; for (i = 0; i < data->count; i++) { - WARN_ON(map->unmap_ops[offset+i].status); + WARN_ON(map->unmap_ops[offset+i].status && + map->unmap_ops[offset+i].handle != + INVALID_GRANT_HANDLE); pr_debug("unmap handle=%d st=%d\n", map->unmap_ops[offset+i].handle, map->unmap_ops[offset+i].status); map->unmap_ops[offset+i].handle = INVALID_GRANT_HANDLE; if (use_ptemod) { - WARN_ON(map->kunmap_ops[offset+i].status); + WARN_ON(map->kunmap_ops[offset+i].status && + map->kunmap_ops[offset+i].handle != + INVALID_GRANT_HANDLE); pr_debug("kunmap handle=%u st=%d\n", map->kunmap_ops[offset+i].handle, map->kunmap_ops[offset+i].status); -- Sincerely, Demi Marie Obenour (she/her/hers) Invisible Things Lab