Re: GENERIC-NODEBUG panics, GENERIC does not

2016-04-15 Thread Konstantin Belousov
On Fri, Apr 15, 2016 at 05:11:54PM +0300, Vladimir Zakharov wrote:
> On Fri, Apr 15, 2016, Konstantin Belousov wrote:
> > On Fri, Apr 15, 2016 at 02:38:18PM +0300, Vladimir Zakharov wrote:
> > > On Fri, Apr 15, 2016, Konstantin Belousov wrote:
> > > > On Fri, Apr 15, 2016 at 01:26:44PM +0300, Vladimir Zakharov wrote:
> > > > > Hello
> > > > > 
> > > > > Setting 'kern.eventtimer.periodic = 1' in /etc/sysctl.conf leads to
> > > > > GENERIC-NODEBUG panic. GENERIC loads without problems.
> > > > > So do GENERIC-NODEBUG as of r297245.
> > > > > 
> > > > > https://imgur.com/0DtDU3m
> > > > > 
> > > > > $ uname -a
> > > > > 
> > > > > FreeBSD vzakharov 11.0-CURRENT FreeBSD 11.0-CURRENT #4 r298037: Fri 
> > > > > Apr
> > > > > 15 12:27:40 MSK 2016 
> > > > > root@vzakharov:/home/obj/usr/src/sys/GENERIC-NODEBUG  amd64
> > > > > 
> > > > 
> > > > I cannot reproduce it locally.
> > > > Please provide me verbose dmesg from the successfull boot on your 
> > > > machine.
> > > 
> > > GENERIC with kern.eventtimer.periodic=1: http://pastebin.com/raw/TB0TKSje
> > > GENERIC-NODEBUG: http://pastebin.com/raw/05CchraS
> > I need _verbose_ dmesg.  I need the reports about LAPICs initializations,
> > with register dumps.
> 
> dmesg before patching (kern.eventtimer.periodic is not set to avoid
> panic):
> http://pastebin.com/raw/CnJ911gX
> 
> dmesg for patched kernel (kern.eventtimer.periodic = 1):
> http://pastebin.com/raw/9Azz9LxT
Thanks.

> 
> > 
> > > 
> > > > Also, for the panic, show me the output of the same data as on the
> > > > screenshot and the output of 'show registers'.
> > > 
> > > https://imgur.com/pO8Yc3w
> > Ok, this seems to be yet another case of missed count mode divisor
> > initialization. Please try the patch at the end of the messasge.
> 
> Patched kernel doesn't panic anymore. Thanks.
Committed as r298056.

> 
> > > > Also please load your kernel into kgdb and do
> > > > list *lapic_et_start+0x281
> > By 'your kernel' I mean 'your panicing kernel'.
> It _was_ panicing kernel. Than not sure what you meant. There is no any
> dump/core files because dumpdev is not configured yet at the moment of
> panic. What should I do to retrieve the required information?
> I've simply run: $ kgdb /boot/kernel/kernel

No, core is not needed, only kernel to translate faulted address into
the source line.  The translation that you show did not make sense.
The registers value was more useful.
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: GENERIC-NODEBUG panics, GENERIC does not

2016-04-15 Thread Vladimir Zakharov
On Fri, Apr 15, 2016, Konstantin Belousov wrote:
> On Fri, Apr 15, 2016 at 02:38:18PM +0300, Vladimir Zakharov wrote:
> > On Fri, Apr 15, 2016, Konstantin Belousov wrote:
> > > On Fri, Apr 15, 2016 at 01:26:44PM +0300, Vladimir Zakharov wrote:
> > > > Hello
> > > > 
> > > > Setting 'kern.eventtimer.periodic = 1' in /etc/sysctl.conf leads to
> > > > GENERIC-NODEBUG panic. GENERIC loads without problems.
> > > > So do GENERIC-NODEBUG as of r297245.
> > > > 
> > > > https://imgur.com/0DtDU3m
> > > > 
> > > > $ uname -a
> > > > 
> > > > FreeBSD vzakharov 11.0-CURRENT FreeBSD 11.0-CURRENT #4 r298037: Fri Apr
> > > > 15 12:27:40 MSK 2016 
> > > > root@vzakharov:/home/obj/usr/src/sys/GENERIC-NODEBUG  amd64
> > > > 
> > > 
> > > I cannot reproduce it locally.
> > > Please provide me verbose dmesg from the successfull boot on your machine.
> > 
> > GENERIC with kern.eventtimer.periodic=1: http://pastebin.com/raw/TB0TKSje
> > GENERIC-NODEBUG: http://pastebin.com/raw/05CchraS
> I need _verbose_ dmesg.  I need the reports about LAPICs initializations,
> with register dumps.

