Re: svn commit: r322761 - in stable/11/sys/arm64: arm64 include

2017-08-22 Thread Andrew Turner

> On 22 Aug 2017, at 16:59, Li-Wen Hsu  wrote:
> 
> On Mon, Aug 21, 2017 at 17:35:04 +, John Baldwin wrote:
>> Author: jhb
>> Date: Mon Aug 21 17:35:04 2017
>> New Revision: 322761
>> URL: https://svnweb.freebsd.org/changeset/base/322761
>> 
>> Log:
>>  MFC 322437: Reliably enable debug exceptions on all CPUs.
>> 
>>  Previously, debug exceptions were only enabled on the boot CPU if
>>  DDB was enabled in the dbg_monitor_init() function.  APs also called
>>  this function, but since mp_machdep.c doesn't include opt_ddb.h, the
>>  APs ended up calling an empty stub defined in 
>>  instead of the real function.  Also, if DDB was not enabled in the kernel,
>>  the boot CPU would not enable debug exceptions.
>> 
>>  Fix this by adding a new dbg_init() function that always clears the OS
>>  lock to enable debug exceptions which the boot CPU and the APs call.
>>  This function also calls dbg_monitor_init() to enable hardware breakpoints
>>  from DDB on all CPUs if DDB is enabled.  Eventually base support for
>>  hardware breakpoints/watchpoints will need to move out of the DDB-only
>>  debug_monitor.c for use by userland debuggers.
>> 
>> Modified:
>>  stable/11/sys/arm64/arm64/debug_monitor.c
>>  stable/11/sys/arm64/arm64/machdep.c
>>  stable/11/sys/arm64/arm64/mp_machdep.c
>>  stable/11/sys/arm64/include/machdep.h
>> Directory Properties:
>>  stable/11/   (props changed)
>> 
>> Modified: stable/11/sys/arm64/arm64/mp_machdep.c
>> ==
>> --- stable/11/sys/arm64/arm64/mp_machdep.c   Mon Aug 21 17:29:37 2017
>> (r322760)
>> +++ stable/11/sys/arm64/arm64/mp_machdep.c   Mon Aug 21 17:35:04 2017
>> (r322761)
>> @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$");
>> #include 
>> #include 
>> 
>> -#include 
>> #include 
>> #include 
>> #ifdef VFP
>> @@ -277,7 +276,7 @@ init_secondary(uint64_t cpu)
>>  vfp_init();
>> #endif
>> 
>> -dbg_monitor_init();
>> +dbg_init();
>>  pan_enable();
>> 
>>  /* Enable interrupts */
>> 
> 
> Hi,
> 
> This seems breaking aarch64 build:
> 
> https://ci.freebsd.org/job/FreeBSD-stable-11-aarch64-build/1504/console 
> 
> 
> --- mp_machdep.o ---
> /usr/src/sys/arm64/arm64/mp_machdep.c:279:2: error: implicit declaration of 
> function 'dbg_init' is invalid in C99 
> [-Werror,-Wimplicit-function-declaration]
>dbg_init();
>^
> /usr/src/sys/arm64/arm64/mp_machdep.c:279:2: error: this function declaration 
> is not a prototype [-Werror,-Wstrict-prototypes]
> 2 errors generated.
> *** [mp_machdep.o] Error code 1
> 
> make[2]: stopped in /usr/obj/arm64.aarch64/usr/src/sys/GENERIC
> 
> 
> Forgot including?  Plase check, thanks!

mp_machdep.c includes machine/machdep.h in head, but not stable/11. It was 
added in a change that wasn’t (and shouldn’t be) MFCd.

Andrew

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

Re: svn commit: r322761 - in stable/11/sys/arm64: arm64 include

2017-08-22 Thread Li-Wen Hsu
On Mon, Aug 21, 2017 at 17:35:04 +, John Baldwin wrote:
> Author: jhb
> Date: Mon Aug 21 17:35:04 2017
> New Revision: 322761
> URL: https://svnweb.freebsd.org/changeset/base/322761
> 
> Log:
>   MFC 322437: Reliably enable debug exceptions on all CPUs.
>   
>   Previously, debug exceptions were only enabled on the boot CPU if
>   DDB was enabled in the dbg_monitor_init() function.  APs also called
>   this function, but since mp_machdep.c doesn't include opt_ddb.h, the
>   APs ended up calling an empty stub defined in 
>   instead of the real function.  Also, if DDB was not enabled in the kernel,
>   the boot CPU would not enable debug exceptions.
>   
>   Fix this by adding a new dbg_init() function that always clears the OS
>   lock to enable debug exceptions which the boot CPU and the APs call.
>   This function also calls dbg_monitor_init() to enable hardware breakpoints
>   from DDB on all CPUs if DDB is enabled.  Eventually base support for
>   hardware breakpoints/watchpoints will need to move out of the DDB-only
>   debug_monitor.c for use by userland debuggers.
> 
> Modified:
>   stable/11/sys/arm64/arm64/debug_monitor.c
>   stable/11/sys/arm64/arm64/machdep.c
>   stable/11/sys/arm64/arm64/mp_machdep.c
>   stable/11/sys/arm64/include/machdep.h
> Directory Properties:
>   stable/11/   (props changed)
> 
> Modified: stable/11/sys/arm64/arm64/mp_machdep.c
> ==
> --- stable/11/sys/arm64/arm64/mp_machdep.cMon Aug 21 17:29:37 2017
> (r322760)
> +++ stable/11/sys/arm64/arm64/mp_machdep.cMon Aug 21 17:35:04 2017
> (r322761)
> @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$");
>  #include 
>  #include 
>  
> -#include 
>  #include 
>  #include 
>  #ifdef VFP
> @@ -277,7 +276,7 @@ init_secondary(uint64_t cpu)
>   vfp_init();
>  #endif
>  
> - dbg_monitor_init();
> + dbg_init();
>   pan_enable();
>  
>   /* Enable interrupts */
> 

