Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp386609ybi; Tue, 16 Jul 2019 22:23:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqzsl7xvu4Wl9vvs5u2F2Yo5lIeAp6dsQA6i40pNvpQaW/ooSFJi67bvW0ET90YrNSfAPEef X-Received: by 2002:a63:2a8d:: with SMTP id q135mr38492044pgq.46.1563341014196; Tue, 16 Jul 2019 22:23:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563341014; cv=none; d=google.com; s=arc-20160816; b=SjHQq5sgKGksq3DkQCLfD+EAM+kHpTdZNIoE7lr7g28H100/CjPcNBIyQ32RjWhPUg zRERkFxZUnnQMVuXvN4AMMyFIkwGVjo5UtueFYHfL6x+cvwkvae/+mUG5TrNyYVowptq R71HNOQSFb1l2t8K0u1zp7In/lbsjv2+dSvbLed4dq7JH8cUdUMf3CIUVRkoqhqxIIZw 9rG9LX1t7fsPYSEK/do6cYQcAx+bUqALCa9MBR8S645l7OcHgFTBSqMH3j959W9aGvLG 21HBC8qVjNMz0KppZzxBl3FVYUPbHidWmGWJlsoaQbIn1ksmC41YEUuTe5GcCpXZHDPt g4/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature:dkim-filter; bh=8wyTio6eWyGUXfWyfehEhhkmdilatgeueQHXUAhXgr4=; b=EqH0Tc0z5rSUPdvAwwRnRUHeMxWYofdoiCx/oZj9uS4z5kxW2L8eKWSiDXCK0rgUQl EcjsbqMsvLAOkJ5B8OtFOVVwxiHYD1qqF+BT2i8ciVQEsSsZra3GJgycMsX0EFIGnuOF WKs3VcCCdbVPtKBY0ptZCpNKt8buCQbiDdioI1imc2euBIjy91n13T+eealOJJCYCb05 JuSG2T47nAWD8ZTOfcOVTUXyH8sx4bWNlCP01sWcktJqlCIZn8JrQXlthp6mjlN/FIwz 1bEsCdVJ/5+6JGtxgsJFyo15XckVOdTv/eJ2gg6cfnZlcdaz8qu+74LsbipXqr7FpGlm UJEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=jjkZEjQy; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y12si23952456pgg.585.2019.07.16.22.23.03; Tue, 16 Jul 2019 22:23:34 -0700 (PDT) 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=@nifty.com header.s=dec2015msa header.b=jjkZEjQy; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726056AbfGQFWg (ORCPT + 99 others); Wed, 17 Jul 2019 01:22:36 -0400 Received: from conssluserg-02.nifty.com ([210.131.2.81]:31373 "EHLO conssluserg-02.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725856AbfGQFWg (ORCPT ); Wed, 17 Jul 2019 01:22:36 -0400 Received: from mail-vs1-f41.google.com (mail-vs1-f41.google.com [209.85.217.41]) (authenticated) by conssluserg-02.nifty.com with ESMTP id x6H5MLIw019393; Wed, 17 Jul 2019 14:22:22 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-02.nifty.com x6H5MLIw019393 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1563340942; bh=8wyTio6eWyGUXfWyfehEhhkmdilatgeueQHXUAhXgr4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=jjkZEjQyqgPxgWTOy06lg4XiFphMdGWD0dkUcdUYRoSjTfEzKCyWDbeA5l31sjtlm zqOouOpTmUUR1fjahmM8X+/YdO8qcyiNNe/EGkudDoubXi/RlIem/UE/RAAkEjKJgh himXcjVNPka+DQQXDdOxZ2i3rvRxdvBbWHupkJ9TKhcVkX/7Yl+V6prx8J69e33QVH S9lLWYrJ+8F5i/cfhRFNjb8TthMvCpEoI8s5kfke/nBaxQwTDWKJ+Bxw4OlQxLrnBs sg97P4FS1Ng2YABVXz8w+/L7e2Y0z2G7Lx2h2kyckTDcFpr+rpm9z+ZdGcr4193J/2 NCmvyHeUWB/VQ== X-Nifty-SrcIP: [209.85.217.41] Received: by mail-vs1-f41.google.com with SMTP id v129so15558763vsb.11; Tue, 16 Jul 2019 22:22:22 -0700 (PDT) X-Gm-Message-State: APjAAAVl3Sjbdfsq2mHM/rp+f7FllZQ7mPBUJBo8jkYZSwNvehRO8lRZ 4OPRzgpyVDLwOM5ESjmuVdY/CZUJJErvkmIg1yg= X-Received: by 2002:a67:cd1a:: with SMTP id u26mr22707775vsl.155.1563340941315; Tue, 16 Jul 2019 22:22:21 -0700 (PDT) MIME-Version: 1.0 References: <20190711054434.1177-1-yamada.masahiro@socionext.com> <20190711054434.1177-9-yamada.masahiro@socionext.com> <20190716214023.GA15159@redhat.com> In-Reply-To: <20190716214023.GA15159@redhat.com> From: Masahiro Yamada Date: Wed, 17 Jul 2019 14:21:45 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 08/11] kbuild: create *.mod with full directory path and remove MODVERDIR To: Joe Lawrence Cc: Linux Kbuild mailing list , Sam Ravnborg , Nicolas Pitre , "open list:DOCUMENTATION" , Jonathan Corbet , Linux Kernel Mailing List , Michal Marek Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Joe On Wed, Jul 17, 2019 at 6:40 AM Joe Lawrence wrote: > > On Thu, Jul 11, 2019 at 02:44:31PM +0900, Masahiro Yamada wrote: > > While descending directories, Kbuild produces objects for modules, > > but do not link final *.ko files; it is done in the modpost. > > > > To keep track of modules, Kbuild creates a *.mod file in $(MODVERDIR) > > for every module it is building. Some post-processing steps read the > > necessary information from *.mod files. This avoids descending into > > directories again. This mechanism was introduced in 2003 or so. > > > > Later, commit 551559e13af1 ("kbuild: implement modules.order") added > > modules.order. So, we can simply read it out to know all the modules > > with directory paths. This is easier than parsing the first line of > > *.mod files. > > > > $(MODVERDIR) has a flat directory structure, that is, *.mod files > > are named only with base names. This is based on the assumption that > > the module name is unique across the tree. This assumption is really > > fragile. > > > > Stephen Rothwell reported a race condition caused by a module name > > conflict: > > > > https://lkml.org/lkml/2019/5/13/991 > > > > In parallel building, two different threads could write to the same > > $(MODVERDIR)/*.mod simultaneously. > > > > Non-unique module names are the source of all kind of troubles, hence > > commit 3a48a91901c5 ("kbuild: check uniqueness of module names") > > introduced a new checker script. > > > > However, it is still fragile in the build system point of view because > > this race happens before scripts/modules-check.sh is invoked. If it > > happens again, the modpost will emit unclear error messages. > > > > To fix this issue completely, create *.mod in the same directory as > > *.ko so that two threads never attempt to write to the same file. > > $(MODVERDIR) is no longer needed. > > > > Since modules with directory paths are listed in modules.order, Kbuild > > is still able to find *.mod files without additional descending. > > > > Signed-off-by: Masahiro Yamada > > Acked-by: Nicolas Pitre > > > > Hi Masahiro, > > I'm following this patchset changes as they will affect the klp-convert > series [1] that the livepatching folks have been working on... Empty files .tmp_versions/*.livepatch are touched to keep track of 'LIVEPATCH_* := y', right? Perhaps, adding a new field to *.mod files might be cleaner. > Just wondering if these other files should be checked for more MODVERDIR > fallout: > > % grep -R 'tmp_versions' > tools/power/cpupower/debug/kernel/Makefile: - rm -rf .tmp_versions* Module.symvers modules.order > scripts/export_report.pl: while (<.tmp_versions/*.mod>) { > scripts/adjust_autoksyms.sh:# .tmp_versions/*.mod files. > > export_report.pl is probably the only interesting one on this list. Good catch. I will fix it. > Also, can you cc me on subsequent patchset versions? Yes, will do. -- Best Regards Masahiro Yamada