Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp685800imw; Fri, 8 Jul 2022 09:51:35 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u9Ex1kNBrNe5H/YUwkEU2617+JFPBoFfst6fQvd4sEEQxA3RA4jhosyQ6QWWvFjnOEP/9B X-Received: by 2002:a17:907:1dce:b0:72a:4dbf:82e2 with SMTP id og14-20020a1709071dce00b0072a4dbf82e2mr4494685ejc.30.1657299095172; Fri, 08 Jul 2022 09:51:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657299095; cv=none; d=google.com; s=arc-20160816; b=UwF7NNofiuCL1/rWiUpl6CkjozUoIosbo+zKFvvR88eg3xTFWPUX+eCOmqGmgU+ErU w+zfwItot6DT7a2IT9vdc0WTIpK7Rdn00NXYuqKerQVOgU7fvK5cokK26/pCImhQV9hs iUmdupliPWorGMEZars5B/P0v9xTSn3z5SzuyDoOfr6Bzf398eIZ/n28ch2aZxMsd6df +8XAtI1McZdlad+b1N8/WzP/2MPXeCL8qIQLvfJLYq9Hl82DNyLTJ6nDIr3DMHT8mYAk 4GZJ5X0wldSGnYIjRFiczf9xhum7eQJTHOulmHXxQ+r5yxsXCYdbFTxBn10WKILPqCCE d48A== 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=jL+f1joq8YvrpHlirkwlocAEqytxnYsGsQNMmbsBj+k=; b=l24Bm1LuixAmf+bHfx/X4sX3goPgarw4MpH8ijDK27dF9Szf9KV1v+XNBPqvcszKC0 xSX8IDy6Tww+G1yhAX1zH9dNpmIM9u+wpLNz3WiCshxkylAUDyD8HWa1qSPzCG4nVPRL roThK+MfT/8f4gTKVgPKpLM2RNiNqFCu/pVxw/LLnjGB9bCq6gC8C2Sjnz6tjQMMNtKA TGhNQKy2HvVArJOKsEw5KXLwt+p7xGwF+nCJHxgakq2ssUxaYopLEJCYPwAtfV499MKb +RKytly+uIriL69gk50FK7n2vrtfTJfxmefK1s+u+kJD1WwtdfCFribmt2bMXJMZO+H0 XdTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@invisiblethingslab.com header.s=fm2 header.b=bkpVHl53; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=vKTndTFz; 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 go20-20020a1709070d9400b007269e670e4asi4295533ejc.912.2022.07.08.09.51.08; Fri, 08 Jul 2022 09:51:35 -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=bkpVHl53; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=vKTndTFz; 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 S239163AbiGHQj0 (ORCPT + 99 others); Fri, 8 Jul 2022 12:39:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238504AbiGHQjY (ORCPT ); Fri, 8 Jul 2022 12:39:24 -0400 Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E9862250A; Fri, 8 Jul 2022 09:39:24 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id D4D0532009A4; Fri, 8 Jul 2022 12:39:22 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Fri, 08 Jul 2022 12:39:23 -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= 1657298362; x=1657384762; bh=jL+f1joq8YvrpHlirkwlocAEqytxnYsGsQN MmbsBj+k=; b=bkpVHl53b6JBmcsyJgTrDWib8he62qL7C+p5bEgemRrib5QUhn2 wpp+opvwGDksTCS5DUVqpjtWOjuBDCEbfUwfWhj7mVdOH6RAcgssxN0Fe5ZjJjaV YENGvqh/CV9AjykdnrGexhKaEfKXWLL11MRGYkGtRtcYMKlKYXywvicPXgvvlyO6 v5D9zvO0v/GMXLN65+F9Ge3H4T+vlDQCCAJkbd5k3b1LHim/UVfLp9J6Xnm2lcuD 4TBpLuEeLLvcxjShA2zitcrZRa24RNbVZFDXwo2uJVLiO2TjV1F9kgMaMOlFSGLb zyEdPOVsG3mcIombJvc9zA3KZbKdfH8AvxA== 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=1657298362; x=1657384762; bh=jL+f1joq8Yvrp HlirkwlocAEqytxnYsGsQNMmbsBj+k=; b=vKTndTFzZaxVI615asSUe9gpMDLgS +nHU0dIfe7pSOlYkTbY/jyN1iCYbEIf0PlPEzzOf0C2iEiUxwbhq0zRBRF3EOMyQ IWFkeBdr98gPxRkKA/I3BhShc5e9n5lDJImtif6Lc/9YQ0AcesTLt/+B0UxVGy7l taMR5r2kMaNFfBF7wNnNXxwKSkP/h3NZ57f7zHgUckakI2EgxhVt0Htgni6zE8VF ddAJN5qdEqSc/2NTKBo8xGGC4D4zEMnQEu+7EhdMeqDAaIJUBEW/2zYh6MkwaR3a YcIQKh05r/QoSvfANp5E5ubj55/NasCjHkZ3IbEKfMXt4+yHyeq4/rPjQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudeijedguddtgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeffvghm ihcuofgrrhhivgcuqfgsvghnohhurhcuoeguvghmihesihhnvhhishhisghlvghthhhinh hgshhlrggsrdgtohhmqeenucggtffrrghtthgvrhhnpeejffejgffgueegudevvdejkefg hefghffhffejteekleeufeffteffhfdtudehteenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpeguvghmihesihhnvhhishhisghlvghthhhinhhg shhlrggsrdgtohhm X-ME-Proxy: Feedback-ID: iac594737:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 8 Jul 2022 12:39:21 -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 5.18] Ignore failure to unmap INVALID_GRANT_HANDLE Date: Fri, 8 Jul 2022 12:37:50 -0400 Message-Id: <20220708163750.2005-7-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: d4a49d20cd7c ("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