mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1] X86 architecture (32-bit and 64-bit): Convert to use jiffies macro
@ 2024-08-22  3:47 Chen Yufan
  2024-08-22 15:26 ` kernel test robot
  2024-08-22 16:07 ` kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Chen Yufan @ 2024-08-22  3:47 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H. Peter Anvin, Chen Yufan, Stephen Rothwell, linux-kernel
  Cc: opensource.kernel

Use time_after macro instead of using
jiffies directly to handle wraparound.

Signed-off-by: Chen Yufan <chenyufan@vivo.com>
---
 arch/x86/kernel/cpu/aperfmperf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/aperfmperf.c b/arch/x86/kernel/cpu/aperfmperf.c
index 0b69bfbf3..5fe0a7576 100644
--- a/arch/x86/kernel/cpu/aperfmperf.c
+++ b/arch/x86/kernel/cpu/aperfmperf.c
@@ -16,6 +16,7 @@
 #include <linux/sched/topology.h>
 #include <linux/smp.h>
 #include <linux/syscore_ops.h>
++#include <linux/jiffies.h>
 
 #include <asm/cpu.h>
 #include <asm/cpu_device_id.h>
@@ -434,7 +435,7 @@ unsigned int arch_freq_get_on_cpu(int cpu)
 	 * Bail on invalid count and when the last update was too long ago,
 	 * which covers idle and NOHZ full CPUs.
 	 */
-	if (!mcnt || (jiffies - last) > MAX_SAMPLE_AGE)
+	if (!mcnt || time_after(jiffies, last + MAX_SAMPLE_AGE))
 		goto fallback;
 
 	return div64_u64((cpu_khz * acnt), mcnt);
-- 
2.39.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] X86 architecture (32-bit and 64-bit): Convert to use jiffies macro
  2024-08-22  3:47 [PATCH v1] X86 architecture (32-bit and 64-bit): Convert to use jiffies macro Chen Yufan
@ 2024-08-22 15:26 ` kernel test robot
  2024-08-22 16:07 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2024-08-22 15:26 UTC (permalink / raw)
  To: Chen Yufan, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H. Peter Anvin, Stephen Rothwell, linux-kernel
  Cc: oe-kbuild-all, opensource.kernel

Hi Chen,

kernel test robot noticed the following build errors:

[auto build test ERROR on tip/x86/core]
[also build test ERROR on linus/master v6.11-rc4 next-20240822]
[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/Chen-Yufan/X86-architecture-32-bit-and-64-bit-Convert-to-use-jiffies-macro/20240822-114925
base:   tip/x86/core
patch link:    https://lore.kernel.org/r/20240822034721.9561-1-chenyufan%40vivo.com
patch subject: [PATCH v1] X86 architecture (32-bit and 64-bit): Convert to use jiffies macro
config: x86_64-defconfig (https://download.01.org/0day-ci/archive/20240822/202408222321.a5EoSpB5-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240822/202408222321.a5EoSpB5-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408222321.a5EoSpB5-lkp@intel.com/

All errors (new ones prefixed by >>):

>> arch/x86/kernel/cpu/aperfmperf.c:19:1: error: expected identifier or '(' before '+' token
      19 | +#include <linux/jiffies.h>
         | ^
>> arch/x86/kernel/cpu/aperfmperf.c:19:2: error: stray '#' in program
      19 | +#include <linux/jiffies.h>
         |  ^


vim +19 arch/x86/kernel/cpu/aperfmperf.c

  > 19	+#include <linux/jiffies.h>
    20	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] X86 architecture (32-bit and 64-bit): Convert to use jiffies macro
  2024-08-22  3:47 [PATCH v1] X86 architecture (32-bit and 64-bit): Convert to use jiffies macro Chen Yufan
  2024-08-22 15:26 ` kernel test robot
@ 2024-08-22 16:07 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2024-08-22 16:07 UTC (permalink / raw)
  To: Chen Yufan, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H. Peter Anvin, Stephen Rothwell, linux-kernel
  Cc: oe-kbuild-all, opensource.kernel

Hi Chen,

kernel test robot noticed the following build errors:

[auto build test ERROR on tip/x86/core]
[also build test ERROR on linus/master v6.11-rc4 next-20240822]
[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/Chen-Yufan/X86-architecture-32-bit-and-64-bit-Convert-to-use-jiffies-macro/20240822-114925
base:   tip/x86/core
patch link:    https://lore.kernel.org/r/20240822034721.9561-1-chenyufan%40vivo.com
patch subject: [PATCH v1] X86 architecture (32-bit and 64-bit): Convert to use jiffies macro
config: x86_64-randconfig-161-20240822 (https://download.01.org/0day-ci/archive/20240822/202408222338.iKsWRLjQ-lkp@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240822/202408222338.iKsWRLjQ-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408222338.iKsWRLjQ-lkp@intel.com/

All errors (new ones prefixed by >>):

>> arch/x86/kernel/cpu/aperfmperf.c:19:1: error: expected external declaration
      19 | +#include <linux/jiffies.h>
         | ^
>> arch/x86/kernel/cpu/aperfmperf.c:19:2: error: expected identifier or '('
      19 | +#include <linux/jiffies.h>
         |  ^
   2 errors generated.


vim +19 arch/x86/kernel/cpu/aperfmperf.c

  > 19	+#include <linux/jiffies.h>
    20	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-22 16:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-22  3:47 [PATCH v1] X86 architecture (32-bit and 64-bit): Convert to use jiffies macro Chen Yufan
2024-08-22 15:26 ` kernel test robot
2024-08-22 16:07 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®