From owner-freebsd-hackers@freebsd.org Sat Apr 21 20:30:13 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70CD7FA0C11 for ; Sat, 21 Apr 2018 20:30:13 +0000 (UTC) (envelope-from 01000162e9e66234-e005d59e-2896-436a-aab1-a3d7b3a74610-000000@amazonses.com) Received: from a8-237.smtp-out.amazonses.com (a8-237.smtp-out.amazonses.com [54.240.8.237]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0BB286B7F2 for ; Sat, 21 Apr 2018 20:30:13 +0000 (UTC) (envelope-from 01000162e9e66234-e005d59e-2896-436a-aab1-a3d7b3a74610-000000@amazonses.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=dqtolf56kk3wpt62c3jnwboqvr7iedax; d=tarsnap.com; t=1524342612; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=Z68i2lxBzOF1Xj/M08L69CzPkMgbj9mV/oJP7LdYCOQ=; b=U7C46HD3zx2pbRqv8l8a2YBkwr6FcM5kXBNxkD1+I/xPJwu39i3fJImkqz23MJgz iLhR8mpG0Mdk1PM/6fA0HiXplPZloCvxoK+th0tnkp05jRH1VjMjTXl6aWQqWkQcpAs 0bvhKIilNfjVNVoQ3os15M2ZKJMHlsvsy5G6jOBg= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug; d=amazonses.com; t=1524342612; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding:Feedback-ID; bh=Z68i2lxBzOF1Xj/M08L69CzPkMgbj9mV/oJP7LdYCOQ=; b=Bji2RNTklJQ2/MJkwqpUtTCedIeZ7xntqGz7BJyIylC8JLlnk09RWD/mL2+MopGO PF7/GnNSxuXueK5VBksvyuaC2FzGguCnTYjU+zkj9+AfXDwJBikAfj8LAxZUveXgFYC NJoHSFmHhRSxOh52ZyGXFqSpKwLMxyK/8Ij3YcSI= Subject: Re: RFC: Hiding per-CPU kernel output behind bootverbose To: Warner Losh , gljennjohn@gmail.com Cc: Konstantin Belousov , "freebsd-hackers@freebsd.org" , Conrad Meyer References: <01000162df15f856-1e5d2641-2a72-4250-8d8e-adcd47bc5db4-000000@email.amazonses.com> <20180419204405.GE6887@kib.kiev.ua> <20180419214550.GF6887@kib.kiev.ua> <01000162e58a466e-98f0305b-1723-467a-bc49-342c3fa9fc5b-000000@email.amazonses.com> <20180421092049.GM6887@kib.kiev.ua> <20180421123544.56d7e690@ernst.home> From: Colin Percival Openpgp: preference=signencrypt Autocrypt: addr=cperciva@tarsnap.com; prefer-encrypt=mutual; keydata= xsDhBElrAAcRBACDfDys4ZtK+ErCJ1HAzYeteKpm3OEsvT/49AjUTLihkF79HhIKrCQU+1KC zv7BwHCMLb6hq30As9L7iFKG7n5QFLFC4Te/VcITUnWHMG/c3ViLOfJGvi+9/nOEHaM1dVJY D6tEp5yM1nHmVQpo9932j4KGuGFR0LhOK5IHXOSfGwCgxSFDPdgxe2OEjWxjGgY+oV3EafcD +JROXCTjlcQiG/OguQH4Vks3mhHfFnEppLxTkDuYgHZQiUtpcT9ssH5khgqoTyMar05OUdAj ZIhNbWDh4LgTj+7ZmvLhXT5Zxw8LX9d7T36aTB8XDQSenDqEtinMWOb0TCBBLbsB8EFG1WTT ESbZci9jJS5yhtktuZoY/eM8uXMD/3k4FWFO80VRRkELSp+XSy/VlSQjyi/rhl2nQq/oOA9F oJbDaB0yq9VNhxP+uFBzBWSqeIX0t1ZWLtNfVFr4TRP5hihI5ICrg/0OpqgisKsU2NFe9xyO hyJLYmfD8ebpDJ/9k30C7Iju9pVrwLm1QgS4S2fqJRcR+U4WbjvP7CgSzSVDb2xpbiBQZXJj aXZhbCA8Y3BlcmNpdmFAdGFyc25hcC5jb20+wmEEExECACEFAklrALYCGwMHCwkIBwMCAQQV AggDBBYCAwECHgECF4AACgkQOM7KaQxqam6/igCgn+z2k3V5ggNppmWrZstt1U2lugsAoL7L wS9V9yLtil3oWmHtwpUqYruEzsFNBElrAAcQCAD3ZLMIsP4CIDoJORg+YY0lqLVBgcnF7pFb 4Uy2+KvdWofN+DKH61rZLjgXXkNE9M4EQC1B4lGttBP8IY2gs41y3AUogGdyFbidq99rCBz7 LTsgARHwFxZoaHmXyiZLEU1QZuMqwPZV1mCviRhN5E3rRqYNXVcrnXAAuhBpvNyj/ntHvcDN 2/m+ochiuBYueU4kX3lHya7sOj+mTsndcWmQ9soOUyr8O0r/BG088bMn4qqtUw4dl5/pglXk jbl7uOOPinKf0WVd2r6M0wLPJCD4NPHrCWRLLLAjwfjrtoSRvXxDbXhCdgGBa72+K8eYLzVs hgq7tJOoBWzjVK6XRxR7AAMGB/9Mo3iJ2DxqDecd02KCB5BsFDICbJGhPltU7FwrtbC7djSb XUrwsEVLHi4st4cbdGNCWCrp0BRezXZKohKnNAPFOTK++ZfgeKxrV2sJod+Q9RILF86tQ4XF 7A7Yme5hy92t/WgiU4vc/fWbgP8gV/19f8nunaT2E9NSa70mZFjZNu4iuwThoUUO5CV3Wo0Y UISsnRK8XD1+LR3A2qVyLiFRwh/miC1hgLFCTGCQ3GLxZeZzIpYSlGdQJ0L5lixW5ZQD9r1I 8i/8zhE6qRFAM0upUMI3Gt1Oq2w03DiXrZU0Fu/R8Rm8rlnkQKA+95mRTUq1xL5P5NZIi4gJ Z569OPMFwkkEGBECAAkFAklrAAcCGwwACgkQOM7KaQxqam41igCfbaldnFTu5uAdrnrghESv EI3CAo8AoLkNMks1pThl2BJNRm4CtTK9xZeH Message-ID: <01000162e9e66234-e005d59e-2896-436a-aab1-a3d7b3a74610-000000@email.amazonses.com> Date: Sat, 21 Apr 2018 20:30:12 +0000 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-SES-Outgoing: 2018.04.21-54.240.8.237 Feedback-ID: 1.us-east-1.Lv9FVjaNvvR5llaqfLoOVbo2VxOELl7cjN0AOyXnPlk=:AmazonSES X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Apr 2018 20:30:13 -0000 On 04/21/18 12:52, Warner Losh wrote: > On Sat, 21 Apr 2018 12:20:49 +0300 > Konstantin Belousov > wrote: > > On Sat, Apr 21, 2018 at 12:11:07AM +0000, Colin Percival wrote: > > > Would it be sufficient for debugging purposes if I change the !bootverbose > > > case from printing many lines of > > > > > > SMP: AP CPU #N Launched! > > > > > > to instead have a single > > > > > > SMP: Launching AP CPUs: 86 73 111 21 8 77 100 28 57 42 10 60 87 [...] > > > > > > ?  (With each AP printing its number as it reaches the appropriate point?) > > I am fine with the behaviour, but I am not sure how would you implement > > this.  printf(9) buffers the output, you need to flush it somehow. > > I don't think either of these is true (the double buffered part,. nor the > buffered part). Well, they are both kinda true, but they don't matter. It's > all to make dmesg and friends work. There's other issues, but at this stage of > the boot we're single threaded and the CPUs that are launching take out a spin > lock. I just checked (by adding a 500 ms delay after each CPU prints its ID) and I can definitely see the individual numbers being printed on the console. > diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c > index 3fcf7aa25152..06973b1ea6d5 100644 > --- a/sys/x86/x86/mp_x86.c > +++ b/sys/x86/x86/mp_x86.c > @@ -1020,7 +1020,7 @@ init_secondary_tail(void) >         smp_cpus++; > >         CTR1(KTR_SMP, "SMP: AP CPU #%d Launched", cpuid); > -       printf("SMP: AP CPU #%d Launched!\n", cpuid); > +       printf("%d%s", cpuid, smp_cpus == mp_ncpus ? "\n" : " "); > >         /* Determine if we are a logical CPU. */ >         if (cpu_info[PCPU_GET(apic_id)].cpu_hyperthread) > > is enough to give them all to me on a single line. We'd need another printf > that says 'Starting APs: ' since otherwise we see: > > andom: unblocking device. > ioapic0 irqs 0-23 on motherboard > ioapic1 irqs 24-47 on motherboard > 1 8 10 20 2 19 11 12 22 4 14 23 16 13 3 18 5 17 21 9 15 6 7 > Timecounter "TSC-low" frequency 1350029824 Hz quality 1000 > > which doesn't make a lot of sense. > > Comments? Here's the patch I have, which prints a header before the CPU IDs: Index: sys/x86/x86/mp_x86.c =================================================================== --- sys/x86/x86/mp_x86.c (revision 332638) +++ sys/x86/x86/mp_x86.c (working copy) @@ -1020,7 +1020,9 @@ smp_cpus++; CTR1(KTR_SMP, "SMP: AP CPU #%d Launched", cpuid); - printf("SMP: AP CPU #%d Launched!\n", cpuid); + printf(" %d", cpuid); + if (smp_cpus == mp_ncpus) + printf("\n"); /* Determine if we are a logical CPU. */ if (cpu_info[PCPU_GET(apic_id)].cpu_hyperthread) @@ -1508,6 +1510,7 @@ if (mp_ncpus == 1) return; + printf("SMP: Launching AP CPUs:"); atomic_store_rel_int(&aps_ready, 1); while (smp_started == 0) ia32_pause(); -- Colin Percival Security Officer Emeritus, FreeBSD | The power to serve Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid