From: Tony Luck <tony.luck@intel.com>
To: Borislav Petkov <bp@alien8.de>,
"Luck, Tony" <tony.luck@intel.com>,
linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
tglx@linutronix.de, mingo@elte.hu, greg@kroah.com, akpm@l
Subject: Re: [RFC] persistent store (version 3) (part 1 of 2)
Date: Wed, 8 Dec 2010 09:12:21 -0800 [thread overview]
Message-ID: <AANLkTin7xDWO8fU2WA7cxC55TNi2+kAb50ajCySCfg9G@mail.gmail.com> (raw)
In-Reply-To: <20101208062433.GB29751@liondog.tnic>
On Tue, Dec 7, 2010 at 10:24 PM, Borislav Petkov <bp@alien8.de> wrote:
> looks good. Minor nitpicks below.
Thanks for looking at this.
>> 1) Is "struct file" too big to be on the stack? I can change it to kmalloc() it.
>
> Well, this happens during normal operation when we init the pstore and
> since we don't need it after pstore_mkwrite has returned (do we?), I
> guess we should be fine.
struct file is 184 bytes (with the CONFIG options I am using, it can get
a bit larger, but not much).
>> + the dying moments. In the case of a panic() the last part
>
> "panic" (I'd remove the
> brackets)
Ok. Will do.
>> + dentry = d_alloc_name(root, name);
>> + if (!IS_ERR(dentry))
>> + d_add(dentry, inode);
>
> what happens if it IS_ERR? Error handling like
>
> goto d_alloc_error;
>
> d_alloc_error:
> iput(inode);
> return -ENOSPC;
>
>
> or similar, at least this is what ramfs seems to be doing.
Good point - I need to clean up if things fail (and akpm would
like to see me re-factor so that there is only one "return"
statement for better maintainabiliy). I'll fix up stuff here.
>> + kmsg_dump_register(&pstore_dumper);
>
> You don't check psi->write() method's existence anymore, I'm assuming
> this is implied now... ?
Andrew's comments on version 2 were:
>It doesn't seem appropriate to check this here. It's a programming
>error! Just install the thing and let the kernel oops - the programmer
>will notice.
So I dropped the tests ... just checking whether the function pointer
was NULL wasn't a very strong test anyway.
>> + if (!psinfo)
>> + return -ENODEV;
>
> newline.
OK.
>> +#define PSTOREFS_MAGIC 0x6165676C
>
> what does that mean anyway? "aegl" :)
My initials: Anthony Eric George Luck. I've been using "aegl"
as my Unix login since 1979 (6th Edition on a pdp11/34).
>> +/* types */
>> +#define PSTORE_TYPE_DMESG 0
>> +#define PSTORE_TYPE_MCE 1
>
> You could make this into a proper enum
>
> enum pstore_type_id {
> PSTORE_TYPE_DMESG = 0,
> PSTORE_TYPE_MCE = 1,
> PSTORE_TYPE_MAX,
> };
OK. Type checking is nice. I think I might need a
PSTORE_TYPE_UNKNOWN to handle the case
where a new platform driver saves a record to
persistent store, and then the user boots an older
kernel that doesn't know about the new type (in
the APEI/ERST driver the type turns into a UUID
in the UEFI header for the record - so there is some
mapping going on at that level).
>> +struct pstore_info {
>> + struct module *owner;
>> + char *name;
>> + struct mutex mutex; /* serialize access to 'buf' */
>
> [ maybe a more descriptive variable name like buf_mutex or whatever ]
Sure. Will change.
>> +#if defined(CONFIG_PSTORE) || defined(CONFIG_PSTORE_MODULE)
>
> What is CONFIG_PSTORE_MODULE? Can't seem to find it in your (2 of 2)
> message either.
This is a remnant of when PSTORE was tristate - when I chose 'm'
rather than 'y' in "make menuconfig" I ended up with CONFIG_PSTORE_MODULE
rather than CONFIG_PSTORE. But now it is just a "bool" this isn't
needed any more. Will fix.
-Tony
WARNING: multiple messages have this Message-ID (diff)
From: Tony Luck <tony.luck@intel.com>
To: Borislav Petkov <bp@alien8.de>,
"Luck, Tony" <tony.luck@intel.com>,
linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
tglx@linutronix.de, mingo@elte.hu, greg@kroah.com,
akpm@linux-foundation.org, ying.huang@intel.com,
David Miller <davem@davemloft.net>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
Jim Keniston <jkenisto@linux.vnet.ibm.com>,
Kyungmin Park <kmpark@infradead.org>,
Geert Uytterhoeven <geert@linux-m68k.org>
Subject: Re: [RFC] persistent store (version 3) (part 1 of 2)
Date: Wed, 8 Dec 2010 09:12:21 -0800 [thread overview]
Message-ID: <AANLkTin7xDWO8fU2WA7cxC55TNi2+kAb50ajCySCfg9G@mail.gmail.com> (raw)
Message-ID: <20101208171221.S3dJLUgJ0pq6c01wwOypfh-vwYf6nOtGbDIK32iA3nA@z> (raw)
In-Reply-To: <20101208062433.GB29751@liondog.tnic>
On Tue, Dec 7, 2010 at 10:24 PM, Borislav Petkov <bp@alien8.de> wrote:
> looks good. Minor nitpicks below.
Thanks for looking at this.
>> 1) Is "struct file" too big to be on the stack? I can change it to kmalloc() it.
>
> Well, this happens during normal operation when we init the pstore and
> since we don't need it after pstore_mkwrite has returned (do we?), I
> guess we should be fine.
struct file is 184 bytes (with the CONFIG options I am using, it can get
a bit larger, but not much).
>> + the dying moments. In the case of a panic() the last part
>
> "panic" (I'd remove the
> brackets)
Ok. Will do.
>> + dentry = d_alloc_name(root, name);
>> + if (!IS_ERR(dentry))
>> + d_add(dentry, inode);
>
> what happens if it IS_ERR? Error handling like
>
> goto d_alloc_error;
>
> d_alloc_error:
> iput(inode);
> return -ENOSPC;
>
>
> or similar, at least this is what ramfs seems to be doing.
Good point - I need to clean up if things fail (and akpm would
like to see me re-factor so that there is only one "return"
statement for better maintainabiliy). I'll fix up stuff here.
>> + kmsg_dump_register(&pstore_dumper);
>
> You don't check psi->write() method's existence anymore, I'm assuming
> this is implied now... ?
Andrew's comments on version 2 were:
>It doesn't seem appropriate to check this here. It's a programming
>error! Just install the thing and let the kernel oops - the programmer
>will notice.
So I dropped the tests ... just checking whether the function pointer
was NULL wasn't a very strong test anyway.
>> + if (!psinfo)
>> + return -ENODEV;
>
> newline.
OK.
>> +#define PSTOREFS_MAGIC 0x6165676C
>
> what does that mean anyway? "aegl" :)
My initials: Anthony Eric George Luck. I've been using "aegl"
as my Unix login since 1979 (6th Edition on a pdp11/34).
>> +/* types */
>> +#define PSTORE_TYPE_DMESG 0
>> +#define PSTORE_TYPE_MCE 1
>
> You could make this into a proper enum
>
> enum pstore_type_id {
> PSTORE_TYPE_DMESG = 0,
> PSTORE_TYPE_MCE = 1,
> PSTORE_TYPE_MAX,
> };
OK. Type checking is nice. I think I might need a
PSTORE_TYPE_UNKNOWN to handle the case
where a new platform driver saves a record to
persistent store, and then the user boots an older
kernel that doesn't know about the new type (in
the APEI/ERST driver the type turns into a UUID
in the UEFI header for the record - so there is some
mapping going on at that level).
>> +struct pstore_info {
>> + struct module *owner;
>> + char *name;
>> + struct mutex mutex; /* serialize access to 'buf' */
>
> [ maybe a more descriptive variable name like buf_mutex or whatever ]
Sure. Will change.
>> +#if defined(CONFIG_PSTORE) || defined(CONFIG_PSTORE_MODULE)
>
> What is CONFIG_PSTORE_MODULE? Can't seem to find it in your (2 of 2)
> message either.
This is a remnant of when PSTORE was tristate - when I chose 'm'
rather than 'y' in "make menuconfig" I ended up with CONFIG_PSTORE_MODULE
rather than CONFIG_PSTORE. But now it is just a "bool" this isn't
needed any more. Will fix.
-Tony
next prev parent reply other threads:[~2010-12-08 17:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-06 18:29 [RFC] persistent store (version 3) (part 1 of 2) Luck, Tony
2010-12-06 18:29 ` Luck, Tony
2010-12-08 6:24 ` Borislav Petkov
2010-12-08 17:12 ` Tony Luck [this message]
2010-12-08 17:12 ` Tony Luck
2010-12-08 23:35 ` Luck, Tony
2010-12-09 13:14 ` Borislav Petkov
2010-12-09 18:23 ` Tony Luck
2010-12-09 18:23 ` Tony Luck
2010-12-09 19:12 ` Luck, Tony
2010-12-09 20:47 ` Borislav Petkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AANLkTin7xDWO8fU2WA7cxC55TNi2+kAb50ajCySCfg9G@mail.gmail.com \
--to=tony.luck@intel.com \
--cc=akpm@l \
--cc=bp@alien8.de \
--cc=greg@kroah.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).