Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp27802151rwd; Tue, 4 Jul 2023 08:04:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlEsySkm4XBoZGYH6M9i5tEOxyu4gDf1d6bI4MPsBFNTvQ5EFC7VToO8WDr9GH3UsYtVVJ7m X-Received: by 2002:a0d:e2c2:0:b0:577:60d4:a879 with SMTP id l185-20020a0de2c2000000b0057760d4a879mr11536031ywe.33.1688483071909; Tue, 04 Jul 2023 08:04:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688483071; cv=none; d=google.com; s=arc-20160816; b=QmISkZZjHBkgRVu6t1vvsMBJELjASBA8aZhQC4tC28HkOz4AGNqB8ymlckj5Vwy5GT O/Xd9o2tKp0tOPV5gfMBAj0CdwWcUq+il5QxK/LWdAZGb4nfI0fnvAYpb7f6DsNo9WXM NtUa8Y8KoK0xTw1jNEurZ9Xm1lo3Ot+YDGoRQtlmNxxHKImAjijoUhtNYKkUjYIFTEm/ iuC9F2ga6C6mCvbPkExeEhseT79wvWLzzxB35705VRvyaiHg8dzPFLaFXfc5ysao0X3+ bgx9aEX6ZdcqnZsTDu2PENqOA7S8kSgG2jnlGjqfmQGZhU8Zk1pLFu3gEXMNeTdPyuOy XEFQ== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature:dkim-signature; bh=1Jacfn/7Hr8ZOCMTak1z7qptVuLSxy2D+yd/NGiugyc=; fh=qBRsGWTfP1dT7xGjN6s+l4PguGFhwrvqFqqF9Y8TA7k=; b=Qce5zjuqqe+UKgX0ug2LWbzBkLpO4GnaM/Yd7rw1ouukslx++P7oPwqBZRvmWnMnOr rC4vdshfupjLGMruhQcouaklezK77MFche4deRUtnt2YE+8m5IzjVfPlyVszFLMH2bmm g3s+zRa0mk/RrCA78wlFZPVZKDif0Rviri3r2wxxmueT31zoQnK9yIg2Gr2y1//c7elo M/ioj62U50biRTYAaSLUafg1fHRtnRDaU65RxPQkVf5ZIfPgfOAImTNVZsgaPbQPMmHb C5kpSIkHDlH+50qseZPYpTgcw7jHrSnXGSrsfFB3vNBQhyppURuMLTKHbEr4oQRduBWu kBnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=dP4kzefg; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=1t3YyoDd; 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=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z20-20020a81c214000000b005771f9b1014si6935795ywc.199.2023.07.04.08.04.17; Tue, 04 Jul 2023 08:04:31 -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=@suse.de header.s=susede2_rsa header.b=dP4kzefg; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=1t3YyoDd; 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=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231367AbjGDOfu (ORCPT + 99 others); Tue, 4 Jul 2023 10:35:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230200AbjGDOft (ORCPT ); Tue, 4 Jul 2023 10:35:49 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D69DE47; Tue, 4 Jul 2023 07:35:48 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E50C522432; Tue, 4 Jul 2023 14:35:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1688481346; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1Jacfn/7Hr8ZOCMTak1z7qptVuLSxy2D+yd/NGiugyc=; b=dP4kzefg/ivdfntqveAu8p6SD7A7DK+2LqnFdcDWXKixHadmsQUUW/MDy2E3ysVzMuf7Hm oIWK1L4NbqXiPiQOp+uRx62ulzg4dvpzS182qClGjW2dsX53xcVickxbgIIqHL3N1GmIIA 0ePI+GR0dwxP/N1j2jYk2+Vc43D3pJ0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1688481346; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1Jacfn/7Hr8ZOCMTak1z7qptVuLSxy2D+yd/NGiugyc=; b=1t3YyoDdcql+sm1bmn3mFloQuC/6pAqKxQKD0y6vlQCGyUwIWq4e+TxkbKxJfsraHaDM8m 7fiNVNurCajAHfCg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B012E1346D; Tue, 4 Jul 2023 14:35:46 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id JN6lKEIupGQOfwAAMHmgww (envelope-from ); Tue, 04 Jul 2023 14:35:46 +0000 Date: Tue, 4 Jul 2023 16:35:44 +0200 From: Jean Delvare To: Michal Hocko Cc: Luis Chamberlain , linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] module: print module name on refcount error Message-ID: <20230704163544.660621f3@endymion.delvare> In-Reply-To: References: <20230626123252.73dbc139@endymion.delvare> <20230704144312.032b4ddd@endymion.delvare> Organization: SUSE Linux X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.34; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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, 4 Jul 2023 15:05:33 +0200, Michal Hocko wrote: > On Tue 04-07-23 14:43:12, Jean Delvare wrote: > > On Wed, 28 Jun 2023 12:30:35 +0200, Michal Hocko wrote: > > > Would it make sense to also print the refcnt here? In our internal bug > > > report it has turned out that this was an overflow (put missing) rather > > > than an underflow (too many put calls). Seeing the value could give a > > > clue about that. We had to configure panic_on_warn to capture a dump to > > > learn more which is rather impractical. > > > > Well, other calls to module_put() or try_module_get() could happen in > > parallel, so at the time we print refcnt, its value could be different > > from the one which triggered the WARN. > > Racess with module_put should be impossible because all of them should > fail, right? Most probably yes, but after taking a deeper look at the code, I wouldn't swear. For example delete_module() will decrement refcnt and increment it again if the module can't actually be removed. This could get refcnt to positive again briefly, at which point another module_put() could succeed. > Races with put are possible but we do not need an exact > value to tell the difference between over and underflow, no? Indeed not. But my other points still stand. Plus, if you really want to know the refcnt value, it's already visible in /sys/module/*/refcnt and lsmod. -- Jean Delvare SUSE L3 Support