Re: [PATCH] MIPS: Fix compile warnnings in kexec-elf-mips.c

2020-08-20 Thread Simon Horman
On Thu, Aug 13, 2020 at 01:31:52PM +0800, Youling Tang wrote:
> Fix the following warnings:
> 
> kexec/arch/mips/kexec-elf-mips.c:161:41: warning: passing argument 3 of
> ‘dtb_set_initrd’ makes integer from pointer without a cast
> dtb_set_initrd(_buf, _length, initrd_buf, initrd_buf + initrd_size);
>  ^
> In file included from kexec/arch/mips/kexec-elf-mips.c:33:0:
> kexec/arch/mips/../../dt-ops.h:6:5: note: expected ‘off_t’ but argument is
> of type ‘char *’
> int dtb_set_initrd(char **dtb, off_t *dtb_size, off_t start, off_t end);
>  ^
> 
> kexec/arch/mips/kexec-elf-mips.c:161:53: warning: passing argument 4 of
> ‘dtb_set_initrd’ makes integer from pointer without a cast
> dtb_set_initrd(_buf, _length, initrd_buf, initrd_buf + initrd_size);
>  ^
> In file included from kexec/arch/mips/kexec-elf-mips.c:33:0:
> kexec/arch/mips/../../dt-ops.h:6:5: note: expected ‘off_t’ but argument is
> of type ‘char *’
> int dtb_set_initrd(char **dtb, off_t *dtb_size, off_t start, off_t end);
>  ^
> 
> Signed-off-by: Youling Tang 

Thanks, applied.

___
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec


Re: [PATCH 2/2] arm64: Reserve memory for quick kexec

2020-08-20 Thread kernel test robot
Hi Sang,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on arm64/for-next/core]
[also build test ERROR on linux/master linus/master v5.8 next-20200814]
[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]

url:
https://github.com/0day-ci/linux/commits/Sang-Yan/kexec-Add-quick-kexec-support-for-kernel/20200814-142840
base:   https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git 
for-next/core
config: arm64-randconfig-r011-20200816 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.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
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross 
ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All errors (new ones prefixed by >>):

   arch/arm64/kernel/setup.c: In function 'setup_arch':
>> arch/arm64/kernel/setup.c:374:32: error: 'res' undeclared (first use in this 
>> function)
 374 |   quick_kexec_res.start >= res->start &&
 |^~~
   arch/arm64/kernel/setup.c:374:32: note: each undeclared identifier is 
reported only once for each function it appears in
--
   arch/arm64/mm/init.c: In function 'reserve_quick_kexec':
>> arch/arm64/mm/init.c:155:13: error: 'CRASH_ALIGN' undeclared (first use in 
>> this function); did you mean 'CMSG_ALIGN'?
 155 |mem_len, CRASH_ALIGN);
 | ^~~
 | CMSG_ALIGN
   arch/arm64/mm/init.c:155:13: note: each undeclared identifier is reported 
only once for each function it appears in

