Re: [OT] Argument with an OS professor over profile=3
On 10/10/07, David Newall <[EMAIL PROTECTED]> wrote: > Russ Dill wrote: > > I've been having a back and forth going for a while with my TA and OS > > professor on the meaning of profile=3 and have been unable to convince > > either of them. The basic question is if profile=3 is passed to kernel > > with an 8MB text section, how big is the allocated profile buffer. His > > answer is 1MB > > > > if (prof_shift) { > > unsigned int size; > > /* only text is profiled */ > > prof_len = (unsigned *) &_etext - (unsigned *) &_stext; > > > You stipulated 8MB text, but this calculates in unsigned ints, so > prof_len = 2M. Please have a look at my followup, I accidentally sent out code that I had used to produce an answer as my prof thought it works. The actual code casts to (unsigned long). Sigh, I've shot myself in the foot... Anyway, the book (and the class covers 2.4.1) and the associated code has since moved from init/main.c. Here's how the 2.4.1ish code looks: http://tldp.org/HOWTO/Linux-i386-Boot-Code-HOWTO/init_main.html - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [OT] Argument with an OS professor over profile=3
Russ Dill wrote: I've been having a back and forth going for a while with my TA and OS professor on the meaning of profile=3 and have been unable to convince either of them. The basic question is if profile=3 is passed to kernel with an 8MB text section, how big is the allocated profile buffer. His answer is 1MB if (prof_shift) { unsigned int size; /* only text is profiled */ prof_len = (unsigned *) &_etext - (unsigned *) &_stext; You stipulated 8MB text, but this calculates in unsigned ints, so prof_len = 2M. prof_len >>= prof_shift; This gives 250K (divide by 8). size = prof_len * sizeof(unsigned int) + PAGE_SIZE-1; Finally, size is 1MB (250K x 4). prof_buffer = (unsigned int *) alloc_bootmem(size); } I'm with your Prof. Perhaps you missed that prof_len counts integers, not bytes. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [OT] Argument with an OS professor over profile=3
On Oct 11 2007 00:13, Russ Dill wrote: > >/* only text is profiled */ >> prof_len = (unsigned *) &_etext - (unsigned *) &_stext; Uh, that's some evil pointer arithmetic :) - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [OT] Argument with an OS professor over profile=3
/* only text is profiled */ > prof_len = (unsigned *) &_etext - (unsigned *) &_stext; Crap, sorry, accidentally sent a version I had laying around demonstrating how one *would* get the answer he expects. The correct line is of course: prof_len = (unsigned long) &_etext - (unsigned long) &_stext; - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [OT] Argument with an OS professor over profile=3
On Oct 11 2007 00:13, Russ Dill wrote: /* only text is profiled */ prof_len = (unsigned *) _etext - (unsigned *) _stext; Uh, that's some evil pointer arithmetic :) - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [OT] Argument with an OS professor over profile=3
/* only text is profiled */ prof_len = (unsigned *) _etext - (unsigned *) _stext; Crap, sorry, accidentally sent a version I had laying around demonstrating how one *would* get the answer he expects. The correct line is of course: prof_len = (unsigned long) _etext - (unsigned long) _stext; - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [OT] Argument with an OS professor over profile=3
On 10/10/07, David Newall [EMAIL PROTECTED] wrote: Russ Dill wrote: I've been having a back and forth going for a while with my TA and OS professor on the meaning of profile=3 and have been unable to convince either of them. The basic question is if profile=3 is passed to kernel with an 8MB text section, how big is the allocated profile buffer. His answer is 1MB if (prof_shift) { unsigned int size; /* only text is profiled */ prof_len = (unsigned *) _etext - (unsigned *) _stext; You stipulated 8MB text, but this calculates in unsigned ints, so prof_len = 2M. Please have a look at my followup, I accidentally sent out code that I had used to produce an answer as my prof thought it works. The actual code casts to (unsigned long). Sigh, I've shot myself in the foot... Anyway, the book (and the class covers 2.4.1) and the associated code has since moved from init/main.c. Here's how the 2.4.1ish code looks: http://tldp.org/HOWTO/Linux-i386-Boot-Code-HOWTO/init_main.html - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [OT] Argument with an OS professor over profile=3
Russ Dill wrote: I've been having a back and forth going for a while with my TA and OS professor on the meaning of profile=3 and have been unable to convince either of them. The basic question is if profile=3 is passed to kernel with an 8MB text section, how big is the allocated profile buffer. His answer is 1MB if (prof_shift) { unsigned int size; /* only text is profiled */ prof_len = (unsigned *) _etext - (unsigned *) _stext; You stipulated 8MB text, but this calculates in unsigned ints, so prof_len = 2M. prof_len = prof_shift; This gives 250K (divide by 8). size = prof_len * sizeof(unsigned int) + PAGE_SIZE-1; Finally, size is 1MB (250K x 4). prof_buffer = (unsigned int *) alloc_bootmem(size); } I'm with your Prof. Perhaps you missed that prof_len counts integers, not bytes. - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/