Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp729453rwb; Fri, 7 Oct 2022 03:28:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Yi4qgI/Iq9LUN7MDXMdERHbmvOZpxjVXQJChIYSYf+iB3lW1eKIR3N6+Tewb7EScPNUkh X-Received: by 2002:a17:907:3f27:b0:78a:feb2:7f56 with SMTP id hq39-20020a1709073f2700b0078afeb27f56mr3508461ejc.295.1665138514497; Fri, 07 Oct 2022 03:28:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665138514; cv=none; d=google.com; s=arc-20160816; b=D5O27xGN0Mc7FAy/WpyYtGThHPldLqK9cxCkhXeY+1crXA+vmRMBXjXEMMrVcJu80Y nkskaltXW/cABD+nlF5IFi+gBUN+I0lVv8hkyghSohfI6K+yaaiTbzTUE7xvzv0YkWE3 aFVq/PV6KrTgt9R6rh8NO+QVdUc9gG23wRDS3Tu8z3tJahYvFeZIBBi0vlv2ady+PNNb IrCqyqqpN1K6vTIksYA52MCaj3AiLFhVjmonkWFLzEWsp/vfK2DUjXxxNb9C+qwmsFiW ef5MqSjjU0BAvRd5uQd/bbAyVSpg3gPHFLXSv9PVbtAZkMKGoXz5eICEw4mM4LP0qGFe uPtw== 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=0DfhB8jvaZ+NX5O/W6U8PGiRnsQleUaLd7heHBLzUhM=; b=Os3LfKAmyKSLZGKpDTF3k/PHW98s07PnfZBEjEW4sN3jbsH+4DOjazZ7x0dvrXP9GK 4NKeTLId2uYLzmZzhntxLN3vQisTewswjxuMeR4J7S0kNgShQcN4YJ/XptYYSHwqrlXs d6FXfWvXldK3+ct64E8JS59qZUqRb5A/q4yX7hafYTkCrQw1ar6i5KNaSHvNXkAuRluO ZVeUd7N+isPa6xjufeyCRgcTfHOdCG6pfJjXOPSDDmVsFoUCbzkTJgnYoiFB2X6yru6l h28Ii2i/R/ARaXL8dTKsmLH14gu8vzWeZ+RQ2YlJVC/smf1fnfu9vAeI4LjFLtfszNYv hHDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=B2Hr7KIY; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a25-20020aa7cf19000000b00457dbe73825si1517321edy.386.2022.10.07.03.28.09; Fri, 07 Oct 2022 03:28:34 -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=@gmail.com header.s=20210112 header.b=B2Hr7KIY; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229479AbiJGKBm (ORCPT + 99 others); Fri, 7 Oct 2022 06:01:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229563AbiJGKBk (ORCPT ); Fri, 7 Oct 2022 06:01:40 -0400 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D19ACA8794; Fri, 7 Oct 2022 03:01:38 -0700 (PDT) Received: by mail-lj1-x22b.google.com with SMTP id a10so5179919ljq.0; Fri, 07 Oct 2022 03:01:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=0DfhB8jvaZ+NX5O/W6U8PGiRnsQleUaLd7heHBLzUhM=; b=B2Hr7KIYLqdlgqBWIF1ylrBnKIo+/FHDGnjhpVzD/cDbwWuGodJu4KPh9dgmn8SQje cSWbK8apPRkKJngwKUOj57nvX0niu7SaBe2+S2UkTZgv7aHiIUVLWRBWf1Xao4CZMUJ1 l90GwXLAT71HdT3sD+Q0ecH2xGGMH6O5/0GCHqLU4DiGh+FTAr95k6pbgFjgYdgVq1VU aENrX2Qgojj+t4h1WTdqqempffi8neDZvZiYehbzTJBWiriSSLOavgwwdIIHwYwGqIqC B5mwyxVzT6BT9WE+RcHxURFL3+dGO1Hlm+vhislFn8LaqdQumNJO+W9fjJfW0X/ZTu36 m05Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=0DfhB8jvaZ+NX5O/W6U8PGiRnsQleUaLd7heHBLzUhM=; b=CEQtpG6Kr9CSaLzFXPolRPsZD48S2QQPjmtWbE39q00nC2cvYRx15XX/Ws07sdLEFC mLhZ5VJbLlULJW5i8sqbyHgI0vAqtTUttO5Sp4cIPNLIo1Pn5WhhphEPlZdDv5qE0Exi 0p9US0UK50D2lKsM/H88ZcQoMrFwaP/9hi9S/1DPppS+tSSxP7BYDBOC9oce6WdRD2u5 DgYpBtXn0nyxFi+4s7E0bIB521FJqPu+rfRGd145qDrGTmfDlUVFDZUced8LgGy4UUK0 RXQ1/az8JyT6ipfLLVsHLBQ54utjLeg0AXymj6q1qXVad/BrhS+PIRXbfOdzxYrd9f7E gZgg== X-Gm-Message-State: ACrzQf06AtDrVBBlP2BryP7l3LTyRikLyN6/3vhkhBPiT8fJjTrvFn6G uli+kQpddm6zldgHyba9Tjg= X-Received: by 2002:a2e:7804:0:b0:26c:463c:493c with SMTP id t4-20020a2e7804000000b0026c463c493cmr1417457ljc.521.1665136896974; Fri, 07 Oct 2022 03:01:36 -0700 (PDT) Received: from mobilestation ([95.79.133.202]) by smtp.gmail.com with ESMTPSA id p18-20020a19f012000000b00499bf7605afsm235115lfc.143.2022.10.07.03.01.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Oct 2022 03:01:36 -0700 (PDT) Date: Fri, 7 Oct 2022 13:01:34 +0300 From: Serge Semin To: Keith Busch , Christoph Hellwig Cc: 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: <20221007100134.faaekmuqyd5vy34m@mobilestation> 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: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 11:33:44AM -0600, Keith Busch wrote: > 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. How could I've possibly got that from your "The rest looks good, though." and nacking only this patch with the message "The hwmon is not necessary for the rest of the driver..." ? Anyway due to all these uncertainties it's better to have a second opinion on the patches before re-spining the series. @Christoph, since you've already started reviewing the pathchset could you have a look at the patches #1 and #2 of the series? Please note the @Keith' comments regarding the memory allocation failure handling in there. -Sergey