dmesg before patching (kern.eventtimer.periodic is not set to avoid
panic):
http://pastebin.com/raw/CnJ911gX

dmesg for patched kernel (kern.eventtimer.periodic = 1):
http://pastebin.com/raw/9Azz9LxT

> 
> > 
> > > Also, for the panic, show me the output of the same data as on the
> > > screenshot and the output of 'show registers'.
> > 
> > https://imgur.com/pO8Yc3w
> Ok, this seems to be yet another case of missed count mode divisor
> initialization. Please try the patch at the end of the messasge.

Patched kernel doesn't panic anymore. Thanks.

> > > Also please load your kernel into kgdb and do
> > > list *lapic_et_start+0x281
> By 'your kernel' I mean 'your panicing kernel'.
It _was_ panicing kernel. Than not sure what you meant. There is no any
dump/core files because dumpdev is not configured yet at the moment of
panic. What should I do to retrieve the required information?
I've simply run: $ kgdb /boot/kernel/kernel

-- 
Regards, | "In theory there is no difference between theory
  Vladimir Zakharov  | and practice. In practice there is."- Yogi Berra
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: GENERIC-NODEBUG panics, GENERIC does not

2016-04-15 Thread Konstantin Belousov
On Fri, Apr 15, 2016 at 02:38:18PM +0300, Vladimir Zakharov wrote:
> On Fri, Apr 15, 2016, Konstantin Belousov wrote:
> > On Fri, Apr 15, 2016 at 01:26:44PM +0300, Vladimir Zakharov wrote:
> > > Hello
> > > 
> > > Setting 'kern.eventtimer.periodic = 1' in /etc/sysctl.conf leads to
> > > GENERIC-NODEBUG panic. GENERIC loads without problems.
> > > So do GENERIC-NODEBUG as of r297245.
> > > 
> > > https://imgur.com/0DtDU3m
> > > 
> > > $ uname -a
> > > 
> > > FreeBSD vzakharov 11.0-CURRENT FreeBSD 11.0-CURRENT #4 r298037: Fri Apr
> > > 15 12:27:40 MSK 2016 root@vzakharov:/home/obj/usr/src/sys/GENERIC-NODEBUG 
> > >  amd64
> > > 
> > 
> > I cannot reproduce it locally.
> > Please provide me verbose dmesg from the successfull boot on your machine.
> 
> GENERIC with kern.eventtimer.periodic=1: http://pastebin.com/raw/TB0TKSje
> GENERIC-NODEBUG: http://pastebin.com/raw/05CchraS
I need _verbose_ dmesg.  I need the reports about LAPICs initializations,
with register dumps.

> 
> > Also, for the panic, show me the output of the same data as on the
> > screenshot and the output of 'show registers'.
> 
> https://imgur.com/pO8Yc3w
Ok, this seems to be yet another case of missed count mode divisor
initialization. Please try the patch at the end of the messasge.

> 
> > Also please load your kernel into kgdb and do
> > list *lapic_et_start+0x281
By 'your kernel' I mean 'your panicing kernel'.


diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c
index 5830b77..854bda4 100644
--- a/sys/x86/x86/local_apic.c
+++ b/sys/x86/x86/local_apic.c
@@ -170,7 +170,7 @@ vm_paddr_t lapic_paddr;
 int x2apic_mode;
 int lapic_eoi_suppression;
 static int lapic_timer_tsc_deadline;
-static u_long lapic_timer_divisor;
+static u_long lapic_timer_divisor, count_freq;
 static struct eventtimer lapic_et;
 #ifdef SMP
 static uint64_t lapic_ipi_wait_mult;
@@ -814,20 +814,46 @@ lapic_calibrate_initcount(struct eventtimer *et, struct 
lapic *la)
printf("lapic: Divisor %lu, Frequency %lu Hz\n",
lapic_timer_divisor, value);
}
-   et->et_frequency = value;
+   count_freq = value;
 }
 
 static void
 lapic_calibrate_deadline(struct eventtimer *et, struct lapic *la __unused)
 {
 
-   et->et_frequency = tsc_freq;
if (bootverbose) {
printf("lapic: deadline tsc mode, Frequency %ju Hz\n",
-   (uintmax_t)et->et_frequency);
+   (uintmax_t)tsc_freq);
}
 }
 
