Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp19005336rwd; Wed, 28 Jun 2023 03:52:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4UhrrI0NAnjnloZpca9/4wLKOVG9heiuYmoDVWI7Js2+0V7jPt+Z9qgcEVjMpGva7yVp58 X-Received: by 2002:a17:907:a06f:b0:98f:5640:16a with SMTP id ia15-20020a170907a06f00b0098f5640016amr7717257ejc.53.1687949565089; Wed, 28 Jun 2023 03:52:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687949565; cv=none; d=google.com; s=arc-20160816; b=qrpeFF2nzG5F1XaanNEPTEDBfmmO939dfJ41TZYKAo4xG4XeMqrWUCKoqv0e+DWBfC w3+tRqrr1fF7TXmI7yITDSjuass3CJ8wdc7olrQX1eROPdBMFJDSRhnCoMJ4mTCsIFVS wOG5Q4xSyv4d9vPv1btt3mcgJxrqGW95QbrZS9UnzejQHPVXuoCIrFEOuFXxQw6qYMPL dN8eLwfbT2ME6NLCfzaCQWPahlCx3H2eXFdLplQ44iYmFychXvDjxDsSj4F+2V+GFUmo xgN2A4JFX9+IVbzQ59TAjMFNai16TG0gqQ5qXqto8MRQIkdvkAVZkmV9/NT+XYI+eE75 6rmQ== 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=BCksnSvqb2exthjt44ZVB4l+uDUSHQhOWcwxYNPNILY=; fh=4QV6Z+oABtayt45fuMQHrr+29fYg9Y9YgA2gIkEaK9I=; b=gqYoYCcxWr0vcVINV9QBYYofaoz4y7Q2At3Gz3HdoHFyilh1GQh4vxd5gOFMkwQ8+2 lpQfVYlcSavmVEZzD9+xzk6dBnlOLPRlZ1Ou3yq/tZhzI3NnYPe7lmDh2VdLBGG7/eWR RbSwKNrDPwhbCLkS3UKh50Rg94n5XEibg0HpM/B4r5P+pMQVVd278uvTcWtXJpGI3uIR ruPFWPBKTjkNSwMG0/TGl/YWF0xdED+UDMt4QehK3G3E3stkogGmqWksm0xvcU/eCoLy LGJAd9lZDPYzoRbHBh1h+U1D5wo9IIzWjXyt3Xq5T6t6todfyZ9KjebbhERRvBr+21Ja KiWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="pTbjx/jy"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i26-20020a1709063c5a00b00991d54db2a6si3535775ejg.693.2023.06.28.03.52.20; Wed, 28 Jun 2023 03:52:45 -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.com header.s=susede1 header.b="pTbjx/jy"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230428AbjF1Kcn (ORCPT + 99 others); Wed, 28 Jun 2023 06:32:43 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:52492 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230460AbjF1Kai (ORCPT ); Wed, 28 Jun 2023 06:30:38 -0400 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 A66FC2185C; Wed, 28 Jun 2023 10:30:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1687948236; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BCksnSvqb2exthjt44ZVB4l+uDUSHQhOWcwxYNPNILY=; b=pTbjx/jyqTYF1XnZiTMK5kPMPvzBbEre9iW+GEsBQVUUqHIonNXz8J4gb9LrMTwNqVYE5o RRABQZnUmPwsAQ8ui0ra57SCtFDCGi7m4EjyG5eOsqPkVFNtVyzV7IqTDScc5HllsS1P9d VLMgePQSmjqZ5JnwNVCbxP/tU6Tmzcc= 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 877EB138EF; Wed, 28 Jun 2023 10:30:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 9FbPHswLnGTwGwAAMHmgww (envelope-from ); Wed, 28 Jun 2023 10:30:36 +0000 Date: Wed, 28 Jun 2023 12:30:35 +0200 From: Michal Hocko To: Jean Delvare 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: References: <20230626123252.73dbc139@endymion.delvare> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230626123252.73dbc139@endymion.delvare> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 26-06-23 12:32:52, Jean Delvare wrote: > If module_put() triggers a refcount error, include the culprit > module name in the warning message, to easy further investigation of > the issue. > > Signed-off-by: Jean Delvare > Suggested-by: Michal Hocko > Cc: Luis Chamberlain > --- > kernel/module/main.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > --- linux-6.3.orig/kernel/module/main.c > +++ linux-6.3/kernel/module/main.c > @@ -850,7 +850,9 @@ void module_put(struct module *module) > if (module) { > preempt_disable(); > ret = atomic_dec_if_positive(&module->refcnt); > - WARN_ON(ret < 0); /* Failed to put refcount */ > + WARN(ret < 0, > + KERN_WARNING "Failed to put refcount for module %s\n", > + module->name); 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. Other than that the module information on its own is an improvement because one knows where to start looking or to reduce the tracing data collected. In any case Acked-by: Michal Hocko Thanks! > trace_module_put(module, _RET_IP_); > preempt_enable(); > } > > > -- > Jean Delvare > SUSE L3 Support -- Michal Hocko SUSE Labs