Re: Kernel crash before login prompt

Sha Faisal <[email protected]>
Newsgroups gmane.os.freebsd.devel.arm
Message-ID <BYAPR05MB6677D1BF2C336E91D1DAFEABB72AA@BYAPR05MB6677.namprd05.prod.outlook.com>
Hello Andrew,
Below is the disas of sched_pickcpu()


/b/sfaisal/stable_main/src/sys/kern/sched_ule.c:

1325    {

   0xffff000000223724 <+0>:     sub     sp, sp, #0x90

   0xffff000000223728 <+4>:     stp     x29, x30, [sp, #48]

   0xffff00000022372c <+8>:     stp     x28, x27, [sp, #64]

   0xffff000000223730 <+12>:    stp     x26, x25, [sp, #80]

   0xffff000000223734 <+16>:    stp     x24, x23, [sp, #96]

   0xffff000000223738 <+20>:    stp     x22, x21, [sp, #112]

   0xffff00000022373c <+24>:    stp     x20, x19, [sp, #128]

   0xffff000000223740 <+28>:    add     x29, sp, #0x30



1326            struct cpu_group *cg, *ccg;

1327            struct td_sched *ts;

1328            struct tdq *tdq;

1329            cpuset_t *mask;

1330            int cpu, pri, r, self, intr;

1331

1332            self = PCPU_GET(cpuid);

   0xffff000000223744 <+32>:    ldr     w19, [x18, #60]

   0xffff000000223748 <+36>:    mov     w21, w1

   0xffff00000022374c <+40>:    mov     x20, x0



Also, below is the show allpcpu log


db> show allpcpu
Current CPU: 0

cpuid        = 0
dynamic pcpu = 0x2886100
curthread    = 0xffff0000008166a0: pid 0 tid 100000 critnest 1 "swapper"
curpcb       = 0xffff00000068bb40
fpcurthread  = none
idlethread   = 0xffff000041b82000: tid 100003 "idle: cpu0"
spin locks held:

cpuid        = 1
dynamic pcpu = 0x41393300
curthread    = none
curpcb       = 0
fpcurthread  = none
idlethread   = 0xffff000041b81880: tid 100004 "idle: cpu1"
spin locks held:

cpuid        = 2
dynamic pcpu = 0x4139e300
curthread    = none
curpcb       = 0
fpcurthread  = none
idlethread   = 0xffff000041b81260: tid 100005 "idle: cpu2"
spin locks held:

cpuid        = 3
dynamic pcpu = 0x413a9300
curthread    = none
curpcb       = 0
fpcurthread  = none
idlethread   = 0xffff000041b80c40: tid 100006 "idle: cpu3"
spin locks held:



Regards

Faisal




Juniper Business Use Only

From: [email protected] <[email protected]>
Date: Friday, 30 June 2023 at 16:26
To: Mahesh Vardhamanaiah <[email protected]>
Cc: Sha Faisal <[email protected]>, [email protected] <[email protected]>, Steve Kiernan <[email protected]>, Amit Verma <[email protected]>
Subject: Re: Kernel crash before login prompt
[External Email. Be cautious of content]


On 2023-06-30 10:48, Mahesh Vardhamanaiah wrote:
> Hi Andrew,
>
> We are observing that self is getting -65536 at line 1329 in
> sched_pickcpu() before panic.

What is the disassembly around reading the cpuid? It looks like it is
getting 0xffff0000 when it should be zero.

>
> From the code flow
>
> sched_add [1](struct thread [2] *td [3], int flags [4])->
> sched_pickcpu()->PCPU_GET
>
> as below
>
> static int
>
>  1321 [5] sched_pickcpu [6](struct thread [2] *td [3], int flags [4])
>
>  1322 [7] {
>
>  1323 [8]         struct cpu_group [9] *cg [10], *ccg;
>
>  1324 [11]         struct td_sched [12] *ts [13];
>
>  1325 [14]         struct tdq [15] *tdq [15];
>
>  1326 [16]         cpuset_t [17] *mask [18];
>
>  1327 [19]         int cpu [20], pri, r [21], self [22], intr;
>
>  1328 [23]
>
>  1329 [24]         self [22] = PCPU_GET [25](cpuid [26]);
>
> PCPU_GET is defined differently in Freebsd14 compared to Freebsd12 but
> I am  unable to dump the pcpup in db> prompt is it proper ?
>
> Is it expected to be a global ?

You can print all pcpu structs with "show allpcpu".

Andrew
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.