Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp838201rwb; Tue, 4 Oct 2022 11:19:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM73oRwoaJeBaIj+kTGDyXzypJgBlQzPouzcbIfDVNBgM7FtL4gDXnX4Kxu2xVxAa59N5gxF X-Received: by 2002:a17:907:3f8c:b0:787:a14d:65a7 with SMTP id hr12-20020a1709073f8c00b00787a14d65a7mr20753822ejc.108.1664907560087; Tue, 04 Oct 2022 11:19:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664907560; cv=none; d=google.com; s=arc-20160816; b=NT4RdzdNc8bXIb6mycJLgmUjb9puMG90bIf7K7tJvWONXRpNM1D4RyZDjiWRaK2cFu IzQ8G2P4vRx+xu9dWp3/nig3Msxz2j7OljCe0XwhjRHG+zW8aYbSHpzbaE3bZYNkJmqy UJD55m3XeESpx9ggvC8TfnY6jb8aLLxkK0s8/PsnPNkfdXzJESU8a5rE0PIdnj1Agfh4 CYXSptiHz6UUK8dbf2mDzZjzpBFKkcP2szgk2RDjSoHhFy9x+gpyFZ8c1U/e76fvUnSG ZbRpqbiO/oVEfJE4eHwRE6tJGqAE67NvjGWYuXOnOvbmj4vzzpec5RbknvNk7RTfZtIK c3pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=11X6w7vEu0tjTIHKzhmOqBBDI/k81VfR7jkK8cS2SLs=; b=DH7eMiqZ9GyNXw09XlyC1ndyPtyyEtdDBqPOh3rmBFefq234QonR4wmeWvpCHqLhip VDp8vfrdFADhszDJak9DcGUf0k4ddGM3ECg1vCrroFHTf82MvJoK7jFTPP7RHB0qnt5L CBaKTbPDDaQCDoN+4cy9VsQ1jatBgmpW/Ld/TLXBrxvfNdnzHecyXrRt0ORrFbUHVn2F RVOTi6vZZBtUU1kX/gj8GB3SLxh9k3G7s1l0e4SNJtVCv4Hflxz4pXE4t6Hk9HaHqgSH 3F9TsgcG4m946uql6j1Da7XVV8F7kiOA6rwDqYy/d5Fb0ApI2j6BjpaHa7PAwXO4Oove tDlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tAixdHgr; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e25-20020aa7d7d9000000b00456ed5c909bsi10820949eds.590.2022.10.04.11.18.53; Tue, 04 Oct 2022 11:19:20 -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=@kernel.org header.s=k20201202 header.b=tAixdHgr; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229873AbiJDRdz (ORCPT + 99 others); Tue, 4 Oct 2022 13:33:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229806AbiJDRdw (ORCPT ); Tue, 4 Oct 2022 13:33:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9187262A9C; Tue, 4 Oct 2022 10:33:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1CD2B614F0; Tue, 4 Oct 2022 17:33:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFAA0C4347C; Tue, 4 Oct 2022 17:33:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664904827; bh=PwPs9MrC9Nnp8YuXE4YUV6t4bJoGLpNTpwSGttYa7Kk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tAixdHgrvrMRL7IegAz1OTU6UQXKZBnHxqZglxfcFTG3tW/ysYVojy0xhNtiVt2hG TgLKzPoef7vjF2ubyvUoPry8SNTQJp6iiz8jA/lwQKGvRMpHzPSzBZvknZeedb45AI ZBeYujjiZaIfaQVwP0hpr+JccVp7YYc4ilWnI/2S2E4aQDdXvwOb/a7bAUVuFY4Zmp Px+s4UxtFKdbHcakbg2lJrHk1VElDY6Vz17OKApGn61geIcpptg/oL4sadL1ymoP6D uuEOWDRi56Rq0udQDutmX9vjRdg6nd6tQFqAM34iAsDf8b5gWWUTMHoLrjqM+dnKAO AiDImc9UmloWQ== Date: Tue, 4 Oct 2022 11:33:44 -0600 From: Keith Busch To: Serge Semin Cc: Christoph Hellwig , Serge Semin , Jens Axboe , Jens Axboe , Sagi Grimberg , Alexey Malahov , Pavel Parkhomenko , Thomas Bogendoerfer , linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/3] nvme-hwmon: Return error on kzalloc failure Message-ID: References: <20220929224648.8997-1-Sergey.Semin@baikalelectronics.ru> <20220929224648.8997-2-Sergey.Semin@baikalelectronics.ru> <20220930095247.vqtdc53rr66uaiwv@mobilestation> <20221004145049.74ffhcp7wpxw4ufz@mobilestation> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221004145049.74ffhcp7wpxw4ufz@mobilestation> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 On Tue, Oct 04, 2022 at 05:50:49PM +0300, Serge Semin wrote: > > > > This particular condition for hwmon is not something that prevents us from > > making forward progress. > > If you consider the hwmon functionality as optional (AFAIU you are), > then just ignore the return value no matter the reason. That is not an option. This function does IO, and the controller may not be usable on the other side of that, which means initialization must abort. We can't just ignore errors; we just don't need to report errors that don't prevent forward progress. > If the problem > caused the hwmon initialization process to fail turns to be critical > it will be raised in some other place which is required for the NVME > driver to work properly. Otherwise the hwmon module initialization may > still cause the probe procedure to halt, which makes it not optional. > That's what I meant when was saying about "the function and its > caller semantics not implying that". > > > > > > > The > > > > driver can participate in memory reclaim, so failing on a low memory condition > > > > can make matters worse. > > > > > > Yes it can, so can many other places in the driver utilizing kmalloc > > > with just GFP_KERNEL flag passed including on the same path as the > > > nvme_hwmon_init() execution. Kmalloc will make sure the reclaim is > > > either finished or executed in background anyway in all cases. > > > > This path is in the first initialization before we've set up a namespace that > > can be used as a reclaim destination. > > > > > Don't > > > really see why memory allocation failure is less worse in this case > > > than in many others in the same driver especially seeing as I said > > > > The other initialization kmalloc's are required to make forward progress toward > > setting up a namespace. This one is not required. > > Anyway what you say seems still contradicting. First you said that the > hwmon functionality was optional, but the only error being ignored was > the no-memory one which was very rare and turned to be not ignored in > the most of the other places. > Second you got to accept the second > patch of the series, which introduced a one more kmalloc followed > right after the first one in the same function nvme_hwmon_init(). My comments on this patch were intended to be applied to all similiarly added uses.