Kernel output interleaved on boot

deeptech71 deeptech71 at gmail.com
Mon Apr 8 08:39:11 UTC 2013


On 04/07/2013 23:20, Andreas Nilsson wrote:
> On Sun, Apr 7, 2013 at 9:36 PM, deeptech71 <deeptech71 at gmail.com <mailto:deeptech71 at gmail.com>> wrote:
>        options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed.
>
> And here I thought that it was added to mitigate the "interspersed output" problem, and I remember that adding to the conf on previous version help address the problem.

And you were right. AFAICT, the problem was that the threads were writing single characters ("putc()ing") at a time, and would get preempted by other such threads in between. Thus, such tasks would get interleaved at character granularity. Proposals were:
   (a) use a stack array in printf()'s body to do line buffering; some argued that kernel stack sizes are fairly limited, others argued that this should not be a limitation even on embedded platforms;
   (b) allow a printf() task to fully finish before allowing other printf() tasks to start.
The (a) solution was chosen, with an amendment that the array would be specifiable by a kernel configuration option. GENERIC kernels have "options PRINTF_BUFR_SIZE=128".

If the original poster had removed the PRINTF_BUFR_SIZE option from his kernel configuration, then I see his complaint as invalid.


More information about the freebsd-current mailing list