File tree Expand file tree Collapse file tree 3 files changed +13
-7
lines changed
Expand file tree Collapse file tree 3 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -58,3 +58,10 @@ percpu_t *get_percpu_page(unsigned int cpu) {
5858 list_add (& percpu -> list , & percpu_frames );
5959 return percpu ;
6060}
61+
62+ void for_each_percpu (void (* func )(percpu_t * percpu )) {
63+ percpu_t * percpu ;
64+
65+ list_for_each_entry (percpu , & percpu_frames , list )
66+ func (percpu );
67+ }
Original file line number Diff line number Diff line change @@ -125,5 +125,6 @@ typedef struct percpu percpu_t;
125125
126126extern void init_percpu (void );
127127extern percpu_t * get_percpu_page (unsigned int cpu );
128+ extern void for_each_percpu (void (* func )(percpu_t * percpu ));
128129
129130#endif /* KTF_PERCPU_H */
Original file line number Diff line number Diff line change @@ -63,18 +63,17 @@ void __noreturn ap_startup(void) {
6363 UNREACHABLE ();
6464}
6565
66- static __text_init void boot_cpu (unsigned int cpu ) {
67- percpu_t * percpu = get_percpu_page (cpu );
66+ static __text_init void boot_cpu (percpu_t * percpu ) {
6867 apic_icr_t icr ;
6968
7069 if (percpu -> bsp )
7170 return ;
7271
73- ap_cpuid = cpu ;
72+ ap_cpuid = percpu -> cpu_id ;
7473 ap_callin = false;
7574 smp_wmb ();
7675
77- dprintk ("Starting AP: %u\n" , cpu );
76+ dprintk ("Starting AP: %u\n" , percpu -> cpu_id );
7877
7978 memset (& icr , 0 , sizeof (icr ));
8079 apic_icr_set_dest (& icr , percpu -> apic_id );
@@ -97,7 +96,7 @@ static __text_init void boot_cpu(unsigned int cpu) {
9796 while (!ap_callin )
9897 cpu_relax ();
9998
100- dprintk ("AP: %u Done \n" , cpu );
99+ dprintk ("AP: %u Done \n" , percpu -> cpu_id );
101100}
102101
103102void __text_init init_smp (void ) {
@@ -113,8 +112,7 @@ void __text_init init_smp(void) {
113112 printk ("Initializing SMP support (CPUs: %u)\n" , nr_cpus );
114113 ap_cr3 = cr3 ;
115114
116- for (unsigned int i = 0 ; i < nr_cpus ; i ++ )
117- boot_cpu (i );
115+ for_each_percpu (boot_cpu );
118116}
119117
120118unsigned get_nr_cpus (void ) { return nr_cpus ; }
You can’t perform that action at this time.
0 commit comments