Hi,

This seems breaking aarch64 build:

https://ci.freebsd.org/job/FreeBSD-stable-11-aarch64-build/1504/console

--- mp_machdep.o ---
/usr/src/sys/arm64/arm64/mp_machdep.c:279:2: error: implicit declaration of 
function 'dbg_init' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
dbg_init();
^
/usr/src/sys/arm64/arm64/mp_machdep.c:279:2: error: this function declaration 
is not a prototype [-Werror,-Wstrict-prototypes]
2 errors generated.
*** [mp_machdep.o] Error code 1

make[2]: stopped in /usr/obj/arm64.aarch64/usr/src/sys/GENERIC


Forgot including?  Plase check, thanks!

Best,
Li-Wen

-- 
Li-Wen Hsu 
https://lwhsu.org
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r322761 - in stable/11/sys/arm64: arm64 include

2017-08-21 Thread John Baldwin
Author: jhb
Date: Mon Aug 21 17:35:04 2017
New Revision: 322761
URL: https://svnweb.freebsd.org/changeset/base/322761

Log:
  MFC 322437: Reliably enable debug exceptions on all CPUs.
  
  Previously, debug exceptions were only enabled on the boot CPU if
  DDB was enabled in the dbg_monitor_init() function.  APs also called
  this function, but since mp_machdep.c doesn't include opt_ddb.h, the
  APs ended up calling an empty stub defined in 
  instead of the real function.  Also, if DDB was not enabled in the kernel,
  the boot CPU would not enable debug exceptions.
  
  Fix this by adding a new dbg_init() function that always clears the OS
  lock to enable debug exceptions which the boot CPU and the APs call.
  This function also calls dbg_monitor_init() to enable hardware breakpoints
  from DDB on all CPUs if DDB is enabled.  Eventually base support for
  hardware breakpoints/watchpoints will need to move out of the DDB-only
  debug_monitor.c for use by userland debuggers.

Modified:
  stable/11/sys/arm64/arm64/debug_monitor.c
  stable/11/sys/arm64/arm64/machdep.c
  stable/11/sys/arm64/arm64/mp_machdep.c
  stable/11/sys/arm64/include/machdep.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm64/arm64/debug_monitor.c
==
--- stable/11/sys/arm64/arm64/debug_monitor.c   Mon Aug 21 17:29:37 2017
(r322760)
+++ stable/11/sys/arm64/arm64/debug_monitor.c   Mon Aug 21 17:35:04 2017
(r322761)
@@ -453,15 +453,12 @@ dbg_monitor_init(void)
 {
u_int i;
 
-   /* Clear OS lock */
-   WRITE_SPECIALREG(OSLAR_EL1, 0);
-
/* Find out many breakpoints and watchpoints we can use */
dbg_watchpoint_num = ((READ_SPECIALREG(ID_AA64DFR0_EL1) >> 20) & 0xf) + 
1;
dbg_breakpoint_num = ((READ_SPECIALREG(ID_AA64DFR0_EL1) >> 12) & 0xf) + 
1;
 
if (bootverbose && PCPU_GET(cpuid) == 0) {
-   db_printf("%d watchpoints and %d breakpoints supported\n",
+   printf("%d watchpoints and %d breakpoints supported\n",
dbg_watchpoint_num, dbg_breakpoint_num);
}
 

Modified: stable/11/sys/arm64/arm64/machdep.c
==
--- stable/11/sys/arm64/arm64/machdep.c Mon Aug 21 17:29:37 2017
(r322760)
+++ stable/11/sys/arm64/arm64/machdep.c Mon Aug 21 17:35:04 2017
(r322761)
@@ -970,11 +970,24 @@ initarm(struct arm64_bootparams *abp)
mutex_init();
init_param2(physmem);
 
-   dbg_monitor_init();
+   dbg_init();
kdb_init();
pan_enable();
 
early_boot = 0;
+}
+
+void
+dbg_init(void)
+{
+
+   /* Clear OS lock */
+   WRITE_SPECIALREG(OSLAR_EL1, 0);
+
+   /* This permits DDB to use debug registers for watchpoints. */
+   dbg_monitor_init();
+
+   /* TODO: Eventually will need to initialize debug registers here. */
 }
 
 #ifdef DDB

Modified: stable/11/sys/arm64/arm64/mp_machdep.c
==
--- stable/11/sys/arm64/arm64/mp_machdep.c  Mon Aug 21 17:29:37 2017
(r322760)
+++ stable/11/sys/arm64/arm64/mp_machdep.c  Mon Aug 21 17:35:04 2017
(r322761)
@@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
 #include 
 #include 
 #ifdef VFP
@@ -277,7 +276,7 @@ init_secondary(uint64_t cpu)
vfp_init();
 #endif
 
-   dbg_monitor_init();
+   dbg_init();
pan_enable();
 
/* Enable interrupts */

Modified: stable/11/sys/arm64/include/machdep.h
==
--- stable/11/sys/arm64/include/machdep.h   Mon Aug 21 17:29:37 2017
(r322760)
+++ stable/11/sys/arm64/include/machdep.h   Mon Aug 21 17:35:04 2017
(r322761)
@@ -40,6 +40,7 @@ struct arm64_bootparams {
 extern vm_paddr_t physmap[];
 extern u_int physmap_idx;
 
+void dbg_init(void);
 void initarm(struct arm64_bootparams *);
 extern void (*pagezero)(void *);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"