Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp608885pxu; Thu, 7 Jan 2021 13:18:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJxe0Eaog9lnReva9tyQBkb3itASWlDV6GZZvJyYFnsjcLOeBTDX1JCXN+qWwi58oTgU7WEV X-Received: by 2002:a17:906:77c5:: with SMTP id m5mr522600ejn.424.1610054288935; Thu, 07 Jan 2021 13:18:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610054288; cv=none; d=google.com; s=arc-20160816; b=bDCbO48BQjjGI7NEOGpXhBPUu4enuFRBpIH5STrbVy+3W/9bH/W41HRMZ9PvqvDLqe lODuoJ29Z8mFdC13JxBrkuIeiqQyS0Rwbk2J3Ozy6wDlGsrvy+7WmN8PNYlj7toX3iTE KUEkangdbNhaXEJ/SjcR7s8XZtbUAN43bFRrShUydw6km/JwWtTz/Qi6Nu4sWuM7joTf stODwZcuU0eIKoWXjA8euhNsozI4vkArmhh2CyPaZz9ZyqyPCHRGiWap7anuL76hL/5t 83X69IintGfzjDWNXoUSoBUP1UdBA9BwrSgbIAW2R+fUS3Zin3V+H+R1sCv3ARaxVOxG zMFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=TKs0fV6NhoCyOBE5f3/MGawBR0S3YXYEf2e8DTZq60I=; b=NIdrK6aE3OVGUi8qcEoYeT19RUA3S/bXUVRwehh9xG9Vutz3CHXELItovnFYwRkd6h R9bvb9qqW7SPK2W8DXdyzlPAvzmaWHR6+IgHE6dw5HMHPlUb5a53h9nwF8BPyrkdLTPl ErElyBbSO2hlNcSc9iftfCmMv3GdBulU4FyD3y9QAMx2qWvOztM8Q3684or0vPb30JLJ v96ho0nlTG/8482Z/QjO2PVuXj4kIlxTeAbJiqIbfApivrmacqL65TYGZQ23Y8Qov84x PDV/p0ZR3a/IWNQdcTvNxc+KT/8TdtCZfn4yPLe0DniCMNNPOVyqMd+P3CylMXt0ZIlj j3rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cloudflare.com header.s=google header.b=uOFERN45; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cloudflare.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pw16si2589924ejb.430.2021.01.07.13.17.45; Thu, 07 Jan 2021 13:18:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cloudflare.com header.s=google header.b=uOFERN45; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cloudflare.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727265AbhAGVQ1 (ORCPT + 99 others); Thu, 7 Jan 2021 16:16:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726541AbhAGVQ0 (ORCPT ); Thu, 7 Jan 2021 16:16:26 -0500 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1784DC0612F4 for ; Thu, 7 Jan 2021 13:15:29 -0800 (PST) Received: by mail-lf1-x12c.google.com with SMTP id a12so17968475lfl.6 for ; Thu, 07 Jan 2021 13:15:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudflare.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=TKs0fV6NhoCyOBE5f3/MGawBR0S3YXYEf2e8DTZq60I=; b=uOFERN45dgTYuB9A1SChV46j7m+Puc+TMuLTbVa+aO+MpTkMo0jNiVR149K9x/3Xxg b8bDLsBSNOkzt0W91UElG89VlcVdZD3brDOy8J2A876Bk9/A0Q3Nft/ZHbFICXjCrEQt 9/SkUmrjrsf9fMBc2F31ItnpsrbJ+V4+VdgsM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TKs0fV6NhoCyOBE5f3/MGawBR0S3YXYEf2e8DTZq60I=; b=gUCoQ2DKz9e+hXUiKJ/DtbHYX3TNkxBRrO/akNV30/bUsrHXFLpPcJ1z9pjKny2tQi jurmTR/hCtetL+GPGD8nyorhmVw8kui5rX4IcuAkSLiTHr+jyEiVd2nvtNtcLEE79usR rrxNnqGdFKcrOiIj4yM3ydY3TdZSXvouTpIiWhGXMBxfcUuEjGgeD5Lu4Tr7WiSVpwpa YSpD5jFgEmseRCmw4kVSBUISybnD2cZAsXKNyjZgMZrY8O55j0HY4aLc3b0nJlSTqGOz AUB1PSOYrpuEIK/d9nm789Kph3a2leotP3yHUgTEiG7LUeHU/imssgs+76Vu3W+M6mV0 rX9Q== X-Gm-Message-State: AOAM5302HL+nq0DCmrnVFOiO4EV2VnPIBaqHvYfyt/t71QME8zEEV8Z5 YYCVj90aBbujQ25uX6POX0tF/3BZe5c+0Qx4SyS91g== X-Received: by 2002:a2e:574d:: with SMTP id r13mr149988ljd.479.1610054127441; Thu, 07 Jan 2021 13:15:27 -0800 (PST) MIME-Version: 1.0 References: <20210104235719.13525-1-ivan@cloudflare.com> <2100533.HVZEckHxcR@c100> <3977966.bfq5YHlNPR@c100> In-Reply-To: <3977966.bfq5YHlNPR@c100> From: Ivan Babrou Date: Thu, 7 Jan 2021 13:15:16 -0800 Message-ID: Subject: Re: [PATCH] cpupower: add Makefile dependencies for install targets To: Thomas Renninger Cc: linux-pm@vger.kernel.org, linux-kernel , kernel-team , Shuah Khan Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 7, 2021 at 12:59 PM Thomas Renninger wrote: > > Am Donnerstag, 7. Januar 2021, 18:42:25 CET schrieb Ivan Babrou: > > On Thu, Jan 7, 2021 at 2:07 AM Thomas Renninger wrote: > > > Am Dienstag, 5. Januar 2021, 00:57:18 CET schrieb Ivan Babrou: > > > > This allows building cpupower in parallel rather than serially. > > > > > > cpupower is built serially: > > > > > > [ make clean ] > > > > > > time make > > > real 0m3,742s > > > user 0m3,330s > > > sys 0m1,105s > > > > > > [ make clean ] > > > > > > time make -j10 > > > real 0m1,045s > > > user 0m3,153s > > > sys 0m1,037s > > > > > > Only advantage I see is that you can call > > > make install-xy > > > targets without calling the corresponding build target > > > make xy > > > similar to the general install target: > > > install: all install-lib ... > > > > > > Not sure anyone needs this and whether all targets > > > successfully work this way. > > > If you'd show a useful usecase example... > > > > We build a bunch of kernel related tools (perf, cpupower, bpftool, > > etc.) from our own top level Makefile, propagating parallelism > > downwards like one should. > I still do not understand why you do not simply build: > Also if I call this from /tools directory I get a quick build: > make -j20 cpupower > > Can you please show the make calls, ideally with a timing to better understand > and also to reproduce the advantages this patch introduces. > From what I can see, it only helps if one calls "sub-install" targets > directly? That's exactly what we do: make install directly: /linux-5.10.5$ make -C ./tools/power/cpupower DESTDIR=/tmp/cpupower install -j $(nproc) make: Entering directory '/state/home/ivan/linux-5.10.5/tools/power/cpupower' CC cpupower MSGFMT po/de.gmo MSGFMT po/fr.gmo MSGFMT po/it.gmo MSGFMT po/cs.gmo /usr/bin/install -c -d /tmp/cpupower/usr/lib64 MSGFMT po/pt.gmo /usr/bin/install -c -d /tmp/cpupower/usr/bin /usr/bin/install -c -m 644 -D man/cpupower.1 /tmp/cpupower/usr/man/man1/cpupower.1 /usr/bin/install -c -d /tmp/cpupower/usr/share/locale cp -fpR ./libcpupower.so* /tmp/cpupower/usr/lib64/ /usr/bin/install -c ./cpupower /tmp/cpupower/usr/bin /usr/bin/install -c -m 644 -D man/cpupower-frequency-set.1 /tmp/cpupower/usr/man/man1/cpupower-frequency-set.1 make[1]: Entering directory '/state/home/ivan/linux-5.10.5/tools/power/cpupower/bench' for HLANG in de fr it cs pt; do \ echo '/usr/bin/install -c -m 644 -D ./po/$HLANG.gmo /tmp/cpupower/usr/share/locale/$HLANG/LC_MESSAGES/cpupower.mo'; \ /usr/bin/install -c -m 644 -D ./po/$HLANG.gmo /tmp/cpupower/usr/share/locale/$HLANG/LC_MESSAGES/cpupower.mo; \ done; CC main.o /usr/bin/install -c -d /tmp/cpupower/usr/share/bash-completion/completions /usr/bin/install -c -m 644 -D ./po/$HLANG.gmo /tmp/cpupower/usr/share/locale/$HLANG/LC_MESSAGES/cpupower.mo CC parse.o /usr/bin/install -c -m 644 -D man/cpupower-frequency-info.1 /tmp/cpupower/usr/man/man1/cpupower-frequency-info.1 CC system.o /usr/bin/install: cannot stat './po/de.gmo'/usr/bin/install -c -d /tmp/cpupower/usr/include : No such file or directory make[1]: Entering directory '/state/home/ivan/linux-5.10.5/tools/power/cpupower/bench' mkdir -p /tmp/cpupower//usr/sbin /usr/bin/install -c -m 644 cpupower-completion.sh '/tmp/cpupower/usr/share/bash-completion/completions/cpupower' /usr/bin/install -c -m 644 -D ./po/$HLANG.gmo /tmp/cpupower/usr/share/locale/$HLANG/LC_MESSAGES/cpupower.mo CC benchmark.o /usr/bin/install -c -m 644 -D man/cpupower-idle-set.1 /tmp/cpupower/usr/man/man1/cpupower-idle-set.1 /usr/bin/install: cannot stat './po/fr.gmo': No such file or directory /usr/bin/install -c -m 644 -D ./po/$HLANG.gmo /tmp/cpupower/usr/share/locale/$HLANG/LC_MESSAGES/cpupower.mo mkdir -p /tmp/cpupower//usr/bin /usr/bin/install -c -m 644 lib/cpufreq.h /tmp/cpupower/usr/include/cpufreq.h /usr/bin/install -c -m 644 -D man/cpupower-idle-info.1 /tmp/cpupower/usr/man/man1/cpupower-idle-info.1 mkdir -p /tmp/cpupower//usr/share/doc/packages/cpupower /usr/bin/install -c -m 644 -D ./po/$HLANG.gmo /tmp/cpupower/usr/share/locale/$HLANG/LC_MESSAGES/cpupower.mo /usr/bin/install -c -m 644 lib/cpuidle.h /tmp/cpupower/usr/include/cpuidle.h mkdir -p /tmp/cpupower//etc/ /usr/bin/install -c -m 644 -D man/cpupower-set.1 /tmp/cpupower/usr/man/man1/cpupower-set.1 /usr/bin/install -c -m 644 -D ./po/$HLANG.gmo /tmp/cpupower/usr/share/locale/$HLANG/LC_MESSAGES/cpupower.mo install -m 755 .//cpufreq-bench /tmp/cpupower//usr/sbin/cpufreq-bench /usr/bin/install -c -m 644 -D man/cpupower-info.1 /tmp/cpupower/usr/man/man1/cpupower-info.1 /usr/bin/install -c -m 644 -D man/cpupower-monitor.1 /tmp/cpupower/usr/man/man1/cpupower-monitor.1 install: cannot stat './/cpufreq-bench': No such file or directory Makefile:31: recipe for target 'install' failed make[1]: *** [install] Error 1 make[1]: Leaving directory '/state/home/ivan/linux-5.10.5/tools/power/cpupower/bench' Makefile:304: recipe for target 'install-bench' failed make: *** [install-bench] Error 2 make: *** Waiting for unfinished jobs.... CC cpufreq-bench make[1]: Leaving directory '/state/home/ivan/linux-5.10.5/tools/power/cpupower/bench' make: Leaving directory '/state/home/ivan/linux-5.10.5/tools/power/cpupower' It works with -j 1. My patch makes it work with arbitrary parallelism, same as any other tool we build internally (perf, bpftool, turbostat, etc.). > And I still do not understand why things should be more parallel now. > > > Without this patch we have to remove parallelism for cpupower, > Why? > > > which doesn't seem like a very clean thing > > to do, especially if you consider that it's 3x faster with parallelism > > enabled in wall clock terms. > Sure, you want to build in parallel. I still do not understand how this > patch helps in this regard. > > BTW, I recently had a bunch of userspace tools Makefile patches. > I'd like to add you to CC for a review if they are not submitted already. Don't know how useful I can be, but feel free to. > Thomas > >