vim +/res +374 arch/arm64/kernel/setup.c

   284  
   285  void __init setup_arch(char **cmdline_p)
   286  {
   287  init_mm.start_code = (unsigned long) _text;
   288  init_mm.end_code   = (unsigned long) _etext;
   289  init_mm.end_data   = (unsigned long) _edata;
   290  init_mm.brk= (unsigned long) _end;
   291  
   292  *cmdline_p = boot_command_line;
   293  
   294  /*
   295   * If know now we are going to need KPTI then use non-global
   296   * mappings from the start, avoiding the cost of rewriting
   297   * everything later.
   298   */
   299  arm64_use_ng_mappings = kaslr_requires_kpti();
   300  
   301  early_fixmap_init();
   302  early_ioremap_init();
   303  
   304  setup_machine_fdt(__fdt_pointer);
   305  
   306  /*
   307   * Initialise the static keys early as they may be enabled by 
the
   308   * cpufeature code and early parameters.
   309   */
   310  jump_label_init();
   311  parse_early_param();
   312  
   313  /*
   314   * Unmask asynchronous aborts and fiq after bringing up possible
   315   * earlycon. (Report possible System Errors once we can report 
this
   316   * occurred).
   317   */
   318  local_daif_restore(DAIF_PROCCTX_NOIRQ);
   319  
   320  /*
   321   * TTBR0 is only used for the identity mapping at this stage. 
Make it
   322   * point to zero page to avoid speculatively fetching new 
entries.
   323   */
   324  cpu_uninstall_idmap();
   325  
   326  xen_early_init();
   327  efi_init();
   328  
   329  if (!efi_enabled(EFI_BOOT) && ((u64)_text % MIN_KIMG_ALIGN) != 
0)
   330   pr_warn(FW_BUG "Kernel image misaligned at boot, please 
fix your bootloader!");
   331  
   332  arm64_memblock_init();
   333  
   334  paging_init();
   335  
   336  acpi_table_upgrade();
   337  
   338  /* Parse the ACPI tables for possible boot-time configuration */
   339  acpi_boot_table_init();
   340  
   341  if (acpi_disabled)
   342  unflatten_device_tree();
   343  
   344  bootmem_init();
   345  
   346  kasan_init();
   347  
   348  request_standard_resources();
   349  
   350  early_ioremap_reset();
   351  
   352  if (acpi_disabled)
   353  psci_dt_init();
   354  else
   355  psci_acpi_init();
   356  
   357  init_bootcpu_ops();
   358  smp_init_cpus();
   359  smp_build_mpidr_hash();
   360  
   361  /* Init percpu seeds for random tags after cpus are set up. */
   362  kasan_init_tags();
   363  
   364  #ifdef CONFIG_ARM64_SW_TTBR0_PAN
   365  /*
   366   * Make sure init_thread_info.ttbr0 always generates translation
   367   * faults in case uaccess_enable() is inadvertently 

Re: [PATCH][next] docs: vmcoreinfo: add lockless printk ringbuffer vmcoreinfo

2020-08-20 Thread Petr Mladek
On Fri 2020-08-14 23:39:16, John Ogness wrote:
> With the introduction of the lockless printk ringbuffer, the
> VMCOREINFO relating to the kernel log buffer was changed. Update the
> documentation to match those changes.
> 
> Fixes: ("printk: use the lockless ringbuffer")
> Signed-off-by: John Ogness 
> Reported-by: Nick Desaulniers 

Looks nice.

Reviewed-by: Petr Mladek 

Thanks a lot for taking care of the crashdump related stuff.
It helps a lot.

Best Regards,
Petr

___
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec


Re: [patch 0/2] timekeeping: NMI safe timekeeper enhancements

2020-08-20 Thread Petr Mladek
On Thu 2020-08-20 12:30:55, Thomas Gleixner wrote:
> Petr,
> 
> On Thu, Aug 20 2020 at 10:47, Petr Mladek wrote:
> > The interface is perfectly fine for printk() needs.
> 
> Good. So I suggest that I apply that on top of rc1 somewhere in tip and
> tag the top commit. So you can pull that tag into your printk branch and
> go wild.

Sounds good to me.

Best Regards,
Petr

___
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec


Re: [patch 0/2] timekeeping: NMI safe timekeeper enhancements

2020-08-20 Thread Thomas Gleixner
Petr,

On Thu, Aug 20 2020 at 10:47, Petr Mladek wrote:
> The interface is perfectly fine for printk() needs.

Good. So I suggest that I apply that on top of rc1 somewhere in tip and
tag the top commit. So you can pull that tag into your printk branch and
go wild.

Thanks,

tglx



___
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec


Re: [patch 0/2] timekeeping: NMI safe timekeeper enhancements

2020-08-20 Thread Petr Mladek
On Fri 2020-08-14 12:19:33, Thomas Gleixner wrote:
> printk intends to store various timestamps (MONOTONIC, REALTIME, BOOTTIME)
> to make correlation of dmesg accross different machines easier.
> 
> The NMI safe timekeeper allows to retrieve these timestamps from any
> context.

For both patches:

Tested-by: Petr Mladek 

I am not familiar with the timekeeping code so that I could not
provide a valuable review. Anyway, the patches seem to work
as expected.

The interface is perfectly fine for printk() needs.


I tested them with the patch below. The first timestamps appear
as early as before:

[0.00] [0.00][1970-01-01T00:00:00][T0] kvm-clock: Using 
msrs 4b564d01 and 4b564d00
[0.00] [0.00][1970-01-01T00:00:00][T0] kvm-clock: cpu 0, 
msr 129c01001, primary cpu clock
[0.00] [0.00][1970-01-01T00:00:00][T0] kvm-clock: using 
sched offset of 56519600356309 cycles
[0.08] [0.08][1970-01-01T00:00:00][T0] clocksource: 
kvm-clock: mask: 0x max_cycles: 0x1cd42e4dffb, max_idle_ns: 
881590591483 ns
[0.22] [0.22][1970-01-01T00:00:00][T0] tsc: Detected 
2112.000 MHz processor
[0.000835] [0.000835][1970-01-01T00:00:00][T0] e820: update [mem 
0x-0x0fff] usable ==> reserved

The realtime timestamps get ready later as expected:

[0.073075] [0.073075][1970-01-01T00:00:00][T0] rcu: Adjusting 
geometry for rcu_fanout_leaf=16, nr_cpu_ids=3
[0.075847] [0.075847][1970-01-01T00:00:00][T0] NR_IRQS: 524544, 
nr_irqs: 448, preallocated irqs: 16
[0.076014] [0.076014][2020-08-20T07:58:46][T0] Console: colour 
dummy device 80x25
[0.076014] [0.076014][2020-08-20T07:58:46][T0] printk: console 
[tty0] enabled

Also suspend resume seems to work as expected. I tested it the follwing way:

echo core > /sys/power/pm_test
echo reboot > /sys/power/disk
echo disk > /sys/power/state

and the result is:

[  224.422540] [  224.422540][2020-08-20T08:02:31][ T5124] Disabling non-boot 
CPUs ...
[  224.424171] [  224.424171][2020-08-20T08:02:31][   T15] IRQ fixup: irq 21 
move in progress, old vector 36
[  224.425304] [  224.425304][2020-08-20T08:02:31][ T5124] smpboot: CPU 1 is 
now offline
[  224.426664] [  224.426664][2020-08-20T08:02:31][   T20] IRQ 21: no longer 
affine to CPU2
[  224.426685] [  224.426685][2020-08-20T08:02:31][   T20] IRQ 24: no longer 
affine to CPU2
[  224.426717] [  224.426717][2020-08-20T08:02:31][   T20] IRQ 27: no longer 
affine to CPU2
[  224.427765] [  224.427765][2020-08-20T08:02:31][ T5124] smpboot: CPU 2 is 
now offline
[  224.428016] [  224.428016][2020-08-20T08:02:31][ T5124] PM: hibernation: 
debug: Waiting for 5 seconds.
[  224.428218] [  229.618141][2020-08-20T08:02:36][ T5124] Enabling non-boot 
CPUs ...
   ^^^^^^  ^^
[  224.428560] [  229.618483][2020-08-20T08:02:36][ T5124] x86: Booting SMP 
configuration:
[  224.428564] [  229.618486][2020-08-20T08:02:36][ T5124] smpboot: Booting 
Node 0 Processor 1 APIC 0x1
[  224.428766] [  229.618688][2020-08-20T08:02:36][T0] kvm-clock: cpu 1, 
msr 129c01041, secondary cpu clock
[  224.449192] [  229.639115][2020-08-20T08:02:36][   T14] kvm-guest: 
stealtime: cpu 1, msr 17fbf2080


And here is the patch that I used for testing:

>From 39bdfebfa94fc55616fe23f2f0b80e06479b65e0 Mon Sep 17 00:00:00 2001
From: Petr Mladek 
Date: Thu, 20 Aug 2020 10:18:57 +0200
Subject: [PATCH] printk: Test using all three timestamps: mono, boot, real

Test timekeeper enhancements proposed at
https://lore.kernel.org/r/20200814101933.574326...@linutronix.de

Allow to store and show all three timestamp (mono, boot, real).

It is not final solution. The prefix takes 83 characters that might
make the real text invisible or hard to read. Fragments of seconds
are lost in when printing real time timestamp. Offset is not provided
for crashdump tools.

Only syslog interface is supported. The log can be seen on consoles
or via:

dmesg -S

Signed-off-by: Petr Mladek 
---
 kernel/printk/printk.c | 40 ++--
 1 file changed, 26 insertions(+), 14 deletions(-)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 9b75f6bfc333..329f3595b024 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -366,7 +366,7 @@ enum log_flags {
 };
 
 struct printk_log {
-   u64 ts_nsec;/* timestamp in nanoseconds */
+   struct ktime_timestamps ts; /* timestamps */
u16 len;/* length of entire record */
u16 text_len;   /* length of text buffer */
u16 dict_len;   /* length of dictionary buffer */
@@ -443,7 +443,7 @@ static u64 clear_seq;
 static u32 clear_idx;
 
 #ifdef CONFIG_PRINTK_CALLER
-#define PREFIX_MAX 48
+#define PREFIX_MAX 48+14+21
 #else
 #define PREFIX_MAX 32
 #endif
@@ -614,7 +614,7 @@ static u32 truncate_msg(u16