Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Bernhard Walle <bwalle@suse.de>
To: Greg KH <gregkh@suse.de>
Cc: x86@kernel.org, kexec@lists.infradead.org,
	linux-kernel@vger.kernel.org, vgoyal@redhat.com,
	yhlu.kernel@gmail.com
Subject: Re: [PATCH 1/2] Add /sys/firmware/memmap
Date: Fri, 27 Jun 2008 13:08:57 +0200	[thread overview]
Message-ID: <20080627130857.6d543a75@halley.suse.de> (raw)
In-Reply-To: <20080626222458.GA18981@suse.de>

Hi,

* Greg KH [2008-06-26 15:24]:
>
> On Thu, Jun 26, 2008 at 10:19:01PM +0200, Bernhard Walle wrote:
> > This patch adds /sys/firmware/memmap interface that represents the BIOS
> > (or Firmware) provided memory map. The tree looks like:
> > 
> >     /sys/firmware/memmap/0/start   (hex number)
> >                            end     (hex number)
> >                            type    (string)
> >     ...                 /1/start
> >                            end
> >                            type
> 
> Please provide new entries in Documentation/ABI/ for these new sysfs
> files with all of this information.

Yes, I planned that but wanted to get feedback first. It's in the next
resend.

> > +/*
> > + * Firmware memory map entries
> > + */
> > +LIST_HEAD(map_entries);
> 
> Should this be static?

Yes, thanks.

> > +int firmware_map_add(resource_size_t start, resource_size_t end,
> > +		     const char *type)
> > +{
> > +	struct firmware_map_entry *entry;
> > +
> > +	entry = kmalloc(sizeof(struct firmware_map_entry), GFP_ATOMIC);
> > +	WARN_ON(!entry);
> > +	if (!entry)
> > +		return -ENOMEM;
> > +
> > +	return firmware_map_add_entry(start, end, type, entry);
> 
> Where is the kobject initialized properly?
> 
> Ah, later on, that's scary...

Ok, I moved initialisation to firmware_map_add_entry() and add it later
with kobject_add().

> > +static struct kobj_type memmap_ktype = {
> > +	.sysfs_ops	= &memmap_attr_ops,
> > +	.default_attrs	= def_attrs,
> > +};
> 
> Do you really need your own kobj_type here?  What you want is just a
> directory, and some attributes assigned to the kobject, can't you use
> the default kobject attributes for them?
> 
> I'm not saying this is incorrect, it looks implemented properly, just
> curious.

Well, since there are more than one directory with the same attributes,
isn't using kobj_type easier here?

> > +static int __init memmap_init(void)
> > +{
> > +	int i = 0;
> > +	struct firmware_map_entry *entry;
> > +	struct kset *memmap_kset;
> > +
> > +	memmap_kset = kset_create_and_add("memmap", NULL, firmware_kobj);
> > +	WARN_ON(!memmap_kset);
> > +	if (!memmap_kset)
> > +		return -ENOMEM;
> > +
> > +	list_for_each_entry(entry, &map_entries, list) {
> 
> So the list is supposed to be set up before this function is called?  Is
> that because of early boot issues?
> 
> You should document this somehow.

Yes, added a comment to firmware_map_add_early(), firmware_map_add()
and before memmap_init().

> > +/*
> > + * Firmware map entry. Because firmware memory maps are flat and not
> > + * hierarchical, it's ok to organise them in a linked list. No parent
> > + * information is necessary as for the resource tree.
> > + */
> > +struct firmware_map_entry {
> > +	resource_size_t		start;	/* start of the memory range */
> > +	resource_size_t		end;	/* end of the memory range (incl.) */
> > +	const char		*type;	/* type of the memory range */
> > +	struct list_head	list;	/* entry for the linked list */
> > +	struct kobject		kobj;   /* kobject for each entry */
> > +};
> 
> Does this really need to be in the .h file?

No, that was because I modified the API afterwards. Thanks for spotting
that.



Bernhard
-- 
Bernhard Walle, SUSE LINUX Products GmbH, Architecture Development

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  reply	other threads:[~2008-06-27 11:08 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-26 20:19 x86: Add /sys/firmware/memmap Bernhard Walle
2008-06-26 20:19 ` [PATCH 1/2] " Bernhard Walle
2008-06-26 20:45   ` Vivek Goyal
2008-06-26 22:24   ` Greg KH
2008-06-27 11:08     ` Bernhard Walle [this message]
2008-06-26 20:19 ` [PATCH 2/2] Use FIRMWARE_MEMMAP on x86/E820 Bernhard Walle
2008-06-26 20:54   ` Yinghai Lu
2008-06-27 11:14     ` Bernhard Walle
2008-06-27 18:31       ` Yinghai Lu
  -- strict thread matches above, loose matches on Subject: below --
2008-06-27 11:12 x86: Add /sys/firmware/memmap Bernhard Walle
2008-06-27 11:12 ` [PATCH 1/2] " Bernhard Walle
2008-06-27 18:51   ` Dave Hansen
2008-06-27 20:56   ` Greg KH
2008-07-12  0:36   ` Andrew Morton
2008-06-26  8:14 x86: " Bernhard Walle
2008-06-26  8:14 ` [PATCH 1/2] " Bernhard Walle
2008-06-25 19:57 x86: " Bernhard Walle
2008-06-25 19:57 ` [PATCH 1/2] " Bernhard Walle
2008-06-25 22:43   ` Vivek Goyal
2008-06-26  8:13     ` Mikael Pettersson
2008-06-26  8:45       ` Bernhard Walle
2008-06-26  9:11         ` Mikael Pettersson
2008-06-26 18:00           ` H. Peter Anvin
2008-06-26 18:18             ` Vivek Goyal
2008-06-26 19:18               ` H. Peter Anvin
2008-06-26 18:23             ` Bernhard Walle
2008-06-26 12:42       ` Vivek Goyal
2008-06-26  8:15     ` Bernhard Walle

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=20080627130857.6d543a75@halley.suse.de \
    --to=bwalle@suse.de \
    --cc=gregkh@suse.de \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vgoyal@redhat.com \
    --cc=x86@kernel.org \
    --cc=yhlu.kernel@gmail.com \
    /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