+static void
+lapic_change_mode(struct eventtimer *et, struct lapic *la,
+enum lat_timer_mode newmode)
+{
+
+   if (la->la_timer_mode == newmode)
+   return;
+   switch (newmode) {
+   case LAT_MODE_PERIODIC:
+   lapic_timer_set_divisor(lapic_timer_divisor);
+   et->et_frequency = count_freq;
+   break;
+   case LAT_MODE_DEADLINE:
+   et->et_frequency = tsc_freq;
+   break;
+   case LAT_MODE_ONESHOT:
+   lapic_timer_set_divisor(lapic_timer_divisor);
+   et->et_frequency = count_freq;
+   break;
+   default:
+   panic("lapic_change_mode %d", newmode);
+   }
+   la->la_timer_mode = newmode;
+   et->et_min_period = (0x0002LLU << 32) / et->et_frequency;
+   et->et_max_period = (0xfffeLLU << 32) / et->et_frequency;
+}
+
 static int
 lapic_et_start(struct eventtimer *et, sbintime_t first, sbintime_t period)
 {
@@ -835,28 +861,21 @@ lapic_et_start(struct eventtimer *et, sbintime_t first, 
sbintime_t period)
 
la = &lapics[PCPU_GET(apic_id)];
if (et->et_frequency == 0) {
+   lapic_calibrate_initcount(et, la);
if (lapic_timer_tsc_deadline)
lapic_calibrate_deadline(et, la);
-   else
-   lapic_calibrate_initcount(et, la);
-   et->et_min_period = (0x0002LLU << 32) / et->et_frequency;
-   et->et_max_period = (0xfffeLLU << 32) / et->et_frequency;
}
if (period != 0) {
-   if (la->la_timer_mode == LAT_MODE_UNDEF)
-   lapic_timer_set_divisor(lapic_timer_divisor);
-   la->la_timer_mode = LAT_MODE_PERIODIC;
+   lapic_change_mode(et, la, LAT_MODE_PERIODIC);
la->la_timer_period = ((uint32_t)et->et_frequency * period) >>
32;
lapic_timer_periodic(la);
} else if (lapic_timer_tsc_deadline) {
-   la->la_timer_mode = LAT_MODE_DEADLINE;
+   lapic_change_mode(et, la, LAT_MODE_DEADLINE);
la->la_timer_period = (et->et_frequency * first) >> 32;
lapic_timer_deadline(la);
} else {
-   if (la->la_timer_mode == LAT_MODE_UNDEF)
-   lapic_timer_set_divisor(lapic_timer_divisor);
-   la->la_timer_mode = LAT_MODE_ONESHOT;
+   lapic_change_mode(et, la, LAT_MODE_ONESHOT);
   

Re: GENERIC-NODEBUG panics, GENERIC does not

2016-04-15 Thread Vladimir Zakharov
On Fri, Apr 15, 2016, Vladimir Zakharov wrote:
> $ kgdb /boot/kernel/kernel
> GNU gdb 6.1.1 [FreeBSD]
> Copyright 2004 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for details.
> This GDB was configured as "amd64-marcel-freebsd"...
> (kgdb) list *lapic_et_start+0x281
> 0x81099411 is in lapic_et_start (cpufunc.h:408).
> 403 cpufunc.h: No such file or directory.
> in cpufunc.h

The same for GENERIC:
$ kgdb /boot/kernel.GENERIC/kernel
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...
(kgdb) list *lapic_et_start+0x281
0x80fdd3b1 is in lapic_et_start (/usr/src/sys/x86/x86/local_apic.c:846).
841 lapic_calibrate_initcount(et, la);
842 et->et_min_period = (0x0002LLU << 32) / 
et->et_frequency;
843 et->et_max_period = (0xfffeLLU << 32) / 
et->et_frequency;
844 }
845 if (period != 0) {
846 if (la->la_timer_mode == LAT_MODE_UNDEF)
847 lapic_timer_set_divisor(lapic_timer_divisor);
848 la->la_timer_mode = LAT_MODE_PERIODIC;
849 la->la_timer_period = ((uint32_t)et->et_frequency * 
period) >>
850 32;
(kgdb)

-- 
Regards, | "In theory there is no difference between theory
  Vladimir Zakharov  | and practice. In practice there is."- Yogi Berra
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: GENERIC-NODEBUG panics, GENERIC does not

2016-04-15 Thread Vladimir Zakharov
On Fri, Apr 15, 2016, Konstantin Belousov wrote:
> On Fri, Apr 15, 2016 at 01:26:44PM +0300, Vladimir Zakharov wrote:
> > Hello
> > 
> > Setting 'kern.eventtimer.periodic = 1' in /etc/sysctl.conf leads to
> > GENERIC-NODEBUG panic. GENERIC loads without problems.
> > So do GENERIC-NODEBUG as of r297245.
> > 
> > https://imgur.com/0DtDU3m
> > 
> > $ uname -a
> > 
> > FreeBSD vzakharov 11.0-CURRENT FreeBSD 11.0-CURRENT #4 r298037: Fri Apr
> > 15 12:27:40 MSK 2016 root@vzakharov:/home/obj/usr/src/sys/GENERIC-NODEBUG  
> > amd64
> > 
> 
> I cannot reproduce it locally.
> Please provide me verbose dmesg from the successfull boot on your machine.

GENERIC with kern.eventtimer.periodic=1: http://pastebin.com/raw/TB0TKSje
GENERIC-NODEBUG: http://pastebin.com/raw/05CchraS

> Also, for the panic, show me the output of the same data as on the
> screenshot and the output of 'show registers'.

https://imgur.com/pO8Yc3w

> Also please load your kernel into kgdb and do
> list *lapic_et_start+0x281

$ kgdb /boot/kernel/kernel
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...
(kgdb) list *lapic_et_start+0x281
0x81099411 is in lapic_et_start (cpufunc.h:408).
403 cpufunc.h: No such file or directory.
in cpufunc.h
(kgdb) list *lapic_et_start
0x81099190 is in lapic_et_start (/usr/src/sys/x86/x86/local_apic.c:833).
828 }
829 }
830
831 static int
832 lapic_et_start(struct eventtimer *et, sbintime_t first, sbintime_t 
period)
833 {
834 struct lapic *la;
835
836 la = &lapics[PCPU_GET(apic_id)];
837 if (et->et_frequency == 0) {
(kgdb)

PS. I've started building kernel with clean OBJDIR and with ccache disabled.

-- 
Regards, | "In theory there is no difference between theory
  Vladimir Zakharov  | and practice. In practice there is."- Yogi Berra
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: GENERIC-NODEBUG panics, GENERIC does not

2016-04-15 Thread Konstantin Belousov
On Fri, Apr 15, 2016 at 01:26:44PM +0300, Vladimir Zakharov wrote:
> Hello
> 
> Setting 'kern.eventtimer.periodic = 1' in /etc/sysctl.conf leads to
> GENERIC-NODEBUG panic. GENERIC loads without problems.
> So do GENERIC-NODEBUG as of r297245.
> 
> https://imgur.com/0DtDU3m
> 
> $ uname -a
> 
> FreeBSD vzakharov 11.0-CURRENT FreeBSD 11.0-CURRENT #4 r298037: Fri Apr
> 15 12:27:40 MSK 2016 root@vzakharov:/home/obj/usr/src/sys/GENERIC-NODEBUG  
> amd64
> 

I cannot reproduce it locally.
Please provide me verbose dmesg from the successfull boot on your machine.
Also, for the panic, show me the output of the same data as on the
screenshot and the output of 'show registers'.
Also please load your kernel into kgdb and do
list *lapic_et_start+0x281

___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


GENERIC-NODEBUG panics, GENERIC does not

2016-04-15 Thread Vladimir Zakharov
Hello

Setting 'kern.eventtimer.periodic = 1' in /etc/sysctl.conf leads to
GENERIC-NODEBUG panic. GENERIC loads without problems.
So do GENERIC-NODEBUG as of r297245.

https://imgur.com/0DtDU3m

$ uname -a

FreeBSD vzakharov 11.0-CURRENT FreeBSD 11.0-CURRENT #4 r298037: Fri Apr
15 12:27:40 MSK 2016 root@vzakharov:/home/obj/usr/src/sys/GENERIC-NODEBUG  amd64


-- 
Regards, | "In theory there is no difference between theory
  Vladimir Zakharov  | and practice. In practice there is."- Yogi Berra
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"