linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: opal-msglog: Report size of memcons log
@ 2017-01-13  3:53 Joel Stanley
  2017-01-23  8:32 ` Michael Ellerman
  2017-01-27  0:40 ` Michael Ellerman
  0 siblings, 2 replies; 5+ messages in thread
From: Joel Stanley @ 2017-01-13  3:53 UTC (permalink / raw)
  To: benh, mpe; +Cc: linuxppc-dev, jk

The OPAL memory console is reported to be size zero, as we do not
initialise the struct attr with any size information due to the size
being variable. This leads users to think that the console is empty.

Instead report the maximum size.

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 arch/powerpc/platforms/powernv/opal-msglog.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/powerpc/platforms/powernv/opal-msglog.c b/arch/powerpc/platforms/powernv/opal-msglog.c
index 39d6ff9e5630..8486b2ceb510 100644
--- a/arch/powerpc/platforms/powernv/opal-msglog.c
+++ b/arch/powerpc/platforms/powernv/opal-msglog.c
@@ -123,6 +123,10 @@ void __init opal_msglog_init(void)
 		return;
 	}
 
+	/* Report maximum size */
+	opal_msglog_attr.size =  be64_to_cpu(mc->ibuf_size) +
+		be64_to_cpu(mc->obuf_size);
+
 	opal_memcons = mc;
 }
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] powerpc: opal-msglog: Report size of memcons log
  2017-01-13  3:53 [PATCH] powerpc: opal-msglog: Report size of memcons log Joel Stanley
@ 2017-01-23  8:32 ` Michael Ellerman
  2017-01-25  2:33   ` Michael Ellerman
  2017-01-27  0:40 ` Michael Ellerman
  1 sibling, 1 reply; 5+ messages in thread
From: Michael Ellerman @ 2017-01-23  8:32 UTC (permalink / raw)
  To: Joel Stanley, benh; +Cc: linuxppc-dev, jk

Joel Stanley <joel@jms.id.au> writes:

> The OPAL memory console is reported to be size zero, as we do not
> initialise the struct attr with any size information due to the size
> being variable. This leads users to think that the console is empty.

Hmm OK. That is a general property of /proc and /sys files that are
dynamically generated, so users probably need to get used to it :)

> Instead report the maximum size.

But OK. That sounds sane enough. My only worry is that it might confuse
some tools, ie. the file claims to be x bytes but is actually smaller.
But I guess that can actually happen anyway with any file.

So I'll merge this and stop blabbing :)

cheers

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] powerpc: opal-msglog: Report size of memcons log
  2017-01-23  8:32 ` Michael Ellerman
@ 2017-01-25  2:33   ` Michael Ellerman
  2017-01-25  8:50     ` Joel Stanley
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Ellerman @ 2017-01-25  2:33 UTC (permalink / raw)
  To: Joel Stanley, benh; +Cc: linuxppc-dev, jk

Michael Ellerman <mpe@ellerman.id.au> writes:

> Joel Stanley <joel@jms.id.au> writes:
>
>> The OPAL memory console is reported to be size zero, as we do not
>> initialise the struct attr with any size information due to the size
>> being variable. This leads users to think that the console is empty.
>
> Hmm OK. That is a general property of /proc and /sys files that are
> dynamically generated, so users probably need to get used to it :)
>
>> Instead report the maximum size.
>
> But OK. That sounds sane enough. My only worry is that it might confuse
> some tools, ie. the file claims to be x bytes but is actually smaller.
> But I guess that can actually happen anyway with any file.
>
> So I'll merge this and stop blabbing :)

Hmm, but then I get:

  $ ls -la msglog 
  -r--r--r-- 1 root root 4503599627370496 Jan 25 13:09 msglog

I know firmware likes to spit out lots of messages, but 4PB seems a bit
large :P

I fixed it with the patch below which I'll fold in, resulting in:

  $ ls -la msglog 
  -r--r--r-- 1 root root 1048576 Jan 25 13:30 msglog


