Skip to contentSkip to conversation

driver core patches against 2.6.24

PATCH In review Greg KH 27 participants 272 messages Jan 25, 2008 – Jan 29, 2008 Page 3 of 3

Subsystems (67)
lore
Share & tools
lore
#181 lore raw

PATCH 143/196 PCI: use proper call to driver_create_file

In reply to Greg KH

Don't try to call the "raw" sysfs_create_file when we already have a helper function to do this kind of work for us.

---
 drivers/pci/pci-driver.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
drivers/pci/pci-driver.c +7 -2
index 6d1a216..73e3629 100644
@@ -96,17 +96,21 @@ pci_create_newid_file(struct pci_driver *drv)
 {
 	int error = 0;
 	if (drv->probe != NULL)
-		error = sysfs_create_file(&drv->driver.kobj,
-					  &driver_attr_new_id.attr);
+		error = driver_create_file(&drv->driver, &driver_attr_new_id);
 	return error;
 }
 
+static void pci_remove_newid_file(struct pci_driver *drv)
+{
+	driver_remove_file(&drv->driver, &driver_attr_new_id);
+}
 #else /* !CONFIG_HOTPLUG */
 static inline void pci_free_dynids(struct pci_driver *drv) {}
 static inline int pci_create_newid_file(struct pci_driver *drv)
 {
 	return 0;
 }
+static inline void pci_remove_newid_file(struct pci_driver *drv) {}
 #endif
 
 /**
@@ -447,6 +451,7 @@ int __pci_register_driver(struct pci_driver *drv, struct module *owner,
 void
 pci_unregister_driver(struct pci_driver *drv)
 {
+	pci_remove_newid_file(drv);
 	driver_unregister(&drv->driver);
 	pci_free_dynids(drv);
 }
Signature · 1 line
1.5.3.8
#96 lore raw

Re: [PATCH 076/196] ecryptfs: remove version_str file from sysfs

In reply to Greg Kroah-Hartman
Quoted 5 lines · Greg Kroah-Hartman

This file violates the one-value-per-file sysfs rule.

If you all want it added back, please do something like a per-feature file to show what is present and what isn't.

Quoted 7 lines
Cc Kay Sievers <[email protected]>
Cc Mike Halcrow <[email protected]>
Cc Phillip Hellewell <[email protected]>
---
 fs/ecryptfs/main.c |   43 -------------------------------------------
 1 files changed, 0 insertions(+), 43 deletions(-)

It's not really good policy to rip out ABIs found in release kernels like this, even if the motivation is sound.

IMO "don't break ABIs" rule is far more important than a one-value-per-file sysfs rule.

Jeff

#15 lore raw

Re: [PATCH 012/196] nozomi driver

In reply to Greg Kroah-Hartman
Quoted 5 lines · Greg Kroah-Hartman

+/*
+ * nozomi.c -- HSDPA driver Broadband Wireless Data Card - Globe Trotter
+ *
+ * Written by: Ulf Jakobsson,
+ * Jan �erfeldt,

                     ^

Neither in ISO-8859-1 nor UTF-8 this position contains something meaningful. Mind to update to UTF-8?

Quoted 2 lines

+/*
+ * CHANGELOG

Changelogs go into git, not files, at least that is what was mentioned time and again.

drivers/char/nozomi.c line 283

Quoted 12 lines
drivers/char/nozomi.c new file +12 -0
+#ifdef __BIG_ENDIAN
+/* Big endian */
+
+struct toggles {
+	unsigned enabled:5;	/*
+				 * Toggle fields are valid if enabled is 0,
+				 * else A-channels must always be used.
+				 */
+	unsigned diag_dl:1;
+	unsigned mdm_dl:1;
+	unsigned mdm_ul:1;
+} __attribute__ ((packed));

Probably just me, unsigned int is a good bit more explicit. The driver may also use a combined struct with BIG_ENDIAN_BITFIELD/LITTLE_ENDIAN_BIGFIELD (see e.g. linux/ip.h).

drivers/char/nozomi.c line 454

Quoted 5 lines
drivers/char/nozomi.c new file +5 -0
+/*    Global variables */
+static struct pci_device_id nozomi_pci_tbl[] = {
+	{PCI_DEVICE(VENDOR1, DEVICE1)},
+	{},
+};

The macros are only used once, could just as well substitute them by their real values.

drivers/char/nozomi.c

Quoted 8 lines
drivers/char/nozomi.c new file +7 -0
+/*
+ * TODO:
+ * -Optimize
+ * -Rewrite cleaner
+ */
 
+/*
+ * Handle donlink data, ports that are handled are modem and diagnostics
            ^

downlink

Quoted 1 line

+static DEVICE_ATTR(card_type, 0444, card_type_show, NULL);

While 0444 is probably never going to change its meaning, S_IRUGO comes into mind.

drivers/char/nozomi.c line 1887

Quoted 6 lines
drivers/char/nozomi.c new file +6 -0
+/* just to discard single character writes */
+static void ntty_put_char(struct tty_struct *tty, unsigned char c)
+{
+	/* FIXME !!! */
+	DBG2("PUT CHAR Function: %c", c);
+}

fix it?

#58 lore raw

Re: [PATCH 044/196] kset: add kset_create_and_add function

In reply to Greg Kroah-Hartman
Quoted 127 lines · Greg Kroah-Hartman

Now ksets can be dynamically created on the fly, no static definitions are required. Thanks to Miklos for hints on how to make this work better for the callers.

And thanks to Kay for finding some stupid bugs in my original version and pointing out that we need to handle the fact that kobject's can have a kset as a parent and to handle that properly in kobject_add().

Cc Kay Sievers <[email protected]>
Cc Miklos Szeredi <[email protected]>
---
 include/linux/kobject.h |    4 ++-
 lib/kobject.c           |   92 ++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 94 insertions(+), 2 deletions(-)
include/linux/kobject.h +3 -1
index 0b97b3a..f91aeb7 100644
@@ -150,11 +150,13 @@ struct kset {
        struct kset_uevent_ops  *uevent_ops;
 };
 
-
 extern void kset_init(struct kset * k);
 extern int __must_check kset_add(struct kset * k);
 extern int __must_check kset_register(struct kset * k);
 extern void kset_unregister(struct kset * k);
+extern struct kset * __must_check kset_create_and_add(const char *name,
+                                               struct kset_uevent_ops *u,
+                                               struct kobject *parent_kobj);
 
 static inline struct kset * to_kset(struct kobject * kobj)
 {
lib/kobject.c +75 -1
index 8f24940..4fb27ba 100644
@@ -186,8 +186,15 @@ int kobject_add(struct kobject * kobj)
        if (kobj->kset) {
                spin_lock(&kobj->kset->list_lock);
 
-               if (!parent)
+               if (!parent) {
                        parent = kobject_get(&kobj->kset->kobj);
+                       /*
+                        * If the kset is our parent, get a second
+                        * reference, we drop both the kset and the
+                        * parent ref on cleanup
+                        */
+                       kobject_get(parent);
+               }
 
                list_add_tail(&kobj->entry,&kobj->kset->list);
                spin_unlock(&kobj->kset->list_lock);
@@ -787,6 +794,89 @@ int subsys_create_file(struct kset *s, struct subsys_attribute *a)
        return error;
 }
 
+static void kset_release(struct kobject *kobj)
+{
+       struct kset *kset = container_of(kobj, struct kset, kobj);
+       pr_debug("kset %s: now freed\n", kobject_name(kobj));
+       kfree(kset);
+}
+
+static struct kobj_type kset_type = {
+       .release = kset_release,
+};
+
+/**
+ * kset_create - create a struct kset dynamically
+ *
+ * @name: the name for the kset
+ * @uevent_ops: a struct kset_uevent_ops for the kset
+ * @parent_kobj: the parent kobject of this kset, if any.
+ *
+ * This function creates a kset structure dynamically.  This structure can
+ * then be registered with the system and show up in sysfs with a call to
+ * kset_register().  When you are finished with this structure, if
+ * kset_register() has been called, call kset_unregister() and the
+ * structure will be dynamically freed when it is no longer being used.
+ *
+ * If the kset was not able to be created, NULL will be returned.
+ */
+static struct kset *kset_create(const char *name,
+                               struct kset_uevent_ops *uevent_ops,
+                               struct kobject *parent_kobj)
+{
+       struct kset *kset;
+
+       kset = kzalloc(sizeof(*kset), GFP_KERNEL);
+       if (!kset)
+               return NULL;
+       kobject_set_name(&kset->kobj, name);
+       kset->uevent_ops = uevent_ops;
+       kset->kobj.parent = parent_kobj;
+
+       /*
+        * The kobject of this kset will have a type of kset_type and belong to
+        * no kset itself.  That way we can properly free it when it is
+        * finished being used.
+        */
+       kset->kobj.ktype = &kset_type;
+       kset->kobj.kset = NULL;
+
+       return kset;
+}
+
+/**
+ * kset_create_and_add - create a struct kset dynamically and add it to sysfs
+ *
+ * @name: the name for the kset
+ * @uevent_ops: a struct kset_uevent_ops for the kset
+ * @parent_kobj: the parent kobject of this kset, if any.
+ *
+ * This function creates a kset structure dynamically and registers it
+ * with sysfs.  When you are finished with this structure, call
+ * kset_unregister() and the structure will be dynamically freed when it
+ * is no longer being used.
+ *
+ * If the kset was not able to be created, NULL will be returned.
+ */
+struct kset *kset_create_and_add(const char *name,
+                                struct kset_uevent_ops *uevent_ops,
+                                struct kobject *parent_kobj)

lib/kobject.c int subsys_create_file(struct kset *s, struct subsys_attribute *a) · line 873

Quoted 10 lines
lib/kobject.c +10 -0
+{
+       struct kset *kset;
+       int error;
+
+       kset = kset_create(name, uevent_ops, parent_kobj);
+       if (!kset)
+               return NULL;
+       error = kset_register(kset);
+       if (error) {
+               kfree(kset);

How about : kobject_put(&kset->kobj);

Quoted 18 lines
lib/kobject.c +6 -1
+               return NULL;
+       }
+       return kset;
+}
+EXPORT_SYMBOL_GPL(kset_create_and_add);
+
 EXPORT_SYMBOL(kobject_init);
 EXPORT_SYMBOL(kobject_register);
 EXPORT_SYMBOL(kobject_unregister);
--

1.5.3.8

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#234 lore raw

Re: [PATCH 185/196] UIO: constify function pointer tables

In reply to Greg Kroah-Hartman

Am Thu, 24 Jan 2008 23:33:34 -0800
schrieb Greg Kroah-Hartman <[email protected]>:

Quoted 4 lines

From: Jan Engelhardt <[email protected]>

Quoted 26 lines
---
 drivers/uio/uio.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/uio/uio.c +2 -2
index 03b66fb..cc246fa 100644
@@ -39,7 +39,7 @@ struct uio_device {
 
 static int uio_major;
 static DEFINE_IDR(uio_idr);
-static struct file_operations uio_fops;
+static const struct file_operations uio_fops;
 
 /* UIO class infrastructure */
 static struct uio_class {
@@ -508,7 +508,7 @@ static int uio_mmap(struct file *filep, struct
 vm_area_struct *vma) }
 }
 
-static struct file_operations uio_fops = {
+static const struct file_operations uio_fops = {
 	.owner		= THIS_MODULE,
 	.open		= uio_open,
 	.release	= uio_release,
#16 lore raw

Re: [PATCH 012/196] nozomi driver

In reply to Jan Engelhardt
Quoted 17 lines · Jan Engelhardt

drivers/char/nozomi.c line 283

Quoted 12 lines · Greg Kroah-Hartman
drivers/char/nozomi.c new file +12 -0
+#ifdef __BIG_ENDIAN
+/* Big endian */
+
+struct toggles {
+	unsigned enabled:5;	/*
+				 * Toggle fields are valid if enabled is 0,
+				 * else A-channels must always be used.
+				 */
+	unsigned diag_dl:1;
+	unsigned mdm_dl:1;
+	unsigned mdm_ul:1;
+} __attribute__ ((packed));

Probably just me, unsigned int is a good bit more explicit. The driver may also use a combined struct with BIG_ENDIAN_BITFIELD/LITTLE_ENDIAN_BIGFIELD (see e.g. linux/ip.h).

I've been told we don't do bitfields anymore in on-the-wire data, on-disk data, userspace ABIs, etc. because their layout is compiler dependent in the end.

Signature · 3 lines
Stefan Richter
-=====-==--- ---= ==--=
http://arcgraph.de/sr/
#113 lore raw

Re: [PATCH 085/196] kset: convert s390 ipl.c to use kset_create

In reply to Greg Kroah-Hartman
Quoted 3 lines · Greg Kroah-Hartman

Dynamically create the kset instead of declaring it statically. This makes the kobject attributes now work properly that I broke in the previous patch.

Could you please merge this and the previous patch before it goes upstream? Having an intermediate state where things are broken will cause pain and additional work in case of bisecting. Thanks!

#17 lore raw

Re: [PATCH 012/196 ver2] nozomi driver

In reply to Jan Engelhardt

From: Frank Seidel <[email protected]>

This is a driver to control the cardbus wireless data card that works on 3g networks.

Greg Kroah-Hartman <[email protected]> did the initial driver cleanup. Thanks to Arnaud Patard <[email protected]> for help with bugfixing. Thanks to Alan Cox for a lot of tty fixes.
Thanks to Satyam Sharma <[email protected]> for fixing buildbreakage. Thanks to Frank Seidel <[email protected]> for a lot of bugfixes and rewriting to make it a sane Linux driver
Thanks to Jiri Slaby <[email protected]> for a lot bugfixes, cleanups and rewrites that make it much more readable.

---
 drivers/char/Kconfig  |   10 
 drivers/char/Makefile |    1 
 drivers/char/nozomi.c | 1943 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 1954 insertions(+)
drivers/char/Kconfig +10 -0
@@ -373,6 +373,16 @@ config ISTALLION
 	  To compile this driver as a module, choose M here: the
 	  module will be called istallion.
 
+config NOZOMI
+	tristate "HSDPA Broadband Wireless Data Card - Globe Trotter"
+	depends on PCI && EXPERIMENTAL
+	help
+	  If you have a HSDPA driver Broadband Wireless Data Card -
+	  Globe Trotter PCMCIA card, say Y here.
+
+	  To compile this driver as a module, choose M here, the module
+	  will be called nozomi.
+
 config A2232
 	tristate "Commodore A2232 serial support (EXPERIMENTAL)"
 	depends on EXPERIMENTAL && ZORRO && BROKEN_ON_SMP
drivers/char/Makefile +1 -0
@@ -26,6 +26,7 @@ obj-$(CONFIG_SERIAL167)		+= serial167.o
 obj-$(CONFIG_CYCLADES)		+= cyclades.o
 obj-$(CONFIG_STALLION)		+= stallion.o
 obj-$(CONFIG_ISTALLION)		+= istallion.o
+obj-$(CONFIG_NOZOMI)		+= nozomi.o
 obj-$(CONFIG_DIGIEPCA)		+= epca.o
 obj-$(CONFIG_SPECIALIX)		+= specialix.o
 obj-$(CONFIG_MOXA_INTELLIO)	+= moxa.o
drivers/char/nozomi.c new file +1943 -0

1,943 lines not on this page · raw message

#23 lore raw

Re: [PATCH 012/196] nozomi driver

In reply to Jan Engelhardt

Hi,

thanks for your feedback.

Quoted 9 lines · you (Jan Engelhardt)
Quoted 5 lines · Greg Kroah-Hartman

+/*
+ * nozomi.c -- HSDPA driver Broadband Wireless Data Card - Globe Trotter
+ *
+ * Written by: Ulf Jakobsson,
+ * Jan �erfeldt,

                     ^

Neither in ISO-8859-1 nor UTF-8 this position contains something meaningful. Mind to update to UTF-8?

fixed

Quoted 5 lines
Quoted 2 lines

+/*
+ * CHANGELOG

Changelogs go into git, not files, at least that is what was mentioned time and again.

i removed them

Quoted 8 lines
Quoted 8 lines
drivers/char/nozomi.c new file +8 -0
+#ifdef __BIG_ENDIAN
+/* Big endian */
+
+struct toggles {
+	unsigned enabled:5;	/*
+				 * Toggle fields are valid if enabled is 0,
+				 * else A-channels must always be used.
+				 */
Quoted 8 lines

drivers/char/nozomi.c line 283

Quoted 4 lines
drivers/char/nozomi.c new file +4 -0
+	unsigned diag_dl:1;
+	unsigned mdm_dl:1;
+	unsigned mdm_ul:1;
+} __attribute__ ((packed));

Probably just me, unsigned int is a good bit more explicit. The driver may also use a combined struct with BIG_ENDIAN_BITFIELD/LITTLE_ENDIAN_BIGFIELD (see e.g. linux/ip.h).

Here i agree with Stefan, especially as this also would only make a difference for one (struct config_table) of those four structs and there it would vastly decrease readability.

Quoted 8 lines

drivers/char/nozomi.c line 454

Quoted 5 lines
drivers/char/nozomi.c new file +5 -0
+/*    Global variables */
+static struct pci_device_id nozomi_pci_tbl[] = {
+	{PCI_DEVICE(VENDOR1, DEVICE1)},
+	{},
+};

The macros are only used once, could just as well substitute them by their real values.

Yes, but on the other hand now all those driver specific numbers are grouped together in the beginning of nozomi.c and it also could happen there once will appear other cards or models of it that this nozomi driver could handle.

Quoted 4 lines
Quoted 2 lines

+/*
+ * Handle donlink data, ports that are handled are modem and diagnostics

            ^

downlink

corrected

Quoted 4 lines
Quoted 1 line

+static DEVICE_ATTR(card_type, 0444, card_type_show, NULL);

While 0444 is probably never going to change its meaning, S_IRUGO comes into mind.

changed it to S_IRUGO

Quoted 6 lines

drivers/char/nozomi.c line 1887

Quoted 6 lines
drivers/char/nozomi.c new file +6 -0
+/* just to discard single character writes */
+static void ntty_put_char(struct tty_struct *tty, unsigned char c)
+{
+	/* FIXME !!! */
+	DBG2("PUT CHAR Function: %c", c);
+}

Its just a misleading comment, but i changed it.

Besides that i also removed an error and a warning the current checkpatch.pl now showed up ("trailing statments should be on next line" and a "inline preferred over __inline-__").

Thanks,
Frank

#24 lore raw

Re: [PATCH 012/196] nozomi driver

Quoted 8 lines · Frank Seidel
Quoted 5 lines
Quoted 2 lines

+/*
+ * CHANGELOG

Changelogs go into git, not files, at least that is what was mentioned time and again.

i removed them

If you want to keep them, add it to the patch description; that way they will be retained in "git log" without expanding the size of the .c file. :)

#141 lore raw

Re: [PATCH 108/196] Kobject: change net/bridge to use kobject_create_and_add

In reply to Greg Kroah-Hartman
Quoted 78 lines · On Thu, 24 Jan 2008 23:32:17 -0800 Greg Kroah-Hartman <[email protected]> wrote:

The kobject in the bridge code is only used for registering with sysfs, not for any lifespan rules. This patch changes it to be only a pointer and use the simpler api for this kind of thing.

Cc Stephen Hemminger <[email protected]>
Cc Kay Sievers <[email protected]>
---
 net/bridge/br_if.c       |    2 +-
 net/bridge/br_private.h  |    2 +-
 net/bridge/br_sysfs_br.c |   14 ++++----------
 net/bridge/br_sysfs_if.c |    2 +-
 4 files changed, 7 insertions(+), 13 deletions(-)
net/bridge/br_if.c +1 -1
index 935784f..dadec94 100644
@@ -133,7 +133,7 @@ static void del_nbp(struct net_bridge_port *p)
 	struct net_bridge *br = p->br;
 	struct net_device *dev = p->dev;
 
-	sysfs_remove_link(&br->ifobj, dev->name);
+	sysfs_remove_link(br->ifobj, dev->name);
 
 	dev_set_promiscuity(dev, -1);
 
net/bridge/br_private.h +1 -1
index f666f7b..c11b554 100644
@@ -124,7 +124,7 @@ struct net_bridge
 	struct timer_list		tcn_timer;
 	struct timer_list		topology_change_timer;
 	struct timer_list		gc_timer;
-	struct kobject			ifobj;
+	struct kobject			*ifobj;
 };
 
 extern struct notifier_block br_device_notifier;
net/bridge/br_sysfs_br.c +4 -10
index 3312e8f..4e7f91f 100644
@@ -426,16 +426,10 @@ int br_sysfs_addbr(struct net_device *dev)
 		goto out2;
 	}
 
-
-	kobject_set_name(&br->ifobj, SYSFS_BRIDGE_PORT_SUBDIR);
-	br->ifobj.ktype = NULL;
-	br->ifobj.kset = NULL;
-	br->ifobj.parent = brobj;
-
-	err = kobject_register(&br->ifobj);
-	if (err) {
+	br->ifobj = kobject_create_and_add(SYSFS_BRIDGE_PORT_SUBDIR, brobj);
+	if (!br->ifobj) {
 		pr_info("%s: can't add kobject (directory) %s/%s\n",
-			__FUNCTION__, dev->name, kobject_name(&br->ifobj));
+			__FUNCTION__, dev->name, SYSFS_BRIDGE_PORT_SUBDIR);
 		goto out3;
 	}
 	return 0;
@@ -453,7 +447,7 @@ void br_sysfs_delbr(struct net_device *dev)
 	struct kobject *kobj = &dev->dev.kobj;
 	struct net_bridge *br = netdev_priv(dev);
 
-	kobject_unregister(&br->ifobj);
+	kobject_unregister(br->ifobj);
 	sysfs_remove_bin_file(kobj, &bridge_forward);
 	sysfs_remove_group(kobj, &bridge_group);
 }
net/bridge/br_sysfs_if.c +0 -0
index 79db51f..02b2d50 100644

net/bridge/br_sysfs_if.c int br_sysfs_addif(struct net_bridge_port *p) · line 235

Quoted 8 lines
net/bridge/br_sysfs_if.c +1 -1
@@ -229,7 +229,7 @@ int br_sysfs_addif(struct net_bridge_port *p)
 			goto out2;
 	}
 
-	err= sysfs_create_link(&br->ifobj, &p->kobj, p->dev->name);
+	err = sysfs_create_link(br->ifobj, &p->kobj, p->dev->name);
 out2:
 	return err;
 }

Okay, but where is the new kobject freed?

Signature · 1 line
Stephen Hemminger <[email protected]>
#174 lore raw

Re: [PATCH 136/196] Kobject: convert net/bridge/br_if.c to use kobject_init/add_ng()

In reply to Greg Kroah-Hartman
Quoted 38 lines · On Thu, 24 Jan 2008 23:32:45 -0800 Greg Kroah-Hartman <[email protected]> wrote:

This converts the code to use the new kobject functions, cleaning up the logic in doing so.

Cc Stephen Hemminger <[email protected]>
Cc Kay Sievers <[email protected]>
---
 net/bridge/br_if.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)
net/bridge/br_if.c +2 -7
index dadec94..298e0f4 100644
@@ -258,12 +258,6 @@ static struct net_bridge_port *new_nbp(struct net_bridge *br,
 	p->state = BR_STATE_DISABLED;
 	br_stp_port_timer_init(p);
 
-	kobject_init(&p->kobj);
-	kobject_set_name(&p->kobj, SYSFS_BRIDGE_PORT_ATTR);
-	p->kobj.ktype = &brport_ktype;
-	p->kobj.parent = &(dev->dev.kobj);
-	p->kobj.kset = NULL;
-
 	return p;
 }
 
@@ -379,7 +373,8 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
 	if (IS_ERR(p))
 		return PTR_ERR(p);
 
-	err = kobject_add(&p->kobj);
+	err = kobject_init_and_add(&p->kobj, &brport_ktype, &(dev->dev.kobj),
+				   SYSFS_BRIDGE_PORT_ATTR);
 	if (err)
 		goto err0;
 

net/bridge/br_if.c err2: · line 417

Quoted 7 lines
net/bridge/br_if.c +1 -0
@@ -416,6 +411,7 @@ err2:
 	br_fdb_delete_by_port(br, p, 1);
 err1:
 	kobject_del(&p->kobj);
+	return err;
 err0:
 	kobject_put(&p->kobj);
 	return err;

This is fine, no issues.

Signature · 1 line
Stephen Hemminger <[email protected]>
#25 lore raw

Re: [PATCH 012/196] nozomi driver

In reply to Jan Engelhardt
Quoted 5 lines · Jan Engelhardt
Quoted 3 lines · Frank Seidel
Quoted 3 lines
Quoted 2 lines

+/*
+ * CHANGELOG

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Changelogs go into git, not files, at least that is what was mentioned time and again.

i removed them

If you want to keep them, add it to the patch description; that way they will be retained in "git log" without expanding the size of the .c file. :)

By all means - if you have text that explains the who/what/why of the patch, put it in the patch description, so that 6 months later idiots like me have a fighting chance of figuring out whether the patch incorrectly implements the right idea, or if it correctly implements the wrong idea. ;)

author
#142 lore raw

Re: [PATCH 108/196] Kobject: change net/bridge to use kobject_create_and_add

In reply to Stephen Hemminger
Quoted 84 lines · Stephen Hemminger
Quoted 81 lines · On Thu, 24 Jan 2008 23:32:17 -0800 Greg Kroah-Hartman <[email protected]> wrote:

The kobject in the bridge code is only used for registering with sysfs, not for any lifespan rules. This patch changes it to be only a pointer and use the simpler api for this kind of thing.

Cc Stephen Hemminger <[email protected]>
Cc Kay Sievers <[email protected]>
---
 net/bridge/br_if.c       |    2 +-
 net/bridge/br_private.h  |    2 +-
 net/bridge/br_sysfs_br.c |   14 ++++----------
 net/bridge/br_sysfs_if.c |    2 +-
 4 files changed, 7 insertions(+), 13 deletions(-)
net/bridge/br_if.c +1 -1
index 935784f..dadec94 100644
@@ -133,7 +133,7 @@ static void del_nbp(struct net_bridge_port *p)
 	struct net_bridge *br = p->br;
 	struct net_device *dev = p->dev;
 
-	sysfs_remove_link(&br->ifobj, dev->name);
+	sysfs_remove_link(br->ifobj, dev->name);
 
 	dev_set_promiscuity(dev, -1);
 
net/bridge/br_private.h +1 -1
index f666f7b..c11b554 100644
@@ -124,7 +124,7 @@ struct net_bridge
 	struct timer_list		tcn_timer;
 	struct timer_list		topology_change_timer;
 	struct timer_list		gc_timer;
-	struct kobject			ifobj;
+	struct kobject			*ifobj;
 };
 
 extern struct notifier_block br_device_notifier;
net/bridge/br_sysfs_br.c +4 -10
index 3312e8f..4e7f91f 100644
@@ -426,16 +426,10 @@ int br_sysfs_addbr(struct net_device *dev)
 		goto out2;
 	}
 
-
-	kobject_set_name(&br->ifobj, SYSFS_BRIDGE_PORT_SUBDIR);
-	br->ifobj.ktype = NULL;
-	br->ifobj.kset = NULL;
-	br->ifobj.parent = brobj;
-
-	err = kobject_register(&br->ifobj);
-	if (err) {
+	br->ifobj = kobject_create_and_add(SYSFS_BRIDGE_PORT_SUBDIR, brobj);
+	if (!br->ifobj) {
 		pr_info("%s: can't add kobject (directory) %s/%s\n",
-			__FUNCTION__, dev->name, kobject_name(&br->ifobj));
+			__FUNCTION__, dev->name, SYSFS_BRIDGE_PORT_SUBDIR);
 		goto out3;
 	}
 	return 0;
@@ -453,7 +447,7 @@ void br_sysfs_delbr(struct net_device *dev)
 	struct kobject *kobj = &dev->dev.kobj;
 	struct net_bridge *br = netdev_priv(dev);
 
-	kobject_unregister(&br->ifobj);
+	kobject_unregister(br->ifobj);
 	sysfs_remove_bin_file(kobj, &bridge_forward);
 	sysfs_remove_group(kobj, &bridge_group);
 }
net/bridge/br_sysfs_if.c +0 -0
index 79db51f..02b2d50 100644
@@ -229,7 +229,7 @@ int br_sysfs_addif(struct net_bridge_port *p)
 			goto out2;
 	}
 
Quoted 7 lines

net/bridge/br_sysfs_if.c int br_sysfs_addif(struct net_bridge_port *p) · line 235

Quoted 5 lines
net/bridge/br_sysfs_if.c +1 -1
-	err= sysfs_create_link(&br->ifobj, &p->kobj, p->dev->name);
+	err = sysfs_create_link(br->ifobj, &p->kobj, p->dev->name);
 out2:
 	return err;
 }

Okay, but where is the new kobject freed?

In the call to kobject_unregister(), which has then later in the series been converted to a call to kobject_put().

thanks,

greg k-h

author
#114 lore raw

Re: [PATCH 085/196] kset: convert s390 ipl.c to use kset_create

In reply to Heiko Carstens
Quoted 8 lines · Heiko Carstens
Quoted 3 lines · Greg Kroah-Hartman

Dynamically create the kset instead of declaring it statically. This makes the kobject attributes now work properly that I broke in the previous patch.

Could you please merge this and the previous patch before it goes upstream? Having an intermediate state where things are broken will cause pain and additional work in case of bisecting.

It will not cause a build error (see the previous patch for details.) The sysfs files will not properly show the correct data, that is all.

The odds that you will hit this in a 'git bisect' is VERY low, and the previous patch states that the files are now broken, so there should not be any confusion regarding any user that might run across this.

thanks,

greg k-h

author
#59 lore raw

Re: [PATCH 044/196] kset: add kset_create_and_add function

In reply to Dave Young
Quoted 22 lines · Dave Young
Quoted 21 lines · Greg Kroah-Hartman
lib/kobject.c +21 -0
+/**
+ * kset_create_and_add - create a struct kset dynamically and add it to sysfs
+ *
+ * @name: the name for the kset
+ * @uevent_ops: a struct kset_uevent_ops for the kset
+ * @parent_kobj: the parent kobject of this kset, if any.
+ *
+ * This function creates a kset structure dynamically and registers it
+ * with sysfs.  When you are finished with this structure, call
+ * kset_unregister() and the structure will be dynamically freed when it
+ * is no longer being used.
+ *
+ * If the kset was not able to be created, NULL will be returned.
+ */
+struct kset *kset_create_and_add(const char *name,
+                                struct kset_uevent_ops *uevent_ops,
+                                struct kobject *parent_kobj)
+{
+       struct kset *kset;
+       int error;
+
Quoted 8 lines

lib/kobject.c int subsys_create_file(struct kset *s, struct subsys_attribute *a) · line 873

Quoted 6 lines
lib/kobject.c +6 -0
+       kset = kset_create(name, uevent_ops, parent_kobj);
+       if (!kset)
+               return NULL;
+       error = kset_register(kset);
+       if (error) {
+               kfree(kset);

How about : kobject_put(&kset->kobj);

At this point in the object's lifetime, it is the same exact thing.

So both are correct :)

thanks,

greg k-h

author
#97 lore raw

Re: [PATCH 076/196] ecryptfs: remove version_str file from sysfs

In reply to Jeff Garzik
Quoted 12 lines · Jeff Garzik
Quoted 10 lines · Greg Kroah-Hartman

This file violates the one-value-per-file sysfs rule.
If you all want it added back, please do something like a per-feature file to show what is present and what isn't.

Cc Kay Sievers <[email protected]>
Cc Mike Halcrow <[email protected]>
Cc Phillip Hellewell <[email protected]>
---
 fs/ecryptfs/main.c |   43 -------------------------------------------
 1 files changed, 0 insertions(+), 43 deletions(-)
Quoted 2 lines

It's not really good policy to rip out ABIs found in release kernels like this, even if the motivation is sound.

Normally I would agree, but this file is just so bad, it's not even funny. I could not find any userspace tools or documentation that used it, and the ecryptfs developers never responded to any of my emails concerning it.

The information is still present, just in a different file, so no functionality is lost here.

Quoted 2 lines

IMO "don't break ABIs" rule is far more important than a one-value-per-file sysfs rule.

Just another example of why people need to document this kind of thing in Documentation/ABI/ which prevents such atrocities from ever being created in the first place...

thanks,

greg k-h

#247 lore raw
In reply to Greg KH
Quoted 3 lines · Greg KH

Here are a pretty large number of kobject, documentation, and driver core patches against your 2.6.24 git tree.

I've merged it all, but it causes lots of scary warnings:

- from the purely broken ones:

ehci_hcd: no version for "struct_module" found: kernel tainted.

- to the scary ones:

	sysfs: duplicate filename 'ehci_hcd' can not be created
	WARNING: at fs/sysfs/dir.c:424 sysfs_add_one()
	Pid: 610, comm: insmod Tainted: GF       2.6.24-gb47711bf #28
	
	Call Trace:
	 [<ffffffff802bd63c>] sysfs_add_one+0x54/0xbd
	 [<ffffffff802bdbc0>] create_dir+0x4f/0x87
	 [<ffffffff802bdc2d>] sysfs_create_dir+0x35/0x4a
	 [<ffffffff803154c8>] kobject_get+0x12/0x17
	 [<ffffffff80315607>] kobject_add_internal+0xd9/0x194
	 [<ffffffff8031579c>] kobject_add_varg+0x54/0x61
	 [<ffffffff80261efe>] __alloc_pages+0x66/0x2ee
	 [<ffffffff80315321>] kobject_init+0x42/0x82
	 [<ffffffff80315843>] kobject_init_and_add+0x9a/0xa7
	 [<ffffffff802722c0>] __vmalloc_area_node+0x111/0x135
	 [<ffffffff8025546b>] mod_sysfs_init+0x6e/0x83
	 [<ffffffff802561e8>] sys_init_module+0xa3d/0x1833
	 [<ffffffff8028ebd5>] dput+0x1c/0x10b
	 [<ffffffff8020b3be>] system_call+0x7e/0x83

and the problem seems to be that it does all these checks even for modules that will never be loaded, because I use my own kernel, but with the default Fedora initrd (which is trying to load modules for stuff that I already have built in).

Very annoying.

Can we please do that *after* the module loading symbol checks have run, so that when you try to load a module that will not load, it won't complain about these silly things?

(You can probably trigger this by simply trying to load a module that was compiled for another kernel version - it will fail fine, but in failing it will then generate all these incorrect warnings!)

Now it incorrectly taints my kernel, for no good reason.

Linus

author
#248 lore raw
Quoted 35 lines · Linus Torvalds
Quoted 3 lines · Greg KH

Here are a pretty large number of kobject, documentation, and driver core patches against your 2.6.24 git tree.

I've merged it all, but it causes lots of scary warnings:

- from the purely broken ones:

ehci_hcd: no version for "struct_module" found: kernel tainted.

- to the scary ones:

	sysfs: duplicate filename 'ehci_hcd' can not be created
	WARNING: at fs/sysfs/dir.c:424 sysfs_add_one()
	Pid: 610, comm: insmod Tainted: GF       2.6.24-gb47711bf #28
	
	Call Trace:
	 [<ffffffff802bd63c>] sysfs_add_one+0x54/0xbd
	 [<ffffffff802bdbc0>] create_dir+0x4f/0x87
	 [<ffffffff802bdc2d>] sysfs_create_dir+0x35/0x4a
	 [<ffffffff803154c8>] kobject_get+0x12/0x17
	 [<ffffffff80315607>] kobject_add_internal+0xd9/0x194
	 [<ffffffff8031579c>] kobject_add_varg+0x54/0x61
	 [<ffffffff80261efe>] __alloc_pages+0x66/0x2ee
	 [<ffffffff80315321>] kobject_init+0x42/0x82
	 [<ffffffff80315843>] kobject_init_and_add+0x9a/0xa7
	 [<ffffffff802722c0>] __vmalloc_area_node+0x111/0x135
	 [<ffffffff8025546b>] mod_sysfs_init+0x6e/0x83
	 [<ffffffff802561e8>] sys_init_module+0xa3d/0x1833
	 [<ffffffff8028ebd5>] dput+0x1c/0x10b
	 [<ffffffff8020b3be>] system_call+0x7e/0x83
Quoted 6 lines

and the problem seems to be that it does all these checks even for modules that will never be loaded, because I use my own kernel, but with the default Fedora initrd (which is trying to load modules for stuff that I already have built in).

Very annoying.

That's really wierd, I don't see that at all here just running with your 2.6.24 + my git tree and lots of USB drivers built into the kernel also (like ehci_hcd).

I'll try to reproduce it on your merged git tree now...

Quoted 9 lines

Can we please do that *after* the module loading symbol checks have run, so that when you try to load a module that will not load, it won't complain about these silly things?

(You can probably trigger this by simply trying to load a module that was compiled for another kernel version - it will fail fine, but in failing it will then generate all these incorrect warnings!)

Now it incorrectly taints my kernel, for no good reason.

$ cat /proc/sys/kernel/tainted
0

Odd...

$ uname -r
2.6.24-ge374a2bf-dirty

Strange, I thought that the uname id would show the git version that you were running, but that doesn't show a valid id. But that's probably a different issue in the build system somewhere...

thanks,

greg k-h

author
#18 lore raw

Re: [PATCH 012/196 ver2] nozomi driver

In reply to Frank Seidel
Quoted 4 lines · Frank Seidel

From: Frank Seidel <[email protected]>

This is a driver to control the cardbus wireless data card that works on 3g networks.

<snip>

Frank, can you send me a patch against Linus's current git tree that had the last version of this driver included in it?

That way I can actually apply the changes :)

thanks,

greg k-h

#249 lore raw
In reply to Greg KH
Quoted 4 lines · Greg KH

That's really wierd, I don't see that at all here just running with your 2.6.24 + my git tree and lots of USB drivers built into the kernel also (like ehci_hcd).

But do you use an initrd that tries to load the same driver too?

I'm too lazy to want to do my own initrd. I just use the prepackaged ones and rely on the fact that my private kernel will refuse to load modules that aren't meant for it anyway.

Quoted 2 lines
$ cat /proc/sys/kernel/tainted
0

Mine says "2".

Quoted 6 lines
$ uname -r
2.6.24-ge374a2bf-dirty

Strange, I thought that the uname id would show the git version that you were running, but that doesn't show a valid id. But that's probably a different issue in the build system somewhere...

That *is* the git version you're running: e374a2bf.

The "-g" is for "git" and the "-dirty" is because you have some non-checked-in changes in addition.

I works for me:

	[torvalds@hp linux]$ git show --abbrev-commit -s --pretty=oneline e374a2bf
	e374a2b... Kobject: fix coding style issues in kobject c files

so that looks like a valid version..

Linus

#98 lore raw

Re: [PATCH 076/196] ecryptfs: remove version_str file from sysfs

In reply to Greg KH
Quoted 1 line · Greg KH

I could not find any userspace tools or documentation that used it

The version_str handle is only there as a potential convenience for users who need to figure out what their module can and cannot do. I mentioned it in an article in LJ last year. It does not need to be there for any tools to work right, and I do not think that anyone really cares about it at this point, so I have no problem with just ripping it out.

Mike

author
#250 lore raw
In reply to Linus Torvalds
Quoted 8 lines · Linus Torvalds
Quoted 4 lines · Greg KH

That's really wierd, I don't see that at all here just running with your 2.6.24 + my git tree and lots of USB drivers built into the kernel also (like ehci_hcd).

Quoted 5 lines

But do you use an initrd that tries to load the same driver too?

I'm too lazy to want to do my own initrd. I just use the prepackaged ones and rely on the fact that my private kernel will refuse to load modules that aren't meant for it anyway.

No, I don't use any initrd at all.

You should just get a message saying that the version magic doesn't match, so the initrd modules will not load. That's what happens to me when I try to force old modules to load.

Quoted 17 lines
Quoted 2 lines
$ cat /proc/sys/kernel/tainted
0

Mine says "2".

Quoted 6 lines
$ uname -r
2.6.24-ge374a2bf-dirty

Strange, I thought that the uname id would show the git version that you were running, but that doesn't show a valid id. But that's probably a different issue in the build system somewhere...

That *is* the git version you're running: e374a2bf.

The "-g" is for "git" and the "-dirty" is because you have some non-checked-in changes in addition.

Quoted 6 lines

I works for me:

	[torvalds@hp linux]$ git show --abbrev-commit -s --pretty=oneline e374a2bf
	e374a2b... Kobject: fix coding style issues in kobject c files

so that looks like a valid version..

Ah taking the "g" off the search works, didn't realize that.

And I didn't have any unchecked in files, 'git status' shows no modified files, but other stuff in the main directory, like patches that shouldn't matter, but perhaps they do.
But oh well, I'm still building your tree now to try to reproduce this...

thanks,

greg k-h

author
#251 lore raw
In reply to Linus Torvalds
Quoted 9 lines · Linus Torvalds
Quoted 4 lines · Greg KH

That's really wierd, I don't see that at all here just running with your 2.6.24 + my git tree and lots of USB drivers built into the kernel also (like ehci_hcd).

But do you use an initrd that tries to load the same driver too?

Ah, now I get it, sorry, I'll go check that error path, not exactly a normal one :)

thanks,

greg k-h

#19 lore raw

Re: [PATCH 012/196 ver2] nozomi driver

In reply to Greg KH
Quoted 4 lines · Greg KH

Frank, can you send me a patch against Linus's current git tree that had the last version of this driver included in it?

That way I can actually apply the changes :)

Sure :-) This one is rebased on the current state in git.

Thanks,
Frank

---
 drivers/char/nozomi.c |  122 ++++++++++++++------------------------------------
 1 file changed, 36 insertions(+), 86 deletions(-)
drivers/char/nozomi.c +36 -86
@@ -2,7 +2,7 @@
  * nozomi.c  -- HSDPA driver Broadband Wireless Data Card - Globe Trotter
  *
  * Written by: Ulf Jakobsson,
- *             Jan �erfeldt,
+ *             Jan Åkerfeldt,
  *             Stefan Thomasson,
  *
  * Maintained by: Paul Hardwick ([email protected])
@@ -38,60 +38,6 @@
  * --------------------------------------------------------------------------
  */
 
-/*
- * CHANGELOG
- * Version 2.1d
- * 11-November-2007 Jiri Slaby, Frank Seidel
- * - Big rework of multicard support by Jiri
- * - Major cleanups (semaphore to mutex, endianess, no major reservation)
- * - Optimizations
- *
- * Version 2.1c
- * 30-October-2007 Frank Seidel
- * - Completed multicard support
- * - Minor cleanups
- *
- * Version 2.1b
- * 07-August-2007 Frank Seidel
- * - Minor cleanups
- * - theoretical multicard support
- *
- * Version 2.1
- * 03-July-2006 Paul Hardwick
- *
- * - Stability Improvements. Incorporated spinlock wraps patch.
- * - Updated for newer 2.6.14+ kernels (tty_buffer_request_room)
- * - using __devexit macro for tty
- *
- *
- * Version 2.0
- * 08-feb-2006 15:34:10:Ulf
- *
- * -Fixed issue when not waking up line disipine layer, could probably result
- *  in better uplink performance for 2.4.
- *
- * -Fixed issue with big endian during initalization, now proper toggle flags
- *  are handled between preloader and maincode.
- *
- * -Fixed flow control issue.
- *
- * -Added support for setting DTR.
- *
- * -For 2.4 kernels, removing temporary buffer that's not needed.
- *
- * -Reading CTS only for modem port (only port that supports it).
- *
- * -Return 0 in write_room instead of netative value, it's not handled in
- *  upper layer.
- *
- * --------------------------------------------------------------------------
- * Version 1.0
- *
- * First version of driver, only tested with card of type F32_2.
- * Works fine with 2.4 and 2.6 kernels.
- * Driver also support big endian architecture.
- */
-
 /* Enable this to have a lot of debug printouts */
 #define DEBUG
 
@@ -143,8 +89,9 @@ do {								\
 /* Do we need this settable at runtime? */
 static int debug = NOZOMI_DEBUG_LEVEL;
 
-#define D(lvl, args...)  do {if (lvl & debug) NFO(KERN_DEBUG, ##args); } \
-				while (0)
+#define D(lvl, args...)  do \
+			{if (lvl & debug) NFO(KERN_DEBUG, ##args); } \
+			while (0)
 #define D_(lvl, args...) D(lvl, ##args)
 
 /* These printouts are always printed */
@@ -273,13 +220,13 @@ enum port_type {
 /* Big endian */
 
 struct toggles {
-	unsigned enabled:5;	/*
+	unsigned int enabled:5;	/*
 				 * Toggle fields are valid if enabled is 0,
 				 * else A-channels must always be used.
 				 */
-	unsigned diag_dl:1;
-	unsigned mdm_dl:1;
-	unsigned mdm_ul:1;
+	unsigned int diag_dl:1;
+	unsigned int mdm_dl:1;
+	unsigned int mdm_ul:1;
 } __attribute__ ((packed));
 
 /* Configuration table to read at startup of card */
@@ -320,19 +267,19 @@ struct config_table {
 /* This stores all control downlink flags */
 struct ctrl_dl {
 	u8 port;
-	unsigned reserved:4;
-	unsigned CTS:1;
-	unsigned RI:1;
-	unsigned DCD:1;
-	unsigned DSR:1;
+	unsigned int reserved:4;
+	unsigned int CTS:1;
+	unsigned int RI:1;
+	unsigned int DCD:1;
+	unsigned int DSR:1;
 } __attribute__ ((packed));
 
 /* This stores all control uplink flags */
 struct ctrl_ul {
 	u8 port;
-	unsigned reserved:6;
-	unsigned RTS:1;
-	unsigned DTR:1;
+	unsigned int reserved:6;
+	unsigned int RTS:1;
+	unsigned int DTR:1;
 } __attribute__ ((packed));
 
 #else
@@ -340,10 +287,10 @@ struct ctrl_ul {
 
 /* This represents the toggle information */
 struct toggles {
-	unsigned mdm_ul:1;
-	unsigned mdm_dl:1;
-	unsigned diag_dl:1;
-	unsigned enabled:5;	/*
+	unsigned int mdm_ul:1;
+	unsigned int mdm_dl:1;
+	unsigned int diag_dl:1;
+	unsigned int enabled:5;	/*
 				 * Toggle fields are valid if enabled is 0,
 				 * else A-channels must always be used.
 				 */
@@ -379,19 +326,19 @@ struct config_table {
 
 /* This stores all control downlink flags */
 struct ctrl_dl {
-	unsigned DSR:1;
-	unsigned DCD:1;
-	unsigned RI:1;
-	unsigned CTS:1;
-	unsigned reserverd:4;
+	unsigned int DSR:1;
+	unsigned int DCD:1;
+	unsigned int RI:1;
+	unsigned int CTS:1;
+	unsigned int reserverd:4;
 	u8 port;
 } __attribute__ ((packed));
 
 /* This stores all control uplink flags */
 struct ctrl_ul {
-	unsigned DTR:1;
-	unsigned RTS:1;
-	unsigned reserved:6;
+	unsigned int DTR:1;
+	unsigned int RTS:1;
+	unsigned int reserved:6;
 	u8 port;
 } __attribute__ ((packed));
 #endif
@@ -694,7 +641,7 @@ static void dump_table(const struct nozo
 	   dc->config_table.ul_ctrl_len);
 }
 #else
-static __inline__ void dump_table(const struct nozomi *dc) { }
+static inline void dump_table(const struct nozomi *dc) { }
 #endif
 
 /*
@@ -1102,7 +1049,7 @@ static int send_flow_control(struct nozo
 }
 
 /*
- * Handle donlink data, ports that are handled are modem and diagnostics
+ * Handle downlink data, ports that are handled are modem and diagnostics
  * Return 1 - ok
  * Return 0 - toggle fields are out of sync
  */
@@ -1363,7 +1310,7 @@ static ssize_t card_type_show(struct dev
 
 	return sprintf(buf, "%d\n", dc->card_type);
 }
-static DEVICE_ATTR(card_type, 0444, card_type_show, NULL);
+static DEVICE_ATTR(card_type, S_IRUGO, card_type_show, NULL);
 
 static ssize_t open_ttys_show(struct device *dev, struct device_attribute *attr,
 			  char *buf)
@@ -1372,7 +1319,7 @@ static ssize_t open_ttys_show(struct dev
 
 	return sprintf(buf, "%u\n", dc->open_ttys);
 }
-static DEVICE_ATTR(open_ttys, 0444, open_ttys_show, NULL);
+static DEVICE_ATTR(open_ttys, S_IRUGO, open_ttys_show, NULL);
 
 static void make_sysfs_files(struct nozomi *dc)
 {
@@ -1882,7 +1829,10 @@ static void ntty_throttle(struct tty_str
 /* just to discard single character writes */
 static void ntty_put_char(struct tty_struct *tty, unsigned char c)
 {
-	/* FIXME !!! */
+	/*
+	 * card does not react correct when we write single chars
+	 * to the card, so we discard them
+	 */
 	DBG2("PUT CHAR Function: %c", c);
 }
 
author
#263 lore raw
In reply to Linus Torvalds
Quoted 4 lines · Linus Torvalds
Quoted 1 line · Greg KH
Quoted 8 lines
Quoted 2 lines

Here are a pretty large number of kobject, documentation, and driver core patches against your 2.6.24 git tree.

I've merged it all, but it causes lots of scary warnings:

- from the purely broken ones:

ehci_hcd: no version for "struct_module" found: kernel tainted.

Ok, in looking at the code, this should also be showing up for you on a "clean" 2.6.24 release, I didn't change anything in this code path.

That is what taints your kernel with the "F" flag.

Quoted 13 lines

- to the scary ones:

	sysfs: duplicate filename 'ehci_hcd' can not be created
	WARNING: at fs/sysfs/dir.c:424 sysfs_add_one()
	Pid: 610, comm: insmod Tainted: GF       2.6.24-gb47711bf #28
	
	Call Trace:
	 [<ffffffff802bd63c>] sysfs_add_one+0x54/0xbd
	 [<ffffffff802bdbc0>] create_dir+0x4f/0x87
	 [<ffffffff802bdc2d>] sysfs_create_dir+0x35/0x4a
	 [<ffffffff803154c8>] kobject_get+0x12/0x17
	 [<ffffffff80315607>] kobject_add_internal+0xd9/0x194
	 [<ffffffff8031579c>] kobject_add_varg+0x54/0x61
Quoted 8 lines
	 [<ffffffff80261efe>] __alloc_pages+0x66/0x2ee
	 [<ffffffff80315321>] kobject_init+0x42/0x82
	 [<ffffffff80315843>] kobject_init_and_add+0x9a/0xa7
	 [<ffffffff802722c0>] __vmalloc_area_node+0x111/0x135
	 [<ffffffff8025546b>] mod_sysfs_init+0x6e/0x83
	 [<ffffffff802561e8>] sys_init_module+0xa3d/0x1833
	 [<ffffffff8028ebd5>] dput+0x1c/0x10b
	 [<ffffffff8020b3be>] system_call+0x7e/0x83

This is the sysfs core telling you that someone did something stupid :)

Yes, that's new, but the "error" was always there, I just made the warning more visible to get people to pay attention to it, and find the real errors where this happens (and it has found them, which is a good thing.)

But in this case, it doesn't look like the module loading code will detect that we are trying to load a module that is already present until the kobjects are set up here. It's been this way for a long time :(

Rusty, any ideas of us adding a different check for "duplicate" modules like this earlier in the load_module() function, so we don't spend so much effort in building everything up when we don't need to?

I think it's down in the apply_relocate() function where we would finally figure out that something bad is going on here, which seems a bit late to me.

I guess we could just check the list of module names loaded when we try to set up the kobject, that would be simple and easy.

Linus, does the patch below (built tested only) fix the above call trace noise for you? It shouldn't change the taint flag, that's a different issue it seems.

thanks,

greg k-h

---------------------

From: Greg Kroah-Hartman <[email protected]>
Subject: module: bail out of loading duplicate modules early

This should fix the long calltrace when trying to load a module that has been built into the kernel allready.

kernel/module.c +10 -0
index dcb8a2c..3a76a4d 100644
@@ -1210,6 +1210,7 @@ void module_remove_modinfo_attrs(struct module *mod)
 int mod_sysfs_init(struct module *mod)
 {
 	int err;
+	struct kobject *kobj;
 
 	if (!module_sysfs_initialized) {
 		printk(KERN_ERR "%s: module sysfs not initialized\n",
@@ -1217,6 +1218,15 @@ int mod_sysfs_init(struct module *mod)
 		err = -EINVAL;
 		goto out;
 	}
+
+	kobj = kset_find_obj(module_kset, mod->name);
+	if (kobj) {
+		printk(KERN_ERR "%s: module is already loaded\n", mod->name);
+		kobject_put(kobj);
+		err = -EINVAL;
+		goto out;
+	}
+
 	mod->mkobj.mod = mod;
 
 	memset(&mod->mkobj.kobj, 0, sizeof(mod->mkobj.kobj));
author
#20 lore raw

Re: [PATCH 012/196 ver2] nozomi driver

In reply to Frank Seidel
Quoted 7 lines · Frank Seidel
Quoted 4 lines · Greg KH

Frank, can you send me a patch against Linus's current git tree that had the last version of this driver included in it?

That way I can actually apply the changes :)

Sure :-) This one is rebased on the current state in git.

One more time, with a "real" changelog entry that I can use, and a
signed-off-by: so that I can apply it to the tree would be good :)

thanks,

greg k-h

#252 lore raw
In reply to Linus Torvalds
Quoted 2 lines · Linus Torvalds

I'm too lazy to want to do my own initrd. I just use the prepackaged ones and rely on the fact that my private kernel will refuse to load modules that aren't meant for it anyway.

initrds generally aren't prepackaged, but generated on install (at least with Fedora). You can regenerate them with "mkinitrd -f /boot/initrd-2.6.24.img 2.6.24". Also, I find that "make modules_install install" does it automatically from a kernel build.

J

#22 lore raw

Re: [PATCH 012/196 ver2] nozomi driver

In reply to Greg KH

From: Frank Seidel <[email protected]>

Minor cleanups and removal of in-file changelog:

- Correction of misspellings and wrong encoded Name
- changed 'unsigned' to 'unsigned int' for better readability
- use of generic devicefile access macro
- fixed/added explanatory comment to ntty_put_char

---
 drivers/char/nozomi.c |  122 ++++++++++++++------------------------------------
 1 file changed, 36 insertions(+), 86 deletions(-)
drivers/char/nozomi.c +36 -86
@@ -2,7 +2,7 @@
  * nozomi.c  -- HSDPA driver Broadband Wireless Data Card - Globe Trotter
  *
  * Written by: Ulf Jakobsson,
- *             Jan �erfeldt,
+ *             Jan Åkerfeldt,
  *             Stefan Thomasson,
  *
  * Maintained by: Paul Hardwick ([email protected])
@@ -38,60 +38,6 @@
  * --------------------------------------------------------------------------
  */
 
-/*
- * CHANGELOG
- * Version 2.1d
- * 11-November-2007 Jiri Slaby, Frank Seidel
- * - Big rework of multicard support by Jiri
- * - Major cleanups (semaphore to mutex, endianess, no major reservation)
- * - Optimizations
- *
- * Version 2.1c
- * 30-October-2007 Frank Seidel
- * - Completed multicard support
- * - Minor cleanups
- *
- * Version 2.1b
- * 07-August-2007 Frank Seidel
- * - Minor cleanups
- * - theoretical multicard support
- *
- * Version 2.1
- * 03-July-2006 Paul Hardwick
- *
- * - Stability Improvements. Incorporated spinlock wraps patch.
- * - Updated for newer 2.6.14+ kernels (tty_buffer_request_room)
- * - using __devexit macro for tty
- *
- *
- * Version 2.0
- * 08-feb-2006 15:34:10:Ulf
- *
- * -Fixed issue when not waking up line disipine layer, could probably result
- *  in better uplink performance for 2.4.
- *
- * -Fixed issue with big endian during initalization, now proper toggle flags
- *  are handled between preloader and maincode.
- *
- * -Fixed flow control issue.
- *
- * -Added support for setting DTR.
- *
- * -For 2.4 kernels, removing temporary buffer that's not needed.
- *
- * -Reading CTS only for modem port (only port that supports it).
- *
- * -Return 0 in write_room instead of netative value, it's not handled in
- *  upper layer.
- *
- * --------------------------------------------------------------------------
- * Version 1.0
- *
- * First version of driver, only tested with card of type F32_2.
- * Works fine with 2.4 and 2.6 kernels.
- * Driver also support big endian architecture.
- */
-
 /* Enable this to have a lot of debug printouts */
 #define DEBUG
 
@@ -143,8 +89,9 @@ do {								\
 /* Do we need this settable at runtime? */
 static int debug = NOZOMI_DEBUG_LEVEL;
 
-#define D(lvl, args...)  do {if (lvl & debug) NFO(KERN_DEBUG, ##args); } \
-				while (0)
+#define D(lvl, args...)  do \
+			{if (lvl & debug) NFO(KERN_DEBUG, ##args); } \
+			while (0)
 #define D_(lvl, args...) D(lvl, ##args)
 
 /* These printouts are always printed */
@@ -273,13 +220,13 @@ enum port_type {
 /* Big endian */
 
 struct toggles {
-	unsigned enabled:5;	/*
+	unsigned int enabled:5;	/*
 				 * Toggle fields are valid if enabled is 0,
 				 * else A-channels must always be used.
 				 */
-	unsigned diag_dl:1;
-	unsigned mdm_dl:1;
-	unsigned mdm_ul:1;
+	unsigned int diag_dl:1;
+	unsigned int mdm_dl:1;
+	unsigned int mdm_ul:1;
 } __attribute__ ((packed));
 
 /* Configuration table to read at startup of card */
@@ -320,19 +267,19 @@ struct config_table {
 /* This stores all control downlink flags */
 struct ctrl_dl {
 	u8 port;
-	unsigned reserved:4;
-	unsigned CTS:1;
-	unsigned RI:1;
-	unsigned DCD:1;
-	unsigned DSR:1;
+	unsigned int reserved:4;
+	unsigned int CTS:1;
+	unsigned int RI:1;
+	unsigned int DCD:1;
+	unsigned int DSR:1;
 } __attribute__ ((packed));
 
 /* This stores all control uplink flags */
 struct ctrl_ul {
 	u8 port;
-	unsigned reserved:6;
-	unsigned RTS:1;
-	unsigned DTR:1;
+	unsigned int reserved:6;
+	unsigned int RTS:1;
+	unsigned int DTR:1;
 } __attribute__ ((packed));
 
 #else
@@ -340,10 +287,10 @@ struct ctrl_ul {
 
 /* This represents the toggle information */
 struct toggles {
-	unsigned mdm_ul:1;
-	unsigned mdm_dl:1;
-	unsigned diag_dl:1;
-	unsigned enabled:5;	/*
+	unsigned int mdm_ul:1;
+	unsigned int mdm_dl:1;
+	unsigned int diag_dl:1;
+	unsigned int enabled:5;	/*
 				 * Toggle fields are valid if enabled is 0,
 				 * else A-channels must always be used.
 				 */
@@ -379,19 +326,19 @@ struct config_table {
 
 /* This stores all control downlink flags */
 struct ctrl_dl {
-	unsigned DSR:1;
-	unsigned DCD:1;
-	unsigned RI:1;
-	unsigned CTS:1;
-	unsigned reserverd:4;
+	unsigned int DSR:1;
+	unsigned int DCD:1;
+	unsigned int RI:1;
+	unsigned int CTS:1;
+	unsigned int reserverd:4;
 	u8 port;
 } __attribute__ ((packed));
 
 /* This stores all control uplink flags */
 struct ctrl_ul {
-	unsigned DTR:1;
-	unsigned RTS:1;
-	unsigned reserved:6;
+	unsigned int DTR:1;
+	unsigned int RTS:1;
+	unsigned int reserved:6;
 	u8 port;
 } __attribute__ ((packed));
 #endif
@@ -694,7 +641,7 @@ static void dump_table(const struct nozo
 	   dc->config_table.ul_ctrl_len);
 }
 #else
-static __inline__ void dump_table(const struct nozomi *dc) { }
+static inline void dump_table(const struct nozomi *dc) { }
 #endif
 
 /*
@@ -1102,7 +1049,7 @@ static int send_flow_control(struct nozo
 }
 
 /*
- * Handle donlink data, ports that are handled are modem and diagnostics
+ * Handle downlink data, ports that are handled are modem and diagnostics
  * Return 1 - ok
  * Return 0 - toggle fields are out of sync
  */
@@ -1363,7 +1310,7 @@ static ssize_t card_type_show(struct dev
 
 	return sprintf(buf, "%d\n", dc->card_type);
 }
-static DEVICE_ATTR(card_type, 0444, card_type_show, NULL);
+static DEVICE_ATTR(card_type, S_IRUGO, card_type_show, NULL);
 
 static ssize_t open_ttys_show(struct device *dev, struct device_attribute *attr,
 			  char *buf)
@@ -1372,7 +1319,7 @@ static ssize_t open_ttys_show(struct dev
 
 	return sprintf(buf, "%u\n", dc->open_ttys);
 }
-static DEVICE_ATTR(open_ttys, 0444, open_ttys_show, NULL);
+static DEVICE_ATTR(open_ttys, S_IRUGO, open_ttys_show, NULL);
 
 static void make_sysfs_files(struct nozomi *dc)
 {
@@ -1882,7 +1829,10 @@ static void ntty_throttle(struct tty_str
 /* just to discard single character writes */
 static void ntty_put_char(struct tty_struct *tty, unsigned char c)
 {
-	/* FIXME !!! */
+	/*
+	 * card does not react correct when we write single chars
+	 * to the card, so we discard them
+	 */
 	DBG2("PUT CHAR Function: %c", c);
 }
 
#21 lore raw

Re: [PATCH 012/196 ver2] nozomi driver

In reply to Greg KH
Quoted 2 lines · Greg KH

One more time, with a "real" changelog entry that I can use, and a
signed-off-by: so that I can apply it to the tree would be good :)

Oops, sorry. Must have been much too long ago since i sent my last patch :)

Thanks,
Frank

#264 lore raw
In reply to Greg KH
Quoted 8 lines · Greg KH
Quoted 4 lines · Linus Torvalds

- from the purely broken ones:

ehci_hcd: no version for "struct_module" found: kernel tainted.

Ok, in looking at the code, this should also be showing up for you on a "clean" 2.6.24 release, I didn't change anything in this code path.

Ok, I just never noticed, because without any warnings or oopses, it didn't much matter...

Quoted 3 lines

Linus, does the patch below (built tested only) fix the above call trace noise for you? It shouldn't change the taint flag, that's a different issue it seems.

Sadly, I'm now in the process of shutting down all my machines to prepare for "the flight from hell(tm)", so I won't have time to check this right now.

Linus

author
#265 lore raw
Quoted 8 lines · Linus Torvalds
Quoted 3 lines · Greg KH

Linus, does the patch below (built tested only) fix the above call trace noise for you? It shouldn't change the taint flag, that's a different issue it seems.

Sadly, I'm now in the process of shutting down all my machines to prepare for "the flight from hell(tm)", so I won't have time to check this right now.

Ok, I'll queue it up myself in my trees and send it to you in a few days.

Have a nice trip,

greg k-h

Acked-by on v1 93/196
#125 lore raw

Re: [PATCH 093/196] kset: convert ocfs2 to use kset_create

In reply to Greg Kroah-Hartman
Quoted 8 lines · Greg Kroah-Hartman

Dynamically create the kset instead of declaring it statically.

Also use the new kobj_attribute which cleans up this file a _lot_.

Cc Kay Sievers <[email protected]>
Cc Mark Fasheh <[email protected]>
Cc Kurt Hackel <[email protected]>

--
Mark Fasheh
Principal Software Developer, Oracle
[email protected]

#271 lore raw
In reply to Linus Torvalds
Quoted 4 lines · Linus Torvalds

and the problem seems to be that it does all these checks even for modules that will never be loaded, because I use my own kernel, but with the default Fedora initrd (which is trying to load modules for stuff that I already have built in).

Thanks Linus. I'll pass this on to the mkinitrd maintainer. We'll try to get this sorted out for you :)

Jon.

#253 lore raw
In reply to Jeremy Fitzhardinge
Quoted 9 lines · Jeremy Fitzhardinge
Quoted 3 lines · Linus Torvalds

I'm too lazy to want to do my own initrd. I just use the prepackaged ones and rely on the fact that my private kernel will refuse to load modules that aren't meant for it anyway.

initrds generally aren't prepackaged, but generated on install (at least with Fedora). You can regenerate them with "mkinitrd -f /boot/initrd-2.6.24.img 2.6.24". Also, I find that "make modules_install install" does it automatically from a kernel build.

Right. I assumed that Linus was calling mkinitrd but was being bitten by one of the occasional assumptions (I believe we make in that script) that certain things are always modular. I just mailed the maintainer, suggesting we screen against the one of the Modules.* files (perhaps Modules.order might become a good candidate in due course...).

Jon.

#254 lore raw
Quoted 3 lines · Jon Masters

Right. I assumed that Linus was calling mkinitrd but was being bitten by one of the occasional assumptions (I believe we make in that script)

No. I really am not. My /etc/grub.conf looks like this:

	title Linux
	        root (hd0,0)
	        kernel /vmlinuz ro root=/dev/VolGroup00/LogVol00 rhgb quiet
	        initrd /initrd-2.6.23.14-107.fc8.img

ie I literally run the fedora initrd.

I switch kernels, not initrd's. I don't even want to know if the initrd contains some distro-specific setup...

Linus

#187 lore raw

Re: [PATCH 148/196] Infiniband: make ipath driver use default driver groups.

In reply to Greg Kroah-Hartman

Hey Greg,

with Linus's latest kernel v2.6.24-412-gb47711b (which includes the patch in the email I'm replying to), I see the following when I do "modprobe -r ib_ipath" (on a system that actually has ipath hardware):

kernel BUG at fs/sysfs/group.c:74!
invalid opcode: 0000 [1] SMP
CPU 1

 Modules linked in: fan ac battery ipv6 nfs lockd nfs_acl sunrpc dm_snapshot dm_mirror dm_mod loop ide_cd cdrom e1000 amd74xx generic psmouse shpchp pci_hotplug thermal ib_ipath serio_raw ehci_hcd ohci_hcd evdev button i2c_nforce2 ide_core processor ib_core k8temp i2c_core
 Pid: 3975, comm: modprobe Not tainted 2.6.24 #24
 RIP: 0010:[<ffffffff802bdbdb>]  [<ffffffff802bdbdb>] sysfs_remove_group+0x25/0x94
 RSP: 0000:ffff8101fbc33db8  EFLAGS: 00010246
 RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffff81007d8bc070
 RDX: ffff81007d634272 RSI: ffff81007d634d00 RDI: ffffffff80503090
 RBP: ffffffff880a7220 R08: 0000000000000000 R09: ffff81007d8bc070
 R10: 0000000000000000 R11: 00000000fd812590 R12: ffff81007d8bc070
 R13: 00007fffc6f88c80 R14: 0000000000000000 R15: 0000000000000000
 FS:  00002acbe409b6e0(0000) GS:ffff81007e001a00(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
 CR2: 00002acbe3e59de0 CR3: 000000007d482000 CR4: 00000000000006e0
 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
 Process modprobe (pid: 3975, threadinfo ffff8101fbc32000, task ffff8101fbead590)
 Stack:  000000000e9000ff ffff81007d8bc160 ffff81007d8bc070 ffffffff88087574
  ffffc20001734000 ffffc20001734000 ffffffff880a7050 ffffffff88074b26
  ffffffff804bd39a ffff81007d8bc000 ffffffff880a7050 ffffffff804bd39a
 Call Trace:
  [<ffffffff88087574>] :ib_ipath:ipath_device_remove_group+0x20/0x42
  [<ffffffff88074b26>] :ib_ipath:ipath_remove_one+0x9f/0x431
  [<ffffffff803235e5>] pci_device_remove+0x24/0x47
  [<ffffffff8036ec01>] __device_release_driver+0x74/0x97
  [<ffffffff8036f075>] driver_detach+0x96/0xd5
  [<ffffffff8036e568>] bus_remove_driver+0x7b/0x9e
  [<ffffffff803238da>] pci_unregister_driver+0x29/0x7d
  [<ffffffff8809093f>] :ib_ipath:infinipath_cleanup+0x33/0x40
  [<ffffffff8025032a>] sys_delete_module+0x199/0x1cf
  [<ffffffff80318400>] __up_read+0x2/0x8a
  [<ffffffff8020befe>] system_call+0x7e/0x83

 Code: 0f 0b eb fe 48 85 db 74 2e 83 3b 00 75 26 48 c7 c1 d8 ae 43
 RIP  [<ffffffff802bdbdb>] sysfs_remove_group+0x25/0x94
  RSP <ffff8101fbc33db8>

The BUG() in question is the one here:

	void sysfs_remove_group(struct kobject * kobj, 
				const struct attribute_group * grp)
	{
		struct sysfs_dirent *dir_sd = kobj->sd;
		struct sysfs_dirent *sd;
	
		if (grp->name) {
			sd = sysfs_get_dirent(dir_sd, grp->name);
			BUG_ON(!sd);

Any ideas here? I'll continue to try to relearn all the sysfs stuff but a hint my make things go faster.

Thanks,
Roland

#255 lore raw
In reply to Linus Torvalds
Quoted 8 lines · Linus Torvalds
Quoted 3 lines · Jon Masters

Right. I assumed that Linus was calling mkinitrd but was being bitten by one of the occasional assumptions (I believe we make in that script)

No. I really am not. My /etc/grub.conf looks like this:

Quoted 8 lines
	title Linux
	        root (hd0,0)
	        kernel /vmlinuz ro root=/dev/VolGroup00/LogVol00 rhgb quiet
	        initrd /initrd-2.6.23.14-107.fc8.img

ie I literally run the fedora initrd.

I switch kernels, not initrd's. I don't even want to know if the initrd contains some distro-specific setup...

The distro mkinird can reconstruct it containing your freshly built modules (if any) and any other distro goo which needs to go in there. /initrd-2.6.23.14-107.fc8.img doesn't come out of an rpm; its built by an installer script when you install the kernel, and you can run the same script on your kernels.

Does you use "make modules_install install" when you build the kernel? It just does the right thing for me under F8, including rebuilding initrd and updating grub.conf.

J

#99 lore raw

Re: [PATCH 076/196] ecryptfs: remove version_str file from sysfs

In reply to Michael Halcrow
Quoted 9 lines · Michael Halcrow
Quoted 1 line · Greg KH

I could not find any userspace tools or documentation that used it

The version_str handle is only there as a potential convenience for users who need to figure out what their module can and cannot do. I mentioned it in an article in LJ last year. It does not need to be there for any tools to work right, and I do not think that anyone really cares about it at this point, so I have no problem with just ripping it out.

Cool, well ignore my objection then...

Jeff

#188 lore raw

Re: [PATCH 148/196] Infiniband: make ipath driver use default driver groups.

In reply to Roland Dreier

So I think it is coming from the following code in ipath_sysfs.c:

	int ipath_device_create_group(struct device *dev, struct ipath_devdata *dd)
	{
		int ret;
	
		ret = sysfs_create_group(&dev->kobj, &dev_attr_group);
		if (ret)
			goto bail;
	
		ret = sysfs_create_group(&dev->kobj, &dev_counter_attr_group);
		if (ret)
			goto bail_attrs;
	
		sysfs_remove_group(&dev->kobj, &dev_counter_attr_group);
	bail_attrs:
		sysfs_remove_group(&dev->kobj, &dev_attr_group);
	bail:
		return ret;
	}

note that the success path falls through into the error path and removes the groups it just created, which means that on initialization the groups are already removed, so we hit the BUG on the second try to remove the groups on module exit.

And I think this chunk of your patch:

	-	snprintf(unit, sizeof(unit), "%02d", dd->ipath_unit);
	-	ret = sysfs_create_link(&dev->driver->kobj, &dev->kobj, unit);
	-	if (ret == 0)
	-		goto bail;
	-

was what broke it. (Note the "if (ret == 0) then skip error unwinding" code that got deleted by mistake -- not surprising given how hard to read that construction is)

My bad for not testing -mm better. I'll queue this up to fix it:

drivers/infiniband/hw/ipath/ipath_sysfs.c +2 -1
index aa27ca9..e2a6534 100644
@@ -770,7 +770,8 @@ int ipath_device_create_group(struct device *dev, struct ipath_devdata *dd)
 	if (ret)
 		goto bail_attrs;
 
-	sysfs_remove_group(&dev->kobj, &dev_counter_attr_group);
+	return 0;
+
 bail_attrs:
 	sysfs_remove_group(&dev->kobj, &dev_attr_group);
 bail:
author
#189 lore raw

Re: [PATCH 148/196] Infiniband: make ipath driver use default driver groups.

Quoted 34 lines · Roland Dreier

So I think it is coming from the following code in ipath_sysfs.c:

	int ipath_device_create_group(struct device *dev, struct ipath_devdata *dd)
	{
		int ret;
	
		ret = sysfs_create_group(&dev->kobj, &dev_attr_group);
		if (ret)
			goto bail;
	
		ret = sysfs_create_group(&dev->kobj, &dev_counter_attr_group);
		if (ret)
			goto bail_attrs;
	
		sysfs_remove_group(&dev->kobj, &dev_counter_attr_group);
	bail_attrs:
		sysfs_remove_group(&dev->kobj, &dev_attr_group);
	bail:
		return ret;
	}

note that the success path falls through into the error path and removes the groups it just created, which means that on initialization the groups are already removed, so we hit the BUG on the second try to remove the groups on module exit.

And I think this chunk of your patch:

	-	snprintf(unit, sizeof(unit), "%02d", dd->ipath_unit);
	-	ret = sysfs_create_link(&dev->driver->kobj, &dev->kobj, unit);
	-	if (ret == 0)
	-		goto bail;
	-
Quoted 5 lines

was what broke it. (Note the "if (ret == 0) then skip error unwinding" code that got deleted by mistake -- not surprising given how hard to read that construction is)

My bad for not testing -mm better. I'll queue this up to fix it:

Thanks for the fix, and sorry for causing that, it was a complex error path :)

Although a BUG() for when we try to remove a file that is no longer there seems pretty harsh, I think I'll change that to a WARN_ON() so that people just know to fix up their code, not kill the kernel entirely.

thanks,

greg k-h

#225 lore raw

Re: [PATCH 183/196] driver core: fix build with SYSFS=n

In reply to Greg Kroah-Hartman
Quoted 7 lines · Greg Kroah-Hartman

From: Randy Dunlap <[email protected]>

When SYSFS=n and MODULES=y, build ends with:

linux-2.6.24-rc6-mm1/drivers/base/module.c: In function 'module_add_driver':
linux-2.6.24-rc6-mm1/drivers/base/module.c:49: error: 'module_kset' undeclared (first use in this function) make[3]: *** [drivers/base/module.o] Error 1

_PLEASE_ fold such fixes into the patch that introduces the build bugs, prior sending your git trees upstream! (just like Andrew does it with all patches that come via -mm)

Changes like this (and it now leaked into Linus' tree as well) kill bisectability.

Thanks.

Ingo

#256 lore raw
In reply to Jeremy Fitzhardinge
Quoted 25 lines · Jeremy Fitzhardinge
Quoted 13 lines · Linus Torvalds
Quoted 3 lines · Jon Masters

Right. I assumed that Linus was calling mkinitrd but was being bitten by one of the occasional assumptions (I believe we make in that script)

No. I really am not. My /etc/grub.conf looks like this:

	title Linux
	        root (hd0,0)
	        kernel /vmlinuz ro root=/dev/VolGroup00/LogVol00 rhgb quiet
	        initrd /initrd-2.6.23.14-107.fc8.img
Quoted 4 lines

ie I literally run the fedora initrd.

I switch kernels, not initrd's. I don't even want to know if the initrd contains some distro-specific setup...

The distro mkinird can reconstruct it containing your freshly built modules (if any) and any other distro goo which needs to go in there. /initrd-2.6.23.14-107.fc8.img doesn't come out of an rpm; its built by an installer script when you install the kernel, and you can run the same script on your kernels.

Quoted 3 lines

Does you use "make modules_install install" when you build the kernel? It just does the right thing for me under F8, including rebuilding initrd and updating grub.conf.

My wish is that distros would just boot without requiring an initrd. I know how to make them for redhat and debian based distros, but the fact that you can't (easily) cross-build them makes it a very tedious construct.

I can butcher the distros into booting and ignore the errors on bootup that whine that modules are missing, but really.

maintainer
#226 lore raw

Re: [PATCH 183/196] driver core: fix build with SYSFS=n

In reply to Ingo Molnar
Quoted 12 lines · On Fri, 25 Jan 2008 23:25:30 +0100 Ingo Molnar <[email protected]> wrote:
Quoted 7 lines · Greg Kroah-Hartman

From: Randy Dunlap <[email protected]>

When SYSFS=n and MODULES=y, build ends with:

linux-2.6.24-rc6-mm1/drivers/base/module.c: In function 'module_add_driver':
linux-2.6.24-rc6-mm1/drivers/base/module.c:49: error: 'module_kset' undeclared (first use in this function) make[3]: *** [drivers/base/module.o] Error 1

Quoted 7 lines

_PLEASE_ fold such fixes into the patch that introduces the build bugs, prior sending your git trees upstream! (just like Andrew does it with all patches that come via -mm)

Changes like this (and it now leaked into Linus' tree as well) kill bisectability.

Absolutely - this is important. After several hours mucking about I just gave up trying to bisect a 2.6.24-rc1 regression due to hitting 100% build errors and runtime oopses during the bisection. Mainly from networking in that case.

author
#227 lore raw

Re: [PATCH 183/196] driver core: fix build with SYSFS=n

In reply to Ingo Molnar
Quoted 7 lines · Ingo Molnar
Quoted 4 lines · Greg Kroah-Hartman

From: Randy Dunlap <[email protected]>

When SYSFS=n and MODULES=y, build ends with:

Quoted 7 lines
Quoted 3 lines

linux-2.6.24-rc6-mm1/drivers/base/module.c: In function 'module_add_driver':
linux-2.6.24-rc6-mm1/drivers/base/module.c:49: error: 'module_kset' undeclared (first use in this function) make[3]: *** [drivers/base/module.o] Error 1

_PLEASE_ fold such fixes into the patch that introduces the build bugs, prior sending your git trees upstream! (just like Andrew does it with all patches that come via -mm)

For most of these issues I do merge them together.

However, for some odd kernel configurations, like this one, I didn't, my appologies. I'll try to be more careful in the future.

Quoted 2 lines

Changes like this (and it now leaked into Linus' tree as well) kill bisectability.

The odds that a "normal" person has sysfs turned off and modules enabled, trying to bisect things, is pretty slim :)

thanks,

greg k-h

#228 lore raw

Re: [PATCH 183/196] driver core: fix build with SYSFS=n

Quoted 5 lines · Greg KH
Quoted 2 lines

Changes like this (and it now leaked into Linus' tree as well) kill bisectability.

The odds that a "normal" person has sysfs turned off and modules enabled, trying to bisect things, is pretty slim :)

that "slim" combination is what i use for about 25% of all my bisections
- i build, boot and stress-test randconfig configs.

If i find a problem with a given .config, i do _not_ go around and change the .config to make a bisection point work. (and the automated bisection scripts definitely wont do it either.)

so what is a 'weird config' to you is a real testing barrier for others. And crap like that quickly mounts up. Having a buildable and bootable kernel at every bisection point is a _must_.

Please! :-)

Ingo

#115 lore raw

Re: [PATCH 085/196] kset: convert s390 ipl.c to use kset_create

In reply to Greg KH
Quoted 10 lines · Greg KH
Quoted 8 lines · Heiko Carstens
Quoted 3 lines · Greg Kroah-Hartman

Dynamically create the kset instead of declaring it statically. This makes the kobject attributes now work properly that I broke in the previous patch.

Could you please merge this and the previous patch before it goes upstream? Having an intermediate state where things are broken will cause pain and additional work in case of bisecting.

Quoted 6 lines

It will not cause a build error (see the previous patch for details.) The sysfs files will not properly show the correct data, that is all.

The odds that you will hit this in a 'git bisect' is VERY low, and the previous patch states that the files are now broken, so there should not be any confusion regarding any user that might run across this.

The odds are very low, as long as not more patch sets come up which introduce intermediate broken kernels.
What exactly is the advantage of breaking the kernel with patch 1 and then fix it again with patch 2 instead of doing the straight forward conversions all with one patch?

author
#229 lore raw

Re: [PATCH 183/196] driver core: fix build with SYSFS=n

In reply to Ingo Molnar
Quoted 16 lines · Ingo Molnar
Quoted 5 lines · Greg KH
Quoted 2 lines

Changes like this (and it now leaked into Linus' tree as well) kill bisectability.

The odds that a "normal" person has sysfs turned off and modules enabled, trying to bisect things, is pretty slim :)

that "slim" combination is what i use for about 25% of all my bisections
- i build, boot and stress-test randconfig configs.

If i find a problem with a given .config, i do _not_ go around and change the .config to make a bisection point work. (and the automated bisection scripts definitely wont do it either.)

Quoted 5 lines

so what is a 'weird config' to you is a real testing barrier for others. And crap like that quickly mounts up. Having a buildable and bootable kernel at every bisection point is a _must_.

Please! :-)

Yes, I do agree that this is important, I'll work to not let this happen again. Especially now that I have your build scripts, I'm working on setting up something like that myself here.

thanks,

greg k-h

#230 lore raw

Re: [PATCH 183/196] driver core: fix build with SYSFS=n

Quoted 5 lines · Greg KH
Quoted 1 line

Please! :-)

Yes, I do agree that this is important, I'll work to not let this happen again. Especially now that I have your build scripts, I'm working on setting up something like that myself here.

btw., Harvey Harrison has cleaned them up some more, and has told me about KCONFIG_ALLCONFIG, which is very useful when you want to tailor randconfig builds to different testsystems (which might have different minimum driver requirements and different distro requirements for kernel features). Harvey, could you send the latest version of those auto-Kconfig cleanups?

Ingo

#231 lore raw

Re: [PATCH 183/196] driver core: fix build with SYSFS=n

Quoted 8 lines · Ingo Molnar
Quoted 5 lines · Greg KH
Quoted 1 line

Please! :-)

Yes, I do agree that this is important, I'll work to not let this happen again. Especially now that I have your build scripts, I'm working on setting up something like that myself here.

Quoted 6 lines

btw., Harvey Harrison has cleaned them up some more, and has told me about KCONFIG_ALLCONFIG, which is very useful when you want to tailor randconfig builds to different testsystems (which might have different minimum driver requirements and different distro requirements for kernel features). Harvey, could you send the latest version of those auto-Kconfig cleanups?

Sorry, I've been a bit laid up with illness to pull out any upstreamable pieces. Attached is the original version I sent to you that still has the Ingo-specific need_config file. Hopefully I'll be back in action and can finish this soon.

This is functionally equivalent to Ingo's patch at:

http://people.redhat.com/mingo/auto-qa-patches/Kconfig-qa.patch

Instead, create a need_config file and invoke randconfig as:

make randconfig KCONFIG_ALLCONFIG=need_config

---
Ingo, your QA patch ends up being much smaller and works exactly the same as long as you invoke randconfig with the above. I've included a need_config file that has all of the options I removed from your patch suitable for the above KCONFIG_ALLCONFIG use.

Cheers,

Harvey

 arch/x86/Kconfig        |   74 +++++++++++++++++++++++++++++++++++
 arch/x86/Kconfig.needed |   99
+++++++++++++++++++++++++++++++++++++++++++++++
 drivers/atm/Kconfig     |    1 +
 drivers/base/core.c     |    3 +
 init/Kconfig            |   13 ++++++
 init/main.c             |   56 ++++++++++++++++++++++++++
 kernel/time/Kconfig     |   13 ++++++
 lib/Kconfig             |    3 +
 need_config             |   85 ++++++++++++++++++++++++++++++++++++++++
 9 files changed, 347 insertions(+), 0 deletions(-)
arch/x86/Kconfig +41 -0
index 665e4b1..9061f77 100644
@@ -164,6 +164,12 @@ config X86_TRAMPOLINE
 
 config KTIME_SCALAR
        def_bool X86_32
+
+config BOOTPARAM_SUPPORT
+       bool "bootparam support"
+       help
+         support for boot command-line parameters via .config
+
 source "init/Kconfig"
 
 menu "Processor type and features"
@@ -1204,6 +1210,66 @@ config COMPAT_VDSO
 
          If unsure, say Y.
 
+config BOOTPARAM_NMI_WATCHDOG_BIT_0
+       bool "bootparam: nmi_watchdog=X default value - bit 0"
+       depends on BOOTPARAM_SUPPORT
+       help
+         NMI watchdog default, bit 0. Useful for automated testing.
+
+config BOOTPARAM_NMI_WATCHDOG_BIT_1
+       bool "bootparam: nmi_watchdog=X default value - bit 1"
+       depends on BOOTPARAM_SUPPORT
+       help
+         NMI watchdog default, bit 1. Useful for automated testing.
+
+config BOOTPARAM_NOAPIC
+       bool "bootparam: noapic"
+       depends on BOOTPARAM_SUPPORT
+       help
+         if enabled, it has the effect as "noapic" on the boot line
+
+config BOOTPARAM_NOLAPIC
+       bool "bootparam: nolapic"
+       depends on BOOTPARAM_SUPPORT
+       help
+         if enabled, it has the effect as "nolapic" on the boot line
+
+config BOOTPARAM_LAPIC
+       bool "bootparam: lapic"
+       depends on BOOTPARAM_SUPPORT
+       help
+         if enabled, it has the effect as "lapic" on the boot line
+
+config BOOTPARAM_HPET_DISABLE
+       bool "bootparam: hpet=disable"
+       depends on BOOTPARAM_SUPPORT
+       help
+         if enabled, it has the effect as "hpet=disable" on the boot

line
+
+config BOOTPARAM_IDLE_MWAIT

+       bool "bootparam: idle=mwait"
+       depends on BOOTPARAM_SUPPORT
+       help
+         if enabled, it has the effect as "idle=mwait" on the boot line
+
+config BOOTPARAM_IDLE_POLL
+       bool "bootparam: idle=poll"
+       depends on BOOTPARAM_SUPPORT
+       help
+         if enabled, it has the effect as "idle=poll" on the boot line
+
+config BOOTPARAM_HIGHMEM_512M
+       bool "bootparam: highmem=512m"
+       depends on BOOTPARAM_SUPPORT
+       help
+         highmem=512m boot parameter. Useful for automated testing.
+
+config BOOTPARAM_NOPAT
+       bool "bootparam: nopat"
+       depends on BOOTPARAM_SUPPORT
+       help

+ if enabled, it has the effect as "nopat" on the boot line
+
endmenu

config ARCH_ENABLE_MEMORY_HOTPLUG
@@ -1612,3 +1678,11 @@ source "security/Kconfig"
source "crypto/Kconfig"

source "lib/Kconfig"
+
+config X86_32_ALWAYS_ON

+       bool
+       default y
+       depends on X86_32
+       select X86_PC
+       select PCI_GOANY

+

arch/x86/Kconfig.needed new file +99 -0

99 lines not on this page · raw message

drivers/atm/Kconfig +1 -0
index b554eda..caf4d20 100644
@@ -344,6 +344,7 @@ config ATM_FORE200E_MAYBE
 config ATM_FORE200E_PCA
        bool "PCA-200E support"
        depends on ATM_FORE200E_MAYBE && PCI
+       select ATM_FORE200E_PCA_DEFAULT_FW if PREVENT_FIRMWARE_BUILD
        help
          Say Y here if you want your PCA-200E cards to be probed.
 
drivers/base/core.c +0 -0
index 2683eac..84e61f5 100644
@@ -104,7 +104,10 @@ static void device_release(struct kobject * kobj)
                printk(KERN_ERR "Device '%s' does not have a release()

function, "
"it is broken and must be fixed.\n", dev->bus_id);
+#if 0
+ // not a real bug:

                WARN_ON(1);
+#endif
        }

}

init/Kconfig +13 -0
index b9d11a8..add6333 100644
@@ -324,6 +324,19 @@ config CPUSETS
 
          Say N if unsure.
 
+config BOOTPARAM_MAXCPUS_1
+       bool "bootparam: maxcpus=1"
+       depends on BOOTPARAM_SUPPORT
+       help
+         if enabled, it has the effect as "maxcpus=1" on the boot line
+
+config BOOTPARAM_NOSMP
+       bool "bootparam: nosmp"
+       depends on BOOTPARAM_SUPPORT
+       help
+         if enabled, it has the effect as "nosmp" on the boot line
+
+
 config FAIR_GROUP_SCHED
        bool "Fair group CPU scheduler"
        default y
init/main.c +52 -0

61 lines not on this page · raw message

do_early_param);
+

        done = 1;

}

@@ -511,6 +564,9 @@ asmlinkage void __init start_kernel(void)

        smp_setup_processor_id();

+ /* Build-time simulated boot parameters: */
+ strncat(boot_command_line, bootparam_command_line,
COMMAND_LINE_SIZE);
+
/*
* Need to run as early as possible, to initialize the
* lockdep hash:

kernel/time/Kconfig +13 -0
index 8d53106..a6b3b23 100644
@@ -14,6 +14,12 @@ config NO_HZ
          only trigger on an as-needed basis both when the system is
          busy and when the system is idle.
 
+config BOOTPARAM_NO_HZ_OFF
+       bool "bootparam: no_hz"
+       depends on BOOTPARAM_SUPPORT
+       help
+         if enabled, it has the effect as "no_hz=off" on the boot line
+
 config HIGH_RES_TIMERS
        bool "High Resolution Timer Support"
        depends on GENERIC_TIME && GENERIC_CLOCKEVENTS
@@ -28,3 +34,10 @@ config GENERIC_CLOCKEVENTS_BUILD
        default y
        depends on GENERIC_CLOCKEVENTS || GENERIC_CLOCKEVENTS_MIGR
 
+config BOOTPARAM_HIGHRES_OFF
+       bool "bootparam: highres=0"
+       depends on BOOTPARAM_SUPPORT
+       help
+         if enabled, it has the effect as "highres=0" on the boot line
+
+
lib/Kconfig +3 -0
index ba3d104..a4537df 100644
@@ -142,3 +142,6 @@ config CHECK_SIGNATURE
        bool
 
 endmenu
+
+source "arch/x86/Kconfig.needed"
+
need_config new file +85 -0

85 lines not on this page · raw message

Signature · 1 line
1.5.4.rc3.1118.gf6754c
#257 lore raw
In reply to Peter Zijlstra
Quoted 4 lines · Peter Zijlstra

My wish is that distros would just boot without requiring an initrd. I know how to make them for redhat and debian based distros, but the fact that you can't (easily) cross-build them makes it a very tedious construct.

all it takes for me on Fedora is to boot a modular distro kernel once, then copy the /dev to the real (persistent) /dev:

mkdir /tmp2
mount /dev/sda1 /tmp2
cp -a /dev/* /tmp2/dev/

and from that point on a bzImage/vmlinuz can boot up on Fedora without any problems (as long as it has the right drivers built in), and the initrd line can be removed from grub.conf.

Ingo

#258 lore raw
Quoted 10 lines · Ingo Molnar
Quoted 4 lines · Peter Zijlstra

My wish is that distros would just boot without requiring an initrd. I know how to make them for redhat and debian based distros, but the fact that you can't (easily) cross-build them makes it a very tedious construct.

all it takes for me on Fedora is to boot a modular distro kernel once, then copy the /dev to the real (persistent) /dev:

Quoted 7 lines

mkdir /tmp2
mount /dev/sda1 /tmp2
cp -a /dev/* /tmp2/dev/

and from that point on a bzImage/vmlinuz can boot up on Fedora without any problems (as long as it has the right drivers built in), and the initrd line can be removed from grub.conf.

Yeah, I usually do the same but with a bind mount, still it would be grand if such things would not be needed.

#259 lore raw
Quoted 15 lines · Peter Zijlstra
Quoted 14 lines · Ingo Molnar
Quoted 4 lines · Peter Zijlstra

My wish is that distros would just boot without requiring an initrd. I know how to make them for redhat and debian based distros, but the fact that you can't (easily) cross-build them makes it a very tedious construct.

all it takes for me on Fedora is to boot a modular distro kernel once, then copy the /dev to the real (persistent) /dev:

mkdir /tmp2
mount /dev/sda1 /tmp2
cp -a /dev/* /tmp2/dev/

Quoted 6 lines
Quoted 3 lines

and from that point on a bzImage/vmlinuz can boot up on Fedora without any problems (as long as it has the right drivers built in), and the initrd line can be removed from grub.conf.

Yeah, I usually do the same but with a bind mount, still it would be grand if such things would not be needed.

Agreed. But it's not likely to be a priority - all the vendors want completely modular kernels. But now we see what Linus wants to do, perhaps we can try to be a bit more friendly toward that. It's not actually rocket science, after all. I was concerned that he wanted to use the modules in the initrd, but now I see Linus, and everyone else, just want to do what I also secretly do, and just not use an initrd.

Isn't it funny. We all secretly hate using initrds ourselves :)

Jon.

#260 lore raw
In reply to Ingo Molnar
Quoted 10 lines · Ingo Molnar

all it takes for me on Fedora is to boot a modular distro kernel once, then copy the /dev to the real (persistent) /dev:

mkdir /tmp2
mount /dev/sda1 /tmp2
cp -a /dev/* /tmp2/dev/

and from that point on a bzImage/vmlinuz can boot up on Fedora without any problems (as long as it has the right drivers built in), and the initrd line can be removed from grub.conf.

Tried something like that once - it didn't play nice with the fact that I have root-on-LVM, so you need an initrd to do the 'lvm vgchange -a' and get it online.

#79 lore raw

Re: [PATCH 063/196] kset: convert /sys/devices to use kset_create

In reply to Greg Kroah-Hartman
Quoted 3 lines · Greg Kroah-Hartman

Dynamically create the kset instead of declaring it statically. We also rename devices_subsys to devices_kset to catch all users of the variable.

Guess what, you broke powerpc again!

olof@quad:~/work/linux/k.org $ git grep devices_subsys arch/powerpc/kernel/vio.c:extern struct kset devices_subsys; /* needed for vio_find_name() */
arch/powerpc/kernel/vio.c: found = kset_find_obj(&devices_subsys, kobj_name);

Obviously causes build failues, even of ppc64_defconfig.

(I can unfortunately not boot test, since I lack hardware that uses vio)

arch/powerpc/kernel/vio.c +2 -2
index 19a5656..ee752ab 100644
@@ -37,7 +37,7 @@
 #include <asm/iseries/hv_call_xm.h>
 #include <asm/iseries/iommu.h>
 
-extern struct kset devices_subsys; /* needed for vio_find_name() */
+extern struct kset *devices_kset; /* needed for vio_find_name() */
 
 static struct bus_type vio_bus_type;
 
@@ -369,7 +369,7 @@ static struct vio_dev *vio_find_name(const char *kobj_name)
 {
 	struct kobject *found;
 
-	found = kset_find_obj(&devices_subsys, kobj_name);
+	found = kset_find_obj(devices_kset, kobj_name);
 	if (!found)
 		return NULL;
 
#266 lore raw
In reply to Greg KH
Quoted 45 lines · On Saturday 26 January 2008 06:42:19 Greg KH wrote:
Quoted 9 lines · Linus Torvalds
Quoted 2 lines · Greg KH

Here are a pretty large number of kobject, documentation, and driver core patches against your 2.6.24 git tree.

I've merged it all, but it causes lots of scary warnings:

- from the purely broken ones:

ehci_hcd: no version for "struct_module" found: kernel tainted.

Ok, in looking at the code, this should also be showing up for you on a "clean" 2.6.24 release, I didn't change anything in this code path.

That is what taints your kernel with the "F" flag.

Quoted 13 lines

- to the scary ones:

	sysfs: duplicate filename 'ehci_hcd' can not be created
	WARNING: at fs/sysfs/dir.c:424 sysfs_add_one()
	Pid: 610, comm: insmod Tainted: GF       2.6.24-gb47711bf #28

	Call Trace:
	 [<ffffffff802bd63c>] sysfs_add_one+0x54/0xbd
	 [<ffffffff802bdbc0>] create_dir+0x4f/0x87
	 [<ffffffff802bdc2d>] sysfs_create_dir+0x35/0x4a
	 [<ffffffff803154c8>] kobject_get+0x12/0x17
	 [<ffffffff80315607>] kobject_add_internal+0xd9/0x194
	 [<ffffffff8031579c>] kobject_add_varg+0x54/0x61
Quoted 8 lines
	 [<ffffffff80261efe>] __alloc_pages+0x66/0x2ee
	 [<ffffffff80315321>] kobject_init+0x42/0x82
	 [<ffffffff80315843>] kobject_init_and_add+0x9a/0xa7
	 [<ffffffff802722c0>] __vmalloc_area_node+0x111/0x135
	 [<ffffffff8025546b>] mod_sysfs_init+0x6e/0x83
	 [<ffffffff802561e8>] sys_init_module+0xa3d/0x1833
	 [<ffffffff8028ebd5>] dput+0x1c/0x10b
	 [<ffffffff8020b3be>] system_call+0x7e/0x83

This is the sysfs core telling you that someone did something stupid :)

Yes, that's new, but the "error" was always there, I just made the warning more visible to get people to pay attention to it, and find the real errors where this happens (and it has found them, which is a good thing.)

Quoted 7 lines

But in this case, it doesn't look like the module loading code will detect that we are trying to load a module that is already present until the kobjects are set up here. It's been this way for a long time :(

Rusty, any ideas of us adding a different check for "duplicate" modules like this earlier in the load_module() function, so we don't spend so much effort in building everything up when we don't need to?

module.c:1832 (in load_module)

	if (find_module(mod->name)) {
		err = -EEXIST;
		goto free_mod;
	}

That's pretty early, and before this backtrace.

Even for simultaneous loads, there's a mutex which protects from here to the list insertion.

Puzzled,
Rusty.

author
#80 lore raw

Re: [PATCH 063/196] kset: convert /sys/devices to use kset_create

In reply to Olof Johansson
Quoted 6 lines · Olof Johansson
Quoted 3 lines · Greg Kroah-Hartman

Dynamically create the kset instead of declaring it statically. We also rename devices_subsys to devices_kset to catch all users of the variable.

Guess what, you broke powerpc again!

I did this ON PURPOSE!!!

The linux-kernel archives hold the details, and I was told by the PPC64 IBM people that they would fix this properly for 2.6.25, and not to hold back on my changes. This has been known for many months now.

Quoted 16 lines

olof@quad:~/work/linux/k.org $ git grep devices_subsys arch/powerpc/kernel/vio.c:extern struct kset devices_subsys; /* needed for vio_find_name() */
arch/powerpc/kernel/vio.c: found = kset_find_obj(&devices_subsys, kobj_name);

Obviously causes build failues, even of ppc64_defconfig.

(I can unfortunately not boot test, since I lack hardware that uses vio)

arch/powerpc/kernel/vio.c +0 -0
index 19a5656..ee752ab 100644

arch/powerpc/kernel/vio.c line 40

Quoted 5 lines
arch/powerpc/kernel/vio.c +1 -1
@@ -37,7 +37,7 @@
 #include <asm/iseries/hv_call_xm.h>
 #include <asm/iseries/iommu.h>
 
-extern struct kset devices_subsys; /* needed for vio_find_name() */
+extern struct kset *devices_kset; /* needed for vio_find_name() */

No, this just papers over the real problem here. For some reason, the vio code thinks it is acceptable to walk the whole device tree and match by a name and just assume that they got the correct device. You call this "enterprise grade"? :)

You need to just put your device on a real bus, and then just walk the bus. That's the ONLY way you can guarantee the proper name will return what you want, and you get the pointer that you really think you are getting.

There is a reason that devices_kset is not exported, don't make me go and have to name it something like:
devices_kset_dont_touch_this_or_gregkh_will_make_fun_of_you

Or I'll just mush 3 files in the driver core together and keep the symbol from being accessible at all.

So no, I'm going to leave the build broken for this code, because that is what it really is.

Please fix it correctly.

thanks,

greg k-h

author
#116 lore raw

Re: [PATCH 085/196] kset: convert s390 ipl.c to use kset_create

In reply to Heiko Carstens
Quoted 18 lines · Heiko Carstens
Quoted 10 lines · Greg KH
Quoted 8 lines · Heiko Carstens
Quoted 3 lines · Greg Kroah-Hartman

Dynamically create the kset instead of declaring it statically. This makes the kobject attributes now work properly that I broke in the previous patch.

Could you please merge this and the previous patch before it goes upstream? Having an intermediate state where things are broken will cause pain and additional work in case of bisecting.

Quoted 6 lines

It will not cause a build error (see the previous patch for details.) The sysfs files will not properly show the correct data, that is all.

The odds that you will hit this in a 'git bisect' is VERY low, and the previous patch states that the files are now broken, so there should not be any confusion regarding any user that might run across this.

Quoted 5 lines

The odds are very low, as long as not more patch sets come up which introduce intermediate broken kernels.
What exactly is the advantage of breaking the kernel with patch 1 and then fix it again with patch 2 instead of doing the straight forward conversions all with one patch?

I was trying to do one logical thing at a time with this driver as I did not have the hardware to test, and I could not even build the code at the time.

In looking more closer, I think the 084 patch might still work properly, but I can't guarantee it as the the default kobject parent might not be pointing to the correct attribute at the time. I know 085 fixes this to be sure that it will work properly.

It helped in reviewing this code by the other s390 developers to have this in at least 2 pieces, to try to untangle the mess of sysfs files, ksets, and other attrocities that you all have grown into over the years.

So again, I'm sorry if this happens to break your run-time tests when doing a 'git bisect', but as I explicitly stated it did in the patch, I think everyone is properly forwarned :)

This core rework was tough to do, there was a reason no one had done it before. Now it is cleaner, smaller, able to be understood by at least one active kernel developer, if not more, and it's documented, with working examples. If the downside of this effort is only this one thing (note that others are finally finding real bugs...) I'll be very happy.

thanks,

greg k-h

author
#267 lore raw
In reply to Rusty Russell
Quoted 54 lines · Rusty Russell
Quoted 45 lines · On Saturday 26 January 2008 06:42:19 Greg KH wrote:
Quoted 9 lines · Linus Torvalds
Quoted 2 lines · Greg KH

Here are a pretty large number of kobject, documentation, and driver core patches against your 2.6.24 git tree.

I've merged it all, but it causes lots of scary warnings:

- from the purely broken ones:

ehci_hcd: no version for "struct_module" found: kernel tainted.

Ok, in looking at the code, this should also be showing up for you on a "clean" 2.6.24 release, I didn't change anything in this code path.

That is what taints your kernel with the "F" flag.

Quoted 13 lines

- to the scary ones:

	sysfs: duplicate filename 'ehci_hcd' can not be created
	WARNING: at fs/sysfs/dir.c:424 sysfs_add_one()
	Pid: 610, comm: insmod Tainted: GF       2.6.24-gb47711bf #28

	Call Trace:
	 [<ffffffff802bd63c>] sysfs_add_one+0x54/0xbd
	 [<ffffffff802bdbc0>] create_dir+0x4f/0x87
	 [<ffffffff802bdc2d>] sysfs_create_dir+0x35/0x4a
	 [<ffffffff803154c8>] kobject_get+0x12/0x17
	 [<ffffffff80315607>] kobject_add_internal+0xd9/0x194
	 [<ffffffff8031579c>] kobject_add_varg+0x54/0x61
Quoted 8 lines
	 [<ffffffff80261efe>] __alloc_pages+0x66/0x2ee
	 [<ffffffff80315321>] kobject_init+0x42/0x82
	 [<ffffffff80315843>] kobject_init_and_add+0x9a/0xa7
	 [<ffffffff802722c0>] __vmalloc_area_node+0x111/0x135
	 [<ffffffff8025546b>] mod_sysfs_init+0x6e/0x83
	 [<ffffffff802561e8>] sys_init_module+0xa3d/0x1833
	 [<ffffffff8028ebd5>] dput+0x1c/0x10b
	 [<ffffffff8020b3be>] system_call+0x7e/0x83

This is the sysfs core telling you that someone did something stupid :)

Yes, that's new, but the "error" was always there, I just made the warning more visible to get people to pay attention to it, and find the real errors where this happens (and it has found them, which is a good thing.)

Quoted 7 lines

But in this case, it doesn't look like the module loading code will detect that we are trying to load a module that is already present until the kobjects are set up here. It's been this way for a long time :(

Rusty, any ideas of us adding a different check for "duplicate" modules like this earlier in the load_module() function, so we don't spend so much effort in building everything up when we don't need to?

Quoted 8 lines

module.c:1832 (in load_module)

	if (find_module(mod->name)) {
		err = -EEXIST;
		goto free_mod;
	}

That's pretty early, and before this backtrace.

But that doesn't catch the case here, of trying to load a module when the code itself is already built into the kernel. For that we are relying on the sysfs core to tell us we have a duplicate name problem, which happens much later.

Is there any test you can do sooner, or is relying on the sysfs test acceptable?

thanks,

greg k-h

#262 lore raw
In reply to Linus Torvalds
Quoted 8 lines · On Fri, 25 Jan 2008 11:11:48 -0800 (PST) Linus Torvalds…
Quoted 4 lines · Greg KH

That's really wierd, I don't see that at all here just running with your 2.6.24 + my git tree and lots of USB drivers built into the kernel also (like ehci_hcd).

Quoted 6 lines

But do you use an initrd that tries to load the same driver too?

I'm too lazy to want to do my own initrd. I just use the prepackaged ones and rely on the fact that my private kernel will refuse to load modules that aren't meant for it anyway.

you know about "make install" right? That copies the needed files to /boot, adds them to grub AND makes an initrd for you.. all for free ;)

Signature · 3 lines
If you want to reach me at my work email, use [email protected]
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org
#268 lore raw
In reply to Greg KH
Quoted 5 lines · On Saturday 26 January 2008 16:35:09 Greg KH wrote:
Quoted 1 line · Rusty Russell

That's pretty early, and before this backtrace.

But that doesn't catch the case here, of trying to load a module when the code itself is already built into the kernel.

Ah, I missed that, sorry.

Quoted 6 lines

For that we are
relying on the sysfs core to tell us we have a duplicate name problem, which happens much later.

Is there any test you can do sooner, or is relying on the sysfs test acceptable?

As you pointed out, that's always been a "configure your kernel correctly, stupid" kind of bug. Nicer would be to have a list of in-kernel "modules" generated by the build system, but sysfs is there and it's easy to hang our hats off...

So, no objections to this with that as a FIXME, and a change so the message says "module is already built into the kernel".

Thanks,
Rusty.

#81 lore raw

Re: [PATCH 063/196] kset: convert /sys/devices to use kset_create

In reply to Greg KH
Quoted 6 lines · Greg KH
Quoted 5 lines · Olof Johansson
Quoted 3 lines · Greg Kroah-Hartman

Dynamically create the kset instead of declaring it statically. We also rename devices_subsys to devices_kset to catch all users of the variable.

Quoted 7 lines
Quoted 1 line

Guess what, you broke powerpc again!

I did this ON PURPOSE!!!

The linux-kernel archives hold the details, and I was told by the PPC64 IBM people that they would fix this properly for 2.6.25, and not to hold back on my changes. This has been known for many months now.

Yeah, my bad. :( I thought this was new, but it was just not exposed by my scripts because of the EHEA build errors (they were actual compile errors, while this was a link error, so it never go this far). That's why I didn't see it in -rc8-mm1 and thought it was new.

Quoted 8 lines

arch/powerpc/kernel/vio.c line 40

Quoted 2 lines
arch/powerpc/kernel/vio.c +1 -1
-extern struct kset devices_subsys; /* needed for vio_find_name() */
+extern struct kset *devices_kset; /* needed for vio_find_name() */

No, this just papers over the real problem here. For some reason, the vio code thinks it is acceptable to walk the whole device tree and match by a name and just assume that they got the correct device. You call this "enterprise grade"? :)

Quoted 4 lines

You need to just put your device on a real bus, and then just walk the bus. That's the ONLY way you can guarantee the proper name will return what you want, and you get the pointer that you really think you are getting.

Hmm, they are already on a bus. Odd, must be done like this for legacy reasons.

[...]

Quoted 4 lines

So no, I'm going to leave the build broken for this code, because that is what it really is.

Please fix it correctly.

Alright, I'll leave that to people who care about vio and can test the proper fix. After a quick glance it looks like it should be easy to use bus_find_device() for it instead.

-Olof

#269 lore raw
In reply to Rusty Russell
Quoted 8 lines · Rusty Russell

module.c:1832 (in load_module)

	if (find_module(mod->name)) {
		err = -EEXIST;
		goto free_mod;
	}
Quoted 4 lines

That's pretty early, and before this backtrace.

Even for simultaneous loads, there's a mutex which protects from here to the list insertion.

My problem isn't trying to load the same module twice.

My problem is that the *driver* already exists (because it's compiled in), and has already initialized itself, and has already registered.

Then, initrd tries to load an old module for that driver.

So no simultaneous loading, no two modules, simple two *drivers* with the same module names - but one was compiled in, and the other will fail because it doesn't have the required linkages (ie it will failt the modversions checks).

But even before it fails the modversion checks, it apparently does various ugly things that clash with the built-in driver.

At least that seems to be the case.

Linus

#261 lore raw
In reply to Peter Zijlstra
Quoted 5 lines · Peter Zijlstra

My wish is that distros would just boot without requiring an initrd. I know how to make them for redhat and debian based distros, but the fact that you can't (easily) cross-build them makes it a very tedious construct.

Debian is easy enough - make sure the drivers for the root device and root fs is built-in, and you can drop the initrd. Takes a second or two off the boot, and some more off the build.

Helge Hafting

#143 lore raw

Re: [PATCH 108/196] Kobject: change net/bridge to use kobject_create_and_add

In reply to Greg KH
Quoted 6 lines · Greg KH
Quoted 2 lines

Okay, but where is the new kobject freed?

In the call to kobject_unregister(), which has then later in the series been converted to a call to kobject_put().

Hm, working on LDD 3.1? :-)

author
#144 lore raw

Re: [PATCH 108/196] Kobject: change net/bridge to use kobject_create_and_add

Quoted 9 lines · Jan Engelhardt
Quoted 6 lines · Greg KH
Quoted 2 lines

Okay, but where is the new kobject freed?

In the call to kobject_unregister(), which has then later in the series been converted to a call to kobject_put().

Hm, working on LDD 3.1? :-)

No, unfortunatly :(

Actually, the documentation that was written in this patch series, would be good to replace the existing kobject documentation in LDD 3. But it's a bit hard to just replace a chapter at a time in a book that is already published, we really don't have the mechanism in place for such a thing...

thanks,

greg k-h

#270 lore raw
In reply to Linus Torvalds
Quoted 4 lines · On Sunday 27 January 2008 17:42:28 Linus Torvalds wrote:

My problem is that the *driver* already exists (because it's compiled in), and has already initialized itself, and has already registered.

Then, initrd tries to load an old module for that driver.

I hate to say it, but this is user error. And it used to be that for some drivers you'd actually end up with two in-kernel if you did that.

But if even *you* don't get this right, it should finally prompt us to fix this...

Thanks,
Rusty.