Skip to contentSkip to conversation

where is __percpu_seg initialized?

DISCUSSION 落痕 2 participants 3 messages Apr 23, 2016 – Mar 28, 2018

lore
Share & tools
lore

落痕

author
#0 lore raw

Hi all:
I knew the kernel implement the per-cpu variable via __percpu_seg. For example on x86 architecture, it's defined as:

#ifdef CONFIG_X86_64
#define __percpu_seg gs
#define __percpu_mov_op movq
#else
#define __percpu_seg fs
#define __percpu_mov_op movl
#endif

But I'm curious where __percpu_seg is initialized?? I fail to find the relative code. Thanks. -------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160423/2c2d99ff/attachment.html

#1 lore raw

load_percpu_segment, which is called by switch_to_new_gdt in setup_per_cpu_areas.

-daveti

Quoted 18 lines · ??

Hi all:
I knew the kernel implement the per-cpu variable via __percpu_seg. For example on x86 architecture, it's defined as:

#ifdef CONFIG_X86_64
#define __percpu_seg gs
#define __percpu_mov_op movq
#else
#define __percpu_seg fs
#define __percpu_mov_op movl
#endif

But I'm curious where __percpu_seg is initialized?? I fail to find the relative code. Thanks.
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

author
#2 lore raw

setup_per_cpu_areas just prepare a per-cpu area for each possible cpu, and it doesn't try to start up other possible cpu(s).

The address of a per-cpu area corresponding to this cpu will be written to its per-cpu-area register , before starting up.

Starting up other non-boot cpu happens in start_secondary function.

Larry

------------------ Original ------------------

From:  "Dave Tian"<[email protected]>;
Date:  Sat, Apr 23, 2016 10:02 PM
To:  "??"<[email protected]>;

Cc: "kernelnewbies"<[email protected]>;
Subject: Re: where is __percpu_seg initialized?

load_percpu_segment, which is called by switch_to_new_gdt in setup_per_cpu_areas.

-daveti

Quoted 13 lines · ??

Hi all:
I knew the kernel implement the per-cpu variable via __percpu_seg. For example on x86 architecture, it's defined as:

#ifdef CONFIG_X86_64
#define __percpu_seg gs
#define __percpu_mov_op movq
#else
#define __percpu_seg fs
#define __percpu_mov_op movl
#endif

Quoted 5 lines

But I'm curious where __percpu_seg is initialized?? I fail to find the relative code. Thanks.
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20180328/af86be6a/attachment.html>