Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp719599ybx; Wed, 6 Nov 2019 07:26:06 -0800 (PST) X-Google-Smtp-Source: APXvYqxocy4CXsFyDmw5rwet0ev10u9ueGuRX2lnBhhZGU3U7R53xfILB7DYZZTTlBP5Hw/Ln2MW X-Received: by 2002:a17:906:4bcb:: with SMTP id x11mr35900427ejv.9.1573053966561; Wed, 06 Nov 2019 07:26:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573053966; cv=none; d=google.com; s=arc-20160816; b=eapMFoZf0OlX1tQ2EyXBbS6CX5gapH9Wrj8PC0AZ0bhPKbmQDedP2gj1t5RJHBb/sC d+lkxdjlQ8TdLP5dx1i3QdvsRr1TS4VuX8qQxWTI0n/cptfL96Nh81j4amCy3IkiZO3v seS3eQ4l02OjCIVjLiN2uALm2tqYOoAK5K5MtU6HcoeKR0dRKOWeMVxRg63zkK9Sgl3A m5Q9MCFCd5gwGNipdaupMrmdRJsm0Qzi/W6ify8A6z+ukOGj/etqcV8sktx8+BvPwQzG /l2IYJz/XhzPMvPkqcjUDxZbczYcm8NtEtKiudwM+EYu3rWQIcJq7xwNoBkuA9aJIEaq 6ASw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=gq3QyBnCV9nTAcj4pWnGxrDyFJDXcEPQTCyegYfFr/Q=; b=dy2Hn4C5zj40spnzOG5BYo5rcYGnE1mZ4YWSifLvcP2Toreshg1zcuMmDESiCWtC7u ZXs0RfLs4uNExD+7gx/NHKvYY3haYmIHgnVim33ReuaHrr5QUDlTbragrjAmM7b++uiN s+n/geZhpT4qKcx0t8BBDDfcAp5QGja8QTnCsB66zMQNuI6d5AE5e3SqOMKXiQ2aTr8E rk7KGANb/Ny9UlJKr4ijPkuAAr3mZpjolCUaPe3i5NDWRPPy6FKGj9Z6JYjTtmk8cOgZ 9AflMxGIr+S5dKgHRkI0n+4GWkbNlVAfq4x+VT6vVriRKoxXp2gd/E2IPOdo8shLAbKw RioA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Yw29w3zf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gz7si16065226ejb.271.2019.11.06.07.25.42; Wed, 06 Nov 2019 07:26:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Yw29w3zf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732052AbfKFPY7 (ORCPT + 99 others); Wed, 6 Nov 2019 10:24:59 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:34193 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728289AbfKFPY6 (ORCPT ); Wed, 6 Nov 2019 10:24:58 -0500 Received: by mail-wr1-f65.google.com with SMTP id e6so24461725wrw.1 for ; Wed, 06 Nov 2019 07:24:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=gq3QyBnCV9nTAcj4pWnGxrDyFJDXcEPQTCyegYfFr/Q=; b=Yw29w3zfakrlCT2cDey3VVh5tDHaCMvIO6MpF158HWHn8WKL35VHLMIsRDFVIsNSb3 O+xol5hLWGkMcKNbgbXQJ+Syl8SmDYPsnlj3gO5+rxH7995Xa55eoi59bSW1sl8LGwNT MFNzYZrSokupdAH46kaI1bdMItV1E4/cSQ/U74/drfSwbEBRH/8EVuUy1cJRtOtHswC3 fS9e0txk0bEN2DhZHUhV3RQK9cueVoJD6c4oXzHh8Xj/NQqXheI5whwUpy9q8jMzl0qG K+P40Ly9s5RlKyhxZecGXYIgpQPVT7+h61bUF/oHxMW/Y5z1jUDA3eOWjw8MiLwI5kiE qkTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=gq3QyBnCV9nTAcj4pWnGxrDyFJDXcEPQTCyegYfFr/Q=; b=iZLIOGubxewKz7NT7x/Y0n5scVn3s/RPUu/LDGP0/ciXLW5A16ojawVcSo6USQs7N+ 1iqm6woud8LChS2d361QEVGaMl2s5KKbu0OL6RsdJ+Tfn43kdmAcZiGZOrZOXMf1sru5 iS7wMuFOnh1dCN+3bFVDRyoqNmnw9cWpCfZAAtSsjxV8W12MANvEGp0do/4deh8v5RZT +0prUq4zeTbRsN8OrPoORdNzRqjJRvOs5wMnvr2YeUCWXxL067SJGtobCvRMJgrY4Jrr qkzp0ZmwpyIDqA1TUuz8cYBKfq09nx8Mz3d+MejCFtwF7Dbiu55Kori3OD60+RFDte71 /y6Q== X-Gm-Message-State: APjAAAX2oWTxjqPUIOj9hBE7/EHjoZaDUMV5ej3F67RKVBUVZSsT5/zT BrNR/sXBndK/J6pKboKodexFfw== X-Received: by 2002:adf:e712:: with SMTP id c18mr3072972wrm.127.1573053895499; Wed, 06 Nov 2019 07:24:55 -0800 (PST) Received: from google.com ([2a00:79e0:d:210:e8f7:125b:61e9:733d]) by smtp.gmail.com with ESMTPSA id g5sm3423856wmf.37.2019.11.06.07.24.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Nov 2019 07:24:54 -0800 (PST) Date: Wed, 6 Nov 2019 15:24:54 +0000 From: Matthias Maennich To: Masahiro Yamada Cc: Jessica Yu , Linux Kbuild mailing list , Matthias Kaehlcke , Jonathan Corbet , Michal Marek , "open list:DOCUMENTATION" , Linux Kernel Mailing List Subject: Re: [PATCH 2/4] modpost: dump missing namespaces into a single modules.nsdeps file Message-ID: <20191106152454.GA1243@google.com> References: <20191029123809.29301-1-yamada.masahiro@socionext.com> <20191029123809.29301-3-yamada.masahiro@socionext.com> <20191031112044.GC2177@linux-8ccs> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 31, 2019 at 08:53:25PM +0900, Masahiro Yamada wrote: >On Thu, Oct 31, 2019 at 8:20 PM Jessica Yu wrote: >> >> +++ Masahiro Yamada [29/10/19 21:38 +0900]: >> >The modpost, with the -d option given, generates per-module .ns_deps >> >files. >> > >> >Kbuild generates per-module .mod files to carry module information. >> >This is convenient because Make handles multiple jobs when the -j >> >option is given. >> > >> >On the other hand, the modpost always runs as a single thread. >> >I do not see a strong reason to produce separate .ns_deps files. >> > >> >This commit changes the modpost to generate just one file, >> >modules.nsdeps, each line of which has the following format: >> > >> > : >> > >> >Please note it contains *missing* namespaces instead of required ones. >> >So, modules.nsdeps is empty if the namespace dependency is all good. >> > >> >This will work more efficiently because spatch will no longer process >> >already imported namespaces. I removed the '(if needed)' from the >> >nsdeps log since spatch is invoked only when needed. >> > >> >This also solved the stale .ns_deps files problem reported by >> >Jessica Yu: >> > >> > https://lkml.org/lkml/2019/10/28/467 >> > >> >While I was here, I improved the modpost code a little more; >> >I freed ns_deps_bus.p because buf_write() allocates memory. >> > >> >Signed-off-by: Masahiro Yamada >> >--- >> > >> > .gitignore | 2 +- >> > Documentation/dontdiff | 1 + >> > Makefile | 4 ++-- >> > scripts/Makefile.modpost | 2 +- >> > scripts/mod/modpost.c | 44 +++++++++++++++++----------------------- >> > scripts/mod/modpost.h | 4 ++-- >> > scripts/nsdeps | 21 +++++++++---------- >> > 7 files changed, 36 insertions(+), 42 deletions(-) >> > >> >diff --git a/.gitignore b/.gitignore >> >index 70580bdd352c..72ef86a5570d 100644 >> >--- a/.gitignore >> >+++ b/.gitignore >> >@@ -32,7 +32,6 @@ >> > *.lzo >> > *.mod >> > *.mod.c >> >-*.ns_deps >> > *.o >> > *.o.* >> > *.patch >> >@@ -61,6 +60,7 @@ modules.order >> > /System.map >> > /Module.markers >> > /modules.builtin.modinfo >> >+/modules.nsdeps >> > >> > # >> > # RPM spec file (make rpm-pkg) >> >diff --git a/Documentation/dontdiff b/Documentation/dontdiff >> >index 9f4392876099..72fc2e9e2b63 100644 >> >--- a/Documentation/dontdiff >> >+++ b/Documentation/dontdiff >> >@@ -179,6 +179,7 @@ mkutf8data >> > modpost >> > modules.builtin >> > modules.builtin.modinfo >> >+modules.nsdeps >> > modules.order >> > modversions.h* >> > nconf >> >diff --git a/Makefile b/Makefile >> >index 0ef897fd9cfd..1e3f307bd49b 100644 >> >--- a/Makefile >> >+++ b/Makefile >> >@@ -1356,7 +1356,7 @@ endif # CONFIG_MODULES >> > >> > # Directories & files removed with 'make clean' >> > CLEAN_DIRS += include/ksym >> >-CLEAN_FILES += modules.builtin.modinfo >> >+CLEAN_FILES += modules.builtin.modinfo modules.nsdeps >> >> Hmm, I tried to run `make -C path/to/kernel/src M=$(PWD) clean` for a test >> external module, but it didn't remove modules.nsdeps for me. I declared a >> MODULE namespace for testing purposes. >> >> $ make >> make -C /dev/shm/linux M=/tmp/ppyu/test-module >> make[1]: Entering directory '/dev/shm/linux' >> AR /tmp/ppyu/test-module/built-in.a >> CC [M] /tmp/ppyu/test-module/test1.o >> CC [M] /tmp/ppyu/test-module/test2.o >> LD [M] /tmp/ppyu/test-module/test.o >> Building modules, stage 2. >> MODPOST 1 modules >> WARNING: module test uses symbol try_module_get from namespace MODULE, but does not import it. >> CC [M] /tmp/ppyu/test-module/test.mod.o >> LD [M] /tmp/ppyu/test-module/test.ko >> make[1]: Leaving directory '/dev/shm/linux' >> >> Then I make nsdeps: >> >> make -C /dev/shm/linux M=/tmp/ppyu/test-module nsdeps >> make[1]: Entering directory '/dev/shm/linux' >> Building modules, stage 2. >> MODPOST 1 modules >> WARNING: module test uses symbol try_module_get from namespace MODULE, but does not import it. >> Adding namespace MODULE to module /tmp/ppyu/test-module/test.ko. >> --- /tmp/ppyu/test-module/test1.c >> +++ /tmp/cocci-output-3696-c1f8b3-test1.c >> @@ -38,3 +38,4 @@ static void __exit hello_cleanup(void) >> module_init(hello_init); >> module_exit(hello_cleanup); >> MODULE_LICENSE("GPL"); >> +MODULE_IMPORT_NS(MODULE); >> make[1]: Leaving directory '/dev/shm/linux' >> $ cat modules.nsdeps >> /tmp/ppyu/test-module/test.ko: MODULE >> >> Looks good so far, then I try make clean: >> >> $ make clean >> make -C /dev/shm/linux M=/tmp/ppyu/test-module clean >> make[1]: Entering directory '/dev/shm/linux' >> CLEAN /tmp/ppyu/test-module/Module.symvers >> make[1]: Leaving directory '/dev/shm/linux' >> $ ls >> Makefile modules.nsdeps test1.c test2.c >> >> But modules.nsdeps is still there. >> > >Good catch! > >I forgot to take care of it for external module builds. > >The following should work. I will fold it in 3/4. > > > > >diff --git a/Makefile b/Makefile >index 79be70bf2899..6035702803eb 100644 >--- a/Makefile >+++ b/Makefile >@@ -1619,7 +1619,7 @@ _emodinst_post: _emodinst_ > $(call cmd,depmod) > > clean-dirs := $(KBUILD_EXTMOD) >-clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers >+clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers $(KBUILD_EXTMOD)/modules.nsdeps Reviewed-by: Matthias Maennich Tested-by: Matthias Maennich Thanks for this improvement! Cheers, Matthias > > PHONY += / > /: > > > >-- >Best Regards >Masahiro Yamada