Re: [PATCH] MIPS: Loongson: Make default kernel log buffer size as 128KB for Loongson3

From: Tiezhu Yang
Date: Tue Oct 15 2019 - 22:23:57 EST


On 10/16/2019 02:53 AM, Paul Burton wrote:
Hi Tiezhu & Huacai,

On Tue, Oct 15, 2019 at 12:00:25PM +0800, Tiezhu Yang wrote:
On 10/15/2019 11:36 AM, Huacai Chen wrote:
On Tue, Oct 15, 2019 at 10:12 AM Tiezhu Yang <yangtiezhu@xxxxxxxxxxx> wrote:
When I update kernel with loongson3_defconfig based on the Loongson 3A3000
platform, then using dmesg command to show kernel ring buffer, the initial
kernel messages have disappeared due to the log buffer is too small, it is
better to change the default kernel log buffer size from 16KB to 128KB.

Signed-off-by: Tiezhu Yang <yangtiezhu@xxxxxxxxxxx>
---
arch/mips/configs/loongson3_defconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/configs/loongson3_defconfig b/arch/mips/configs/loongson3_defconfig
index 90ee008..3aa2201 100644
--- a/arch/mips/configs/loongson3_defconfig
+++ b/arch/mips/configs/loongson3_defconfig
@@ -12,7 +12,7 @@ CONFIG_TASKSTATS=y
CONFIG_TASK_DELAY_ACCT=y
CONFIG_TASK_XACCT=y
CONFIG_TASK_IO_ACCOUNTING=y
-CONFIG_LOG_BUF_SHIFT=14
+CONFIG_LOG_BUF_SHIFT=17
Hi, Tiezhu,

Why you choose 128KB but not 64KB or 256KB? I found 64KB is enough for
our cases. And if you really need more, I think 256KB could be better
because there are many platforms choose 256KB.
Hi Huacai,

Thanks for your reply and suggestion, I will send a v2 patch.
Thanks for the patches.

I actually have a slight preference for 128KB if you've no specific
need, since 128KB is the default. Some quick grepping says that of 405
defconfigs in tree (as of v5.4-rc3), we have:

LOG_BUF_SHIFT Count
12 1
13 3
14 235
15 18
16 39
17 90
18 13
19 2
20 4

ie. 16KiB is by far the most common, then second most common is the
default 128KiB. 256KiB is comparatively rare.

Hi Paul,

Thank you very much for your detailed explanation. I think 128KB is enough to save
the boot messages because the dmesg output size is about 40KB after reboot in my
system.


However, I don't think your v1 patch is quite right Tiezhu - since 17 is
the default it shouldn't be specified in the defconfig at all. Did you
manually make the change in the loongson3_defconfig file? If so please
take a look at the savedefconfig make target & try something like this:

make ARCH=mips loongson3_defconfig
make ARCH=mips menuconfig
# Change LOG_BUF_SHIFT
make ARCH=mips savedefconfig
mv defconfig arch/mips/configs/loongson3_defconfig
git add -i arch/mips/configs/loongson3_defconfig
# Stage the relevant changes, drop the others

You should end up with the CONFIG_LOG_BUF_SHIFT line just getting
deleted.

Yes, you are right, I will make a new patch followed with your steps and send a v3
patch: just delete the CONFIG_LOG_BUF_SHIFT line to use the default value 128KB and
update the commit message.


If on the other hand you really do prefer 256KiB for these systems
please describe why in the commit message. It could be something as
simple as "we have lots of memory so using 256KiB isn't a big deal, and
gives us a better chance of preserving boot messages until they're
examined". But if your log is getting this big before you look at it (or
before something like systemd copies it into its journal), there's
probably something fishy going on.

Hi Huacai,

What do you think? If you have any more suggestion, please let me know.

Thanks,

Tiezhu Yang


Thanks,
Paul