Which seems more likely.

cheers

diff --git a/arch/powerpc/platforms/powernv/opal-msglog.c b/arch/powerpc/platforms/powernv/opal-msglog.c
index 8486b2ceb510..7a9cde0cfbd1 100644
--- a/arch/powerpc/platforms/powernv/opal-msglog.c
+++ b/arch/powerpc/platforms/powernv/opal-msglog.c
@@ -124,8 +124,8 @@ void __init opal_msglog_init(void)
 	}
 
 	/* Report maximum size */
-	opal_msglog_attr.size =  be64_to_cpu(mc->ibuf_size) +
-		be64_to_cpu(mc->obuf_size);
+	opal_msglog_attr.size =  be32_to_cpu(mc->ibuf_size) +
+		be32_to_cpu(mc->obuf_size);
 
 	opal_memcons = mc;
 }

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] powerpc: opal-msglog: Report size of memcons log
  2017-01-25  2:33   ` Michael Ellerman
@ 2017-01-25  8:50     ` Joel Stanley
  0 siblings, 0 replies; 5+ messages in thread
From: Joel Stanley @ 2017-01-25  8:50 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: Benjamin Herrenschmidt, linuxppc-dev, Jeremy Kerr

On Wed, Jan 25, 2017 at 1:33 PM, Michael Ellerman <mpe@ellerman.id.au> wrote:
> Michael Ellerman <mpe@ellerman.id.au> writes:
>
>> Joel Stanley <joel@jms.id.au> writes:
>>
>>> The OPAL memory console is reported to be size zero, as we do not
>>> initialise the struct attr with any size information due to the size
>>> being variable. This leads users to think that the console is empty.
>>
>> Hmm OK. That is a general property of /proc and /sys files that are
>> dynamically generated, so users probably need to get used to it :)
>>
>>> Instead report the maximum size.
>>
>> But OK. That sounds sane enough. My only worry is that it might confuse
>> some tools, ie. the file claims to be x bytes but is actually smaller.
>> But I guess that can actually happen anyway with any file.
>>
>> So I'll merge this and stop blabbing :)
>
> Hmm, but then I get:
>
>   $ ls -la msglog
>   -r--r--r-- 1 root root 4503599627370496 Jan 25 13:09 msglog
>
> I know firmware likes to spit out lots of messages, but 4PB seems a bit
> large :P
>
> I fixed it with the patch below which I'll fold in, resulting in:
>
>   $ ls -la msglog
>   -r--r--r-- 1 root root 1048576 Jan 25 13:30 msglog
>
>
> Which seems more likely.

My bad. In my excitement I forgot to mention that this was just an
idea, and I had not boot tested it.

Thanks for testing it and finding the bug.

Cheers,

Joel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: powerpc: opal-msglog: Report size of memcons log
  2017-01-13  3:53 [PATCH] powerpc: opal-msglog: Report size of memcons log Joel Stanley
  2017-01-23  8:32 ` Michael Ellerman
@ 2017-01-27  0:40 ` Michael Ellerman
  1 sibling, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2017-01-27  0:40 UTC (permalink / raw)
  To: Joel Stanley, benh; +Cc: linuxppc-dev, jk

On Fri, 2017-01-13 at 03:53:49 UTC, Joel Stanley wrote:
> The OPAL memory console is reported to be size zero, as we do not
> initialise the struct attr with any size information due to the size
> being variable. This leads users to think that the console is empty.
> 
> Instead report the maximum size.
> 
> Signed-off-by: Joel Stanley <joel@jms.id.au>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/14a41d6b7572026cf8fc88ee72e81b

cheers

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-01-27  0:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-13  3:53 [PATCH] powerpc: opal-msglog: Report size of memcons log Joel Stanley
2017-01-23  8:32 ` Michael Ellerman
2017-01-25  2:33   ` Michael Ellerman
2017-01-25  8:50     ` Joel Stanley
2017-01-27  0:40 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).