Hey Kevin! 😀
Yes, I tried with offsetof(), it was hell.
I am adding these to asm-offsets.c, so that we can use pcpui_coreid in
there.

EMIT_OFFSET(pcpui_stacktop, struct per_cpu_info, stacktop);
EMIT_OFFSET(pcpui_coreid, struct per_cpu_info, coreid);



On Mon, Dec 7, 2015 at 6:18 PM, Kevin Klues <[email protected]> wrote:

> The only reason it exists at all is because of .h file dependency
> hell.  We would just use the struct directly if we could get the
> header file included.
>
> On Mon, Dec 7, 2015 at 6:16 PM, 'Davide Libenzi' via Akaros
> <[email protected]> wrote:
> > As side note, given that here we are in C-land, that gs:8 hard-coding
> could
> > be turned into reading the proper offset.
> > I see a comment on include loops there, but once the gen offsets is in
> > place, the offsets are going to be inside an include file which has no
> > dependency at all, so we can turn that 8 into a proper defined offset.
> >
> >
> > On Mon, Dec 7, 2015 at 5:49 PM, Davide Libenzi <[email protected]>
> wrote:
> >>
> >> After *a whole lot* of fun with Gan (his Akaros box reset button melted
> >> basically), we traced the stuck issue to calls to core_id() which
> access the
> >> GS:8 address when it has not been setup.
> >> Strange that Gan changes triggered this, and that before was working
> fine.
> >>
> >>
> >>
> https://github.com/brho/akaros/compare/master...dlibenzi:use_core_id_early
> >>
> >>
> >> The following changes since commit
> >> 2fa42319139e4cc5ca853546363f84443d0ead00:
> >>
> >>   Rename 'reallocarray' to 'kreallocarray'. (2015-11-25 18:02:04 -0500)
> >>
> >> are available in the git repository at:
> >>
> >>   [email protected]:dlibenzi/akaros use_core_id_early
> >>
> >> for you to fetch changes up to a2c903e3f58df5d0bcffa6a2f64b1c8a207a1040:
> >>
> >>   Use core_id_early() in kprof trace buffer print code (2015-12-07
> >> 17:42:25 -0800)
> >>
> >> ----------------------------------------------------------------
> >> Davide Libenzi (1):
> >>       Use core_id_early() in kprof trace buffer print code
> >>
> >>  kern/drivers/dev/kprof.c | 4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/kern/drivers/dev/kprof.c b/kern/drivers/dev/kprof.c
> >> index ed16bda..db2739f 100644
> >> --- a/kern/drivers/dev/kprof.c
> >> +++ b/kern/drivers/dev/kprof.c
> >> @@ -574,7 +574,7 @@ static struct trace_printk_buffer
> >> *kprof_get_printk_buffer(void)
> >>   spin_unlock_irqsave(&ktrace_lock);
> >>   }
> >>
> >> - return cpu_tpbs + core_id();
> >> + return cpu_tpbs + core_id_early();
> >>  }
> >>
> >>  void trace_vprintk(bool btrace, const char *fmt, va_list args)
> >> @@ -619,7 +619,7 @@ void trace_vprintk(bool btrace, const char *fmt,
> >> va_list args)
> >>   if (likely(system_timing.tsc_freq))
> >>   tsc2timespec(read_tsc(), &ts_now);
> >>   snprintf(hdr, sizeof(hdr), "[%lu.%09lu]:cpu%d: ", ts_now.tv_sec,
> >> - ts_now.tv_nsec, core_id());
> >> + ts_now.tv_nsec, core_id_early());
> >>
> >>   pb.ptr = usrbuf + vsnprintf(usrbuf, usr_bufsz, fmt, args);
> >>   pb.top = usrbuf + usr_bufsz;
> >>
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Akaros" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to [email protected].
> > To post to this group, send email to [email protected].
> > For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> ~Kevin
>
> --
> You received this message because you are subscribed to the Google Groups
> "Akaros" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Akaros" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to