Message ID | 20221220070705.2958959-1-npiggin@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp2821199wrn; Mon, 19 Dec 2022 23:26:25 -0800 (PST) X-Google-Smtp-Source: AA0mqf5nWAeYO+WpddbL163V/eW8MBoq/PDPzFW/Uzdcl+3wn55BOMuzIjlW9pLdGMgYQb9YL/8c X-Received: by 2002:a17:906:a11a:b0:7c0:a5c8:d14f with SMTP id t26-20020a170906a11a00b007c0a5c8d14fmr38154956ejy.77.1671521185492; Mon, 19 Dec 2022 23:26:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671521185; cv=none; d=google.com; s=arc-20160816; b=UTylWuZfnBtwYcJT5ZXLJKDzMhMdo1b93wcLG93JRkk/HQpV7DGgdFS0LEvtigberN icM9lup4U+LU4UNjz5ztWfSK2c9zIMrkluwFAfyiP+4Mx6ORoiObKJKxuD5pCAzZL9KT Ge867/osWK5WIqe1LDnOtckpE3FHF5nxuqGHJY+s2oVVBZLLlM5ZCDbbrHhM/qhTUCf2 IEwqYYUpK8jKTSO3pZRx2B1cfFJs362CNE4D12tXqLzNKF7IngcOkZ+636HqYRkGtqmY IFXFdTX10tzouvBTqjt/SR/1uaxz3/EQ2TwEfKb53GO33uraSvvWylXI19lithYShlR+ FbFQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=AwGJvi0Hqvv9JsuJy6Gv715wZTJNC2wfNDuRpG/Z03c=; b=YsVNhq1rthJZRadyWMyQz3ewlJi6UEZy+zcFpocg/W82Z/g50/h0j4e99at9tn2Y+8 MZl6hyJsAVSBc8NhSFK8cc7lCho+Ohk4FkOsQNu5f4+VNpHtsjmiPA0Cytl2f31bJ7pw Kju9kXVR3KBI+wzp4vjtyrmTmW0DarVVFafktcQxtNhaQqWcBwzg8GpwYnkp30XckECL IUQnVhT4Dkga+zumn6Yqi7IaUsMDRlhlVgZ/nWXZVBkJR2Y/5rbnNRDBY++Gqfto1a/5 n9DEgWNgCZLMKKrr0KeTt1Whm3UTGERRii2a4JQj2kPrOJw+S6zhMBg3zACCD2PVbnV8 eG/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=eMolG9vH; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hp23-20020a1709073e1700b007820aa60dc3si12120435ejc.74.2022.12.19.23.26.02; Mon, 19 Dec 2022 23:26:25 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=eMolG9vH; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233280AbiLTHO0 (ORCPT <rfc822;abdi.embedded@gmail.com> + 99 others); Tue, 20 Dec 2022 02:14:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233565AbiLTHOA (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 20 Dec 2022 02:14:00 -0500 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB2F618B3D; Mon, 19 Dec 2022 23:07:22 -0800 (PST) Received: by mail-pj1-x102a.google.com with SMTP id js9so11525185pjb.2; Mon, 19 Dec 2022 23:07:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=AwGJvi0Hqvv9JsuJy6Gv715wZTJNC2wfNDuRpG/Z03c=; b=eMolG9vHTtOXK18ugSCIT0pCtnwCyoEsJeJ5PFZQGlEJEv8sGasn8k+mDNhl13PHtY KxdPALt6iNv1ZxEOScug4CjFT4yCtXaPilRS4KpEie5J9Y8SLqmppp5JrDNEKt+UxiZk eqBpTCNCaf/7o148rNd27ULe/kJ9Xn6dxiP231e6ygEywzOKaGrwUesy9DXrmQask2mJ QivmeB3xkmUMw8175037K8srGanPjwIp2+itZCK6uHl1Delon502RC/BOMncaixcxKaP c0p0fyUNurBXLQPHDAAE3x9UdnNFTS36u+ZdnOICTnOxYQF2w5zemVtMudmeT7rOIbzN 0jbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=AwGJvi0Hqvv9JsuJy6Gv715wZTJNC2wfNDuRpG/Z03c=; b=gPquulXJNuhOIpoQuDEhq2z6kNRJrpGx9JLcx908mWGEILxmKGXsb/AboKNo7Gx2U0 Rti3PIQ/t4YxeCV40Ab7Dnyk063etWWJzTXtEI7tZIhiUPKQISrrYwkucxwXxOBD73Ox 5NyGghyD9i7YwigRYXuqAKmwszra49lpriFNNOtoU/o0z72xyvZRcAIUDjCSMx9k1qWk 7hQD4t7RZ0+x/fGhbPRxDzPk5zOX+YXFMnVBbxxbY4HdJvtfRtR1R/x6Fs+rVD+ysRw3 4j58p5rX/UiscZ26sQs5GEvbK4+MOsTE2EjXzdgXu9gSeLyC6f4L4mh0fIUujFwE7Qoo mz2g== X-Gm-Message-State: ANoB5pn4/4XKsNAQ9vPbeX5KET5xaY7DRcb0iXFDdfv4UF90BPC/llUq PVJvv0AhtkTGsjji7qN3fRIvkdUOryZVIg== X-Received: by 2002:a17:90b:1916:b0:21a:4bf:eeb0 with SMTP id mp22-20020a17090b191600b0021a04bfeeb0mr46812820pjb.28.1671520041576; Mon, 19 Dec 2022 23:07:21 -0800 (PST) Received: from bobo.ozlabs.ibm.com (203-219-149-28.tpgi.com.au. [203.219.149.28]) by smtp.gmail.com with ESMTPSA id f10-20020a17090ace0a00b00219220edf0dsm7074232pju.48.2022.12.19.23.07.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Dec 2022 23:07:20 -0800 (PST) From: Nicholas Piggin <npiggin@gmail.com> To: linux-kernel@vger.kernel.org Cc: Nicholas Piggin <npiggin@gmail.com>, linux-arch@vger.kernel.org, Peter Zijlstra <peterz@infradead.org>, Rik van Riel <riel@surriel.com>, Thomas Gleixner <tglx@linutronix.de>, Frederic Weisbecker <fweisbec@gmail.com>, Sven Schnelle <svens@linux.ibm.com>, Arnd Bergmann <arnd@arndb.de>, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org Subject: [PATCH] cputime: remove cputime_to_nsecs fallback Date: Tue, 20 Dec 2022 17:07:05 +1000 Message-Id: <20221220070705.2958959-1-npiggin@gmail.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752716998405158462?= X-GMAIL-MSGID: =?utf-8?q?1752716998405158462?= |
Series |
cputime: remove cputime_to_nsecs fallback
|
|
Commit Message
Nicholas Piggin
Dec. 20, 2022, 7:07 a.m. UTC
The archs that use cputime_to_nsecs() internally provide their own
definition and don't need the fallback. cputime_to_usecs() unused except
in this fallback, and is not defined anywhere.
This removes the final remnant of the cputime_t code from the kernel.
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@surriel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-s390@vger.kernel.org
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
This required a couple of tweaks to s390 includes so we're not pulling
asm/cputime.h into the core header unnecessarily. In that case maybe
this can go via s390 tree because the patch should be otherwise quite
trivial. Could it get an ack or two from a core maintainer to support
that?
Thanks,
Nick
arch/s390/kernel/idle.c | 2 +-
arch/s390/kernel/vtime.c | 2 +-
include/linux/sched/cputime.h | 9 ---------
kernel/sched/cputime.c | 4 ++++
4 files changed, 6 insertions(+), 11 deletions(-)
Comments
Hi Nicholas,
I love your patch! Perhaps something to improve:
[auto build test WARNING on s390/features]
[also build test WARNING on tip/sched/core soc/for-next linus/master v6.1 next-20221220]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Nicholas-Piggin/cputime-remove-cputime_to_nsecs-fallback/20221220-150845
base: https://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git features
patch link: https://lore.kernel.org/r/20221220070705.2958959-1-npiggin%40gmail.com
patch subject: [PATCH] cputime: remove cputime_to_nsecs fallback
config: ia64-randconfig-c031-20221218
compiler: ia64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/875582613c350eb1d2fe580ce2204756a0865a25
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Nicholas-Piggin/cputime-remove-cputime_to_nsecs-fallback/20221220-150845
git checkout 875582613c350eb1d2fe580ce2204756a0865a25
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=ia64 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=ia64 SHELL=/bin/bash arch/ia64/kernel/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> arch/ia64/kernel/time.c:110:6: warning: no previous prototype for 'arch_vtime_task_switch' [-Wmissing-prototypes]
110 | void arch_vtime_task_switch(struct task_struct *prev)
| ^~~~~~~~~~~~~~~~~~~~~~
arch/ia64/kernel/time.c:259:6: warning: no previous prototype for 'ia64_init_itm' [-Wmissing-prototypes]
259 | void ia64_init_itm(void)
| ^~~~~~~~~~~~~
arch/ia64/kernel/time.c:396:1: warning: no previous prototype for 'time_init' [-Wmissing-prototypes]
396 | time_init (void)
| ^~~~~~~~~
vim +/arch_vtime_task_switch +110 arch/ia64/kernel/time.c
5bf412cd769eb5 Frederic Weisbecker 2012-09-08 104
b64f34cdfe5bef Hidetoshi Seto 2008-01-29 105 /*
b64f34cdfe5bef Hidetoshi Seto 2008-01-29 106 * Called from the context switch with interrupts disabled, to charge all
b64f34cdfe5bef Hidetoshi Seto 2008-01-29 107 * accumulated times to the current process, and to prepare accounting on
b64f34cdfe5bef Hidetoshi Seto 2008-01-29 108 * the next process.
b64f34cdfe5bef Hidetoshi Seto 2008-01-29 109 */
e3942ba0405236 Frederic Weisbecker 2012-11-14 @110 void arch_vtime_task_switch(struct task_struct *prev)
b64f34cdfe5bef Hidetoshi Seto 2008-01-29 111 {
b64f34cdfe5bef Hidetoshi Seto 2008-01-29 112 struct thread_info *pi = task_thread_info(prev);
baa36046d09ea6 Frederic Weisbecker 2012-06-18 113 struct thread_info *ni = task_thread_info(current);
b64f34cdfe5bef Hidetoshi Seto 2008-01-29 114
8388d21468e7e7 Frederic Weisbecker 2017-01-05 115 ni->ac_stamp = pi->ac_stamp;
b64f34cdfe5bef Hidetoshi Seto 2008-01-29 116 ni->ac_stime = ni->ac_utime = 0;
b64f34cdfe5bef Hidetoshi Seto 2008-01-29 117 }
b64f34cdfe5bef Hidetoshi Seto 2008-01-29 118
On Tue, Dec 20, 2022 at 05:07:05PM +1000, Nicholas Piggin wrote: > The archs that use cputime_to_nsecs() internally provide their own > definition and don't need the fallback. cputime_to_usecs() unused except > in this fallback, and is not defined anywhere. > > This removes the final remnant of the cputime_t code from the kernel. > > Cc: Peter Zijlstra <peterz@infradead.org> > Cc: Rik van Riel <riel@surriel.com> > Cc: Thomas Gleixner <tglx@linutronix.de> > Cc: Frederic Weisbecker <fweisbec@gmail.com> > Cc: Sven Schnelle <svens@linux.ibm.com> > Cc: Arnd Bergmann <arnd@arndb.de> > Cc: linuxppc-dev@lists.ozlabs.org > Cc: linux-s390@vger.kernel.org > Signed-off-by: Nicholas Piggin <npiggin@gmail.com> > --- > This required a couple of tweaks to s390 includes so we're not pulling > asm/cputime.h into the core header unnecessarily. In that case maybe > this can go via s390 tree because the patch should be otherwise quite > trivial. Could it get an ack or two from a core maintainer to support > that? > > Thanks, > Nick > > arch/s390/kernel/idle.c | 2 +- > arch/s390/kernel/vtime.c | 2 +- > include/linux/sched/cputime.h | 9 --------- > kernel/sched/cputime.c | 4 ++++ > 4 files changed, 6 insertions(+), 11 deletions(-) > > diff --git a/arch/s390/kernel/idle.c b/arch/s390/kernel/idle.c > index 4bf1ee293f2b..a6bbceaf7616 100644 > --- a/arch/s390/kernel/idle.c > +++ b/arch/s390/kernel/idle.c > @@ -12,9 +12,9 @@ > #include <linux/notifier.h> > #include <linux/init.h> > #include <linux/cpu.h> > -#include <linux/sched/cputime.h> > #include <trace/events/power.h> > #include <asm/cpu_mf.h> > +#include <asm/cputime.h> > #include <asm/nmi.h> > #include <asm/smp.h> > #include "entry.h" > diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c > index 9436f3053b88..e0a88dcaf5cb 100644 > --- a/arch/s390/kernel/vtime.c > +++ b/arch/s390/kernel/vtime.c > @@ -7,13 +7,13 @@ > */ > > #include <linux/kernel_stat.h> > -#include <linux/sched/cputime.h> > #include <linux/export.h> > #include <linux/kernel.h> > #include <linux/timex.h> > #include <linux/types.h> > #include <linux/time.h> > #include <asm/alternative.h> > +#include <asm/cputime.h> > #include <asm/vtimer.h> > #include <asm/vtime.h> > #include <asm/cpu_mf.h> > diff --git a/include/linux/sched/cputime.h b/include/linux/sched/cputime.h > index ce3c58286062..5f8fd5b24a2e 100644 > --- a/include/linux/sched/cputime.h > +++ b/include/linux/sched/cputime.h > @@ -8,15 +8,6 @@ > * cputime accounting APIs: > */ > > -#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE > -#include <asm/cputime.h> > - > -#ifndef cputime_to_nsecs > -# define cputime_to_nsecs(__ct) \ > - (cputime_to_usecs(__ct) * NSEC_PER_USEC) > -#endif > -#endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */ > - > #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN > extern bool task_cputime(struct task_struct *t, > u64 *utime, u64 *stime); > diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c > index 95fc77853743..af7952f12e6c 100644 > --- a/kernel/sched/cputime.c > +++ b/kernel/sched/cputime.c > @@ -3,6 +3,10 @@ > * Simple CPU accounting cgroup controller > */ > > +#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE > + #include <asm/cputime.h> > +#endif > + > #ifdef CONFIG_IRQ_TIME_ACCOUNTING > > /* For s390: Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>
diff --git a/arch/s390/kernel/idle.c b/arch/s390/kernel/idle.c index 4bf1ee293f2b..a6bbceaf7616 100644 --- a/arch/s390/kernel/idle.c +++ b/arch/s390/kernel/idle.c @@ -12,9 +12,9 @@ #include <linux/notifier.h> #include <linux/init.h> #include <linux/cpu.h> -#include <linux/sched/cputime.h> #include <trace/events/power.h> #include <asm/cpu_mf.h> +#include <asm/cputime.h> #include <asm/nmi.h> #include <asm/smp.h> #include "entry.h" diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c index 9436f3053b88..e0a88dcaf5cb 100644 --- a/arch/s390/kernel/vtime.c +++ b/arch/s390/kernel/vtime.c @@ -7,13 +7,13 @@ */ #include <linux/kernel_stat.h> -#include <linux/sched/cputime.h> #include <linux/export.h> #include <linux/kernel.h> #include <linux/timex.h> #include <linux/types.h> #include <linux/time.h> #include <asm/alternative.h> +#include <asm/cputime.h> #include <asm/vtimer.h> #include <asm/vtime.h> #include <asm/cpu_mf.h> diff --git a/include/linux/sched/cputime.h b/include/linux/sched/cputime.h index ce3c58286062..5f8fd5b24a2e 100644 --- a/include/linux/sched/cputime.h +++ b/include/linux/sched/cputime.h @@ -8,15 +8,6 @@ * cputime accounting APIs: */ -#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE -#include <asm/cputime.h> - -#ifndef cputime_to_nsecs -# define cputime_to_nsecs(__ct) \ - (cputime_to_usecs(__ct) * NSEC_PER_USEC) -#endif -#endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */ - #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN extern bool task_cputime(struct task_struct *t, u64 *utime, u64 *stime); diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c index 95fc77853743..af7952f12e6c 100644 --- a/kernel/sched/cputime.c +++ b/kernel/sched/cputime.c @@ -3,6 +3,10 @@ * Simple CPU accounting cgroup controller */ +#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE + #include <asm/cputime.h> +#endif + #ifdef CONFIG_IRQ_TIME_ACCOUNTING /*