Netdev List
 help / color / mirror / Atom feed
* Re: Another oops + repost
From: Eric W. Biederman @ 2010-07-26  9:45 UTC (permalink / raw)
  To: Martín Ferrari; +Cc: netdev, 577640
In-Reply-To: <AANLkTimC8q6_ZU60VX5SmXGqsD+RCpf4RaF3MLQptsG4@mail.gmail.com>

Martín Ferrari <martin.ferrari@gmail.com> writes:

> Hi,
>
> On Thu, Jul 22, 2010 at 18:43, Eric W. Biederman <ebiederm@xmission.com> wrote:
>
>>> First of all, I would like to know if anybody was able to fix this
>>> problem  that got kinda lost in the thread:
>>
>> I can't reproduce this on 2.6.35-rc1+
>>
>> Can you please test a 2.6.35-rc version?  If you can still reproduce
>> it there can you send me your .config?  Otherwise I expect my last
>> round of changes to sysfs fixed whatever was the underlying problem.
>
> I just download and compiled rc6, and all of these problems seem to be
> solved. Thanks a lot!

Welcome.  I'm glad to hear there wasn't some weird corner case
that I had missed.

Eric

^ permalink raw reply

* Re: [PATCH] drop_monitor: use genl_register_family_with_ops()
From: Neil Horman @ 2010-07-26 10:44 UTC (permalink / raw)
  To: Changli Gao; +Cc: David S. Miller, netdev, linux-kernel
In-Reply-To: <1280136017-17526-1-git-send-email-xiaosuo@gmail.com>

On Mon, Jul 26, 2010 at 05:20:17PM +0800, Changli Gao wrote:
> Signed-off-by: Changli Gao <xiaosuo@gmail.com>

> ----
>  net/core/drop_monitor.c |   19 +++++--------------
>  1 file changed, 5 insertions(+), 14 deletions(-)
> diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c
> index 646ef3b..bdb0e96 100644
> --- a/net/core/drop_monitor.c
> +++ b/net/core/drop_monitor.c
> @@ -357,21 +357,12 @@ static int __init init_net_drop_monitor(void)
>  		return -ENOSPC;
>  	}
>  
> -	if (genl_register_family(&net_drop_monitor_family) < 0) {
> +	rc = genl_register_family_with_ops(&net_drop_monitor_family,
> +					   dropmon_ops,
> +					   ARRAY_SIZE(dropmon_ops));
> +	if (rc) {
>  		printk(KERN_ERR "Could not create drop monitor netlink family\n");
> -		return -EFAULT;
> -	}
> -
> -	rc = -EFAULT;
> -
> -	for (i = 0; i < ARRAY_SIZE(dropmon_ops); i++) {
> -		ret = genl_register_ops(&net_drop_monitor_family,
> -					&dropmon_ops[i]);
> -		if (ret) {
> -			printk(KERN_CRIT "Failed to register operation %d\n",
> -				dropmon_ops[i].cmd);
> -			goto out_unreg;
> -		}
> +		return rc;
>  	}
>  
>  	rc = register_netdevice_notifier(&dropmon_net_notifier);
> 

Looks good to me, thanks!
Acked-by: Neil Horman <nhorman@tuxdriver.com>

^ permalink raw reply

* [PATCH V4] Export SMBIOS provided firmware instance and label to sysfs
From: Narendra K @ 2010-07-26 10:56 UTC (permalink / raw)
  To: netdev, linux-hotplug, linux-pci
  Cc: matt_domsch, charles_rose, jordan_hargrave, vijay_nijhawan

Hello,

V3 -> V4:

Updated the contact field in Documentation/ABI directory.

Please consider for inclusion -

From: Narendra K <narendra_k@dell.com>
Subject: [PATCH] Export SMBIOS provided firmware instance and label to sysfs

This patch exports SMBIOS provided firmware instance and label
of onboard pci devices to sysfs

Signed-off-by: Jordan Hargrave <jordan_hargrave@dell.com>
Signed-off-by: Narendra K <narendra_k@dell.com>
---
 Documentation/ABI/testing/sysfs-bus-pci |   27 ++++++
 drivers/firmware/dmi_scan.c             |   25 ++++++
 drivers/pci/Makefile                    |    3 +
 drivers/pci/pci-label.c                 |  143 +++++++++++++++++++++++++++++++
 drivers/pci/pci-sysfs.c                 |    5 +
 drivers/pci/pci.h                       |    9 ++
 include/linux/dmi.h                     |    9 ++
 7 files changed, 221 insertions(+), 0 deletions(-)
 create mode 100644 drivers/pci/pci-label.c

diff --git a/Documentation/ABI/testing/sysfs-bus-pci b/Documentation/ABI/testing/sysfs-bus-pci
index 428676c..11855ca 100644
--- a/Documentation/ABI/testing/sysfs-bus-pci
+++ b/Documentation/ABI/testing/sysfs-bus-pci
@@ -179,3 +179,30 @@ Contact:	linux-pci@vger.kernel.org
 Description:
 		This symbolic link points to the PCI hotplug controller driver
 		module that manages the hotplug slot.
+
+What:		/sys/bus/pci/devices/.../label
+Date:		July 2010
+Contact:	Narendra K <narendra_k@dell.com>, linux-bugs@dell.com
+Description:
+		Reading this attribute will provide the firmware
+		given name(SMBIOS type 41 string) of the PCI device.
+		The attribute will be created only if the firmware
+		has given a name to the PCI device.
+Users:
+		Userspace applications interested in knowing the
+		firmware assigned name of the PCI device.
+
+What:		/sys/bus/pci/devices/.../index
+Date:		July 2010
+Contact:	Narendra K <narendra_k@dell.com>, linux-bugs@dell.com
+Description:
+		Reading this attribute will provide the firmware
+		given instance(SMBIOS type 41 device type instance)
+		of the PCI device. The attribute will be created
+		only if the firmware has given a device type instance
+		to the PCI device.
+Users:
+		Userspace applications interested in knowing the
+		firmware assigned device type instance of the PCI
+		device that can help in understanding the firmware
+		intended order of the PCI device.
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index d464672..b3d22d6 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -277,6 +277,29 @@ static void __init dmi_save_ipmi_device(const struct dmi_header *dm)
 	list_add_tail(&dev->list, &dmi_devices);
 }
 
+static void __init dmi_save_dev_onboard(int instance, int segment, int bus,
+					int devfn, const char *name)
+{
+	struct dmi_dev_onboard *onboard_dev;
+
+	onboard_dev = dmi_alloc(sizeof(*onboard_dev) + strlen(name) + 1);
+	if (!onboard_dev) {
+		printk(KERN_ERR "dmi_save_dev_onboard: out of memory.\n");
+		return;
+	}
+	onboard_dev->instance = instance;
+	onboard_dev->segment = segment;
+	onboard_dev->bus = bus;
+	onboard_dev->devfn = devfn;
+
+	strcpy((char *)&onboard_dev[1], name);
+	onboard_dev->dev.type = DMI_DEV_TYPE_DEV_ONBOARD;
+	onboard_dev->dev.name = (char *)&onboard_dev[1];
+	onboard_dev->dev.device_data = onboard_dev;
+
+	list_add(&onboard_dev->dev.list, &dmi_devices);
+}
+
 static void __init dmi_save_extended_devices(const struct dmi_header *dm)
 {
 	const u8 *d = (u8*) dm + 5;
@@ -285,6 +308,8 @@ static void __init dmi_save_extended_devices(const struct dmi_header *dm)
 	if ((*d & 0x80) == 0)
 		return;
 
+	dmi_save_dev_onboard(*(d+1), *(u16 *)(d+2), *(d+4), *(d+5),
+			     dmi_string_nosave(dm, *(d-1)));
 	dmi_save_one_device(*d & 0x7f, dmi_string_nosave(dm, *(d - 1)));
 }
 
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
index 0b51857..dc1aa09 100644
--- a/drivers/pci/Makefile
+++ b/drivers/pci/Makefile
@@ -55,6 +55,9 @@ obj-$(CONFIG_MICROBLAZE) += setup-bus.o
 #
 obj-$(CONFIG_ACPI)    += pci-acpi.o
 
+# SMBIOS provided firmware instance and labels
+obj-$(CONFIG_DMI)    += pci-label.o
+
 # Cardbus & CompactPCI use setup-bus
 obj-$(CONFIG_HOTPLUG) += setup-bus.o
 
diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c
new file mode 100644
index 0000000..111500e
--- /dev/null
+++ b/drivers/pci/pci-label.c
@@ -0,0 +1,143 @@
+/*
+ * Purpose: Export the firmware instance and label associated with
+ * a pci device to sysfs
+ * Copyright (C) 2010 Dell Inc.
+ * by Narendra K <Narendra_K@dell.com>,
+ * Jordan Hargrave <Jordan_Hargrave@dell.com>
+ *
+ * SMBIOS defines type 41 for onboard pci devices. This code retrieves
+ * the instance number and string from the type 41 record and exports
+ * it to sysfs.
+ *
+ * Please see http://linux.dell.com/wiki/index.php/Oss/libnetdevname for more
+ * information.
+ */
+
+#include <linux/dmi.h>
+#include <linux/sysfs.h>
+#include <linux/pci.h>
+#include <linux/pci_ids.h>
+#include <linux/module.h>
+#include <linux/device.h>
+#include "pci.h"
+
+enum smbios_attr_enum {
+	SMBIOS_ATTR_NONE = 0,
+	SMBIOS_ATTR_LABEL_SHOW,
+	SMBIOS_ATTR_INSTANCE_SHOW,
+};
+
+static mode_t
+find_smbios_instance_string(struct pci_dev *pdev, char *buf,
+			    enum smbios_attr_enum attribute)
+{
+	const struct dmi_device *dmi;
+	struct dmi_dev_onboard *donboard;
+	int bus;
+	int devfn;
+
+	bus = pdev->bus->number;
+	devfn = pdev->devfn;
+
+	dmi = NULL;
+	while ((dmi = dmi_find_device(DMI_DEV_TYPE_DEV_ONBOARD,
+				      NULL, dmi)) != NULL) {
+		donboard = dmi->device_data;
+		if (donboard && donboard->bus == bus &&
+					donboard->devfn == devfn) {
+			if (buf) {
+				if (attribute == SMBIOS_ATTR_INSTANCE_SHOW)
+					return scnprintf(buf, PAGE_SIZE,
+							 "%d\n",
+							 donboard->instance);
+				else if (attribute == SMBIOS_ATTR_LABEL_SHOW)
+					return scnprintf(buf, PAGE_SIZE,
+							 "%s\n",
+							 dmi->name);
+			}
+			return strlen(dmi->name);
+		}
+	}
+	return 0;
+}
+
+static mode_t
+smbios_instance_string_exist(struct kobject *kobj, struct attribute *attr,
+			     int n)
+{
+	struct device *dev;
+	struct pci_dev *pdev;
+
+	dev = container_of(kobj, struct device, kobj);
+	pdev = to_pci_dev(dev);
+
+	return find_smbios_instance_string(pdev, NULL, SMBIOS_ATTR_NONE) ?
+					   S_IRUGO : 0;
+}
+
+static ssize_t
+smbioslabel_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	struct pci_dev *pdev;
+	pdev = to_pci_dev(dev);
+
+	return find_smbios_instance_string(pdev, buf,
+					   SMBIOS_ATTR_LABEL_SHOW);
+}
+
+static ssize_t
+smbiosinstance_show(struct device *dev,
+		    struct device_attribute *attr, char *buf)
+{
+	struct pci_dev *pdev;
+	pdev = to_pci_dev(dev);
+
+	return find_smbios_instance_string(pdev, buf,
+					   SMBIOS_ATTR_INSTANCE_SHOW);
+}
+
+static struct device_attribute smbios_attr_label = {
+	.attr = {.name = "label", .mode = 0444, .owner = THIS_MODULE},
+	.show = smbioslabel_show,
+};
+
+static struct device_attribute smbios_attr_instance = {
+	.attr = {.name = "index", .mode = 0444, .owner = THIS_MODULE},
+	.show = smbiosinstance_show,
+};
+
+static struct attribute *smbios_attributes[] = {
+	&smbios_attr_label.attr,
+	&smbios_attr_instance.attr,
+	NULL,
+};
+
+static struct attribute_group smbios_attr_group = {
+	.attrs = smbios_attributes,
+	.is_visible = smbios_instance_string_exist,
+};
+
+static int
+pci_create_smbiosname_file(struct pci_dev *pdev)
+{
+	if (!sysfs_create_group(&pdev->dev.kobj, &smbios_attr_group))
+		return 0;
+	return -ENODEV;
+}
+
+static void
+pci_remove_smbiosname_file(struct pci_dev *pdev)
+{
+	sysfs_remove_group(&pdev->dev.kobj, &smbios_attr_group);
+}
+
+void pci_create_firmware_label_files(struct pci_dev *pdev)
+{
+	if (!pci_create_smbiosname_file(pdev))
+		;
+}
+
+void pci_remove_firmware_label_files(struct pci_dev *pdev)
+{
+	pci_remove_smbiosname_file(pdev);
+}
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index afd2fbf..01fd799 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -1132,6 +1132,8 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev)
 
 	pci_create_slot_links(pdev);
 
+	pci_create_firmware_label_files(pdev);
+
 	return 0;
 
 err_vga_file:
@@ -1201,6 +1203,9 @@ void pci_remove_sysfs_dev_files(struct pci_dev *pdev)
 		sysfs_remove_bin_file(&pdev->dev.kobj, pdev->rom_attr);
 		kfree(pdev->rom_attr);
 	}
+
+	pci_remove_firmware_label_files(pdev);
+
 }
 
 static int __init pci_sysfs_init(void)
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index f8077b3..d930338 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -11,6 +11,15 @@
 extern int pci_uevent(struct device *dev, struct kobj_uevent_env *env);
 extern int pci_create_sysfs_dev_files(struct pci_dev *pdev);
 extern void pci_remove_sysfs_dev_files(struct pci_dev *pdev);
+#ifndef CONFIG_DMI
+static inline void pci_create_firmware_label_files(struct pci_dev *pdev)
+{ return 0; }
+static inline void pci_remove_firmware_label_files(struct pci_dev *pdev)
+{ return 0; }
+#else
+extern void pci_create_firmware_label_files(struct pci_dev *pdev);
+extern void pci_remove_firmware_label_files(struct pci_dev *pdev);
+#endif
 extern void pci_cleanup_rom(struct pci_dev *dev);
 #ifdef HAVE_PCI_MMAP
 extern int pci_mmap_fits(struct pci_dev *pdev, int resno,
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index a8a3e1a..90e087f 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -20,6 +20,7 @@ enum dmi_device_type {
 	DMI_DEV_TYPE_SAS,
 	DMI_DEV_TYPE_IPMI = -1,
 	DMI_DEV_TYPE_OEM_STRING = -2,
+	DMI_DEV_TYPE_DEV_ONBOARD = -3,
 };
 
 struct dmi_header {
@@ -37,6 +38,14 @@ struct dmi_device {
 
 #ifdef CONFIG_DMI
 
+struct dmi_dev_onboard {
+	struct dmi_device dev;
+	int instance;
+	int segment;
+	int bus;
+	int devfn;
+};
+
 extern int dmi_check_system(const struct dmi_system_id *list);
 const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list);
 extern const char * dmi_get_system_info(int field);
-- 
1.6.5.2

With regards,
Narendra K

^ permalink raw reply related

* Re: [PATCH 2.6.35-rc1] net-next: Fix an overflow bug in vmxnet3 Tx descriptor
From: Bhavesh Davda @ 2010-07-26 12:10 UTC (permalink / raw)
  To: David Miller; +Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <20100725.170611.71132252.davem@davemloft.net>

Sorry about that. I'll keep that in mind for future patches. Thanks for fixing up and commiting this patch.

Regards

- Bhavesh

(From my iPhone)


On Jul 25, 2010, at 5:05 PM, "David Miller" <davem@davemloft.net> wrote:

> From: Bhavesh Davda <bhavesh@vmware.com>
> Date: Sat, 24 Jul 2010 17:43:29 -0700
> 
>> ---
> 
> If you put the "---" there are the beginning of your message,
> the whole commit message is discarded by GIT.
> 
> I said you should put "---" at the end of the commit message,
> when you want to add more side commentary that should not appear
> in the commit message but is for people in this thread to read.
> 
> I fixed this up when adding your patch, but I have no idea why
> you did this.  Please don't do it again.
> 
>> Fix an overflow bug in vmxnet3 Tx descriptor
>> 
>> This patch fixes a bug where a 16K buffer on a Tx descriptor was overflowing
>> into the 'gen' bit in the descriptor thereby corrupting the descriptor and
>> stalling the transmit ring.
>> 
>> Signed-off-by: Bhavesh Davda <bhavesh@vmware.com>
>> Signed-off-by: Shreyas Bhatewara <sbhatewara@vmware.com>
>> Signed-off-by: Matthew Delco <delcoM@vmware.com>
>> Signed-off-by: Ronghua Zhang <ronghua@vmware.com>
> 
> Applied, thanks.

^ permalink raw reply

* Re: [patch] usbnet: fix 100% CPU use on suspended device
From: Elly Jones @ 2010-07-26 13:26 UTC (permalink / raw)
  To: David Miller
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-usb-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20100725.215739.183063953.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>

On Mon, Jul 26, 2010 at 12:57 AM, David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org> wrote:
> From: Elly Jones <ellyjones-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
> Date: Wed, 21 Jul 2010 14:51:48 -0400
>
>> Subject: [patch] usbnet: fix 100% CPU use on suspended device
>> From: Elly Jones <ellyjones-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
>>
>> This patch causes the usbnet module not to attempt to submit URBs to the device
>> if the device is not ready to accept them. This fixes a misbehavior trigged by
>> the Qualcomm Gobi driver (released under GPL through their Code Aurora
>> initiative) which causes the usbnet core to consume 100% of CPU attempting and
>> failing to submit URBs. This patch is against Linus's 2.6 repo commit
>> a9f7f2e74ae0e6a801a2433dc8e9124d73da0cb4.
>> Signed-off-by: Elizabeth Jones <ellyjones-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
>
> If the Qualcomm Gobi driver is the only one where this happens, maybe the
> real problem is in that driver.

The member in question (dev->udev->can_submit) is documented as 'URBs
may be submitted'. The existing code doesn't honor that flag. It is
somewhat puzzling that (so far) only the Gobi driver seems to use that
flag, but I don't think the bug lies in their driver here.

> I'm not applying this until a USB person looks more deeply into this.

Alright. Can you suggest a particular USB person to bother?

>> ---
>> diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
>> index 81c76ad..df7e72e 100644
>> --- a/drivers/net/usb/usbnet.c
>> +++ b/drivers/net/usb/usbnet.c
>> @@ -1172,6 +1172,7 @@ static void usbnet_bh (unsigned long param)
>>       // or are we maybe short a few urbs?
>>       } else if (netif_running (dev->net) &&
>>                  netif_device_present (dev->net) &&
>> +                dev->udev->can_submit &&
>>                  !timer_pending (&dev->delay) &&
>>                  !test_bit (EVENT_RX_HALT, &dev->flags)) {
>>               int     temp = dev->rxq.qlen;
>> --
>

-- Elly
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [PATCH] sky2: Fix most checkpatch errors
From: Mike McCormack @ 2010-07-26 13:28 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

Tidy up whitespace and formatting to reduce from
 38 errors to 4 and 20 fewer warnings.

Signed-off-by: Mike McCormack <mikem@ring3k.org>
---
 drivers/net/sky2.c |   88 ++++++++++++++++++++++++++--------------------------
 1 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 8b85c02..51752d8 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -61,7 +61,7 @@
  * similar to Tigon3.
  */
 
-#define RX_LE_SIZE	    	1024
+#define RX_LE_SIZE		1024
 #define RX_LE_BYTES		(RX_LE_SIZE*sizeof(struct sky2_rx_le))
 #define RX_MAX_PENDING		(RX_LE_SIZE/6 - 2)
 #define RX_DEF_PENDING		RX_MAX_PENDING
@@ -79,7 +79,7 @@
 
 #define SKY2_EEPROM_MAGIC	0x9955aabb
 
-#define RING_NEXT(x,s)	(((x)+1) & ((s)-1))
+#define RING_NEXT(x, s)	(((x)+1) & ((s)-1))
 
 static const u32 default_msg =
     NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK
@@ -103,7 +103,7 @@ static DEFINE_PCI_DEVICE_TABLE(sky2_id_table) = {
 	{ PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) }, /* SK-9Exx */
 	{ PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E01) }, /* SK-9E21M */
 	{ PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4b00) },	/* DGE-560T */
-	{ PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4001) }, 	/* DGE-550SX */
+	{ PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4001) },	/* DGE-550SX */
 	{ PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4B02) },	/* DGE-560SX */
 	{ PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4B03) },	/* DGE-550T */
 	{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4340) }, /* 88E8021 */
@@ -172,7 +172,7 @@ static int gm_phy_write(struct sky2_hw *hw, unsigned port, u16 reg, u16 val)
 		udelay(10);
 	}
 
-	dev_warn(&hw->pdev->dev,"%s: phy write timeout\n", hw->dev[port]->name);
+	dev_warn(&hw->pdev->dev, "%s: phy write timeout\n", hw->dev[port]->name);
 	return -ETIMEDOUT;
 
 io_error:
@@ -276,7 +276,7 @@ static void sky2_power_aux(struct sky2_hw *hw)
 			    Y2_COR_CLK_LNK2_DIS | Y2_CLK_GAT_LNK2_DIS);
 
 	/* switch power to VAUX if supported and PME from D3cold */
-	if ( (sky2_read32(hw, B0_CTST) & Y2_VAUX_AVAIL) &&
+	if ((sky2_read32(hw, B0_CTST) & Y2_VAUX_AVAIL) &&
 	     pci_pme_capable(hw->pdev, PCI_D3cold))
 		sky2_write8(hw, B0_POWER_CTRL,
 			    (PC_VAUX_ENA | PC_VCC_ENA |
@@ -333,7 +333,7 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
 	struct sky2_port *sky2 = netdev_priv(hw->dev[port]);
 	u16 ctrl, ct1000, adv, pg, ledctrl, ledover, reg;
 
-	if ( (sky2->flags & SKY2_FLAG_AUTO_SPEED) &&
+	if ((sky2->flags & SKY2_FLAG_AUTO_SPEED) &&
 	    !(hw->flags & SKY2_HW_NEWER_PHY)) {
 		u16 ectrl = gm_phy_read(hw, port, PHY_MARV_EXT_CTRL);
 
@@ -375,8 +375,8 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
 			ctrl |= PHY_M_PC_MDI_XMODE(PHY_M_PC_ENA_AUTO);
 
 			/* downshift on PHY 88E1112 and 88E1149 is changed */
-			if ( (sky2->flags & SKY2_FLAG_AUTO_SPEED) &&
-			     (hw->flags & SKY2_HW_NEWER_PHY)) {
+			if ((sky2->flags & SKY2_FLAG_AUTO_SPEED) &&
+			    (hw->flags & SKY2_HW_NEWER_PHY)) {
 				/* set downshift counter to 3x and enable downshift */
 				ctrl &= ~PHY_M_PC_DSC_MSK;
 				ctrl |= PHY_M_PC_DSC(2) | PHY_M_PC_DOWN_S_ENA;
@@ -476,7 +476,7 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
 			adv |= fiber_fc_adv[sky2->flow_mode];
 	} else {
 		reg |= GM_GPCR_AU_FCT_DIS;
- 		reg |= gm_fc_disable[sky2->flow_mode];
+		reg |= gm_fc_disable[sky2->flow_mode];
 
 		/* Forward pause packets to GMAC? */
 		if (sky2->flow_mode & FC_RX)
@@ -817,8 +817,8 @@ static void sky2_set_tx_stfwd(struct sky2_hw *hw, unsigned port)
 {
 	struct net_device *dev = hw->dev[port];
 
-	if ( (hw->chip_id == CHIP_ID_YUKON_EX &&
-	      hw->chip_rev != CHIP_REV_YU_EX_A0) ||
+	if ((hw->chip_id == CHIP_ID_YUKON_EX &&
+	     hw->chip_rev != CHIP_REV_YU_EX_A0) ||
 	     hw->chip_id >= CHIP_ID_YUKON_FE_P) {
 		/* Yukon-Extreme B0 and further Extreme devices */
 		sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), TX_STFW_ENA);
@@ -1078,7 +1078,7 @@ static inline struct sky2_rx_le *sky2_next_rx(struct sky2_port *sky2)
 	return le;
 }
 
-static unsigned sky2_get_rx_threshold(struct sky2_port* sky2)
+static unsigned sky2_get_rx_threshold(struct sky2_port *sky2)
 {
 	unsigned size;
 
@@ -1089,7 +1089,7 @@ static unsigned sky2_get_rx_threshold(struct sky2_port* sky2)
 	return (size - 8) / sizeof(u32);
 }
 
-static unsigned sky2_get_rx_data_size(struct sky2_port* sky2)
+static unsigned sky2_get_rx_data_size(struct sky2_port *sky2)
 {
 	struct rx_ring_info *re;
 	unsigned size;
@@ -1113,7 +1113,7 @@ static unsigned sky2_get_rx_data_size(struct sky2_port* sky2)
 }
 
 /* Build description to hardware for one receive segment */
-static void sky2_rx_add(struct sky2_port *sky2,  u8 op,
+static void sky2_rx_add(struct sky2_port *sky2, u8 op,
 			dma_addr_t map, unsigned len)
 {
 	struct sky2_rx_le *le;
@@ -1599,16 +1599,16 @@ static void sky2_hw_up(struct sky2_port *sky2)
 	tx_init(sky2);
 
 	/*
- 	 * On dual port PCI-X card, there is an problem where status
+	 * On dual port PCI-X card, there is an problem where status
 	 * can be received out of order due to split transactions
 	 */
 	if (otherdev && netif_running(otherdev) &&
- 	    (cap = pci_find_capability(hw->pdev, PCI_CAP_ID_PCIX))) {
- 		u16 cmd;
+	    (cap = pci_find_capability(hw->pdev, PCI_CAP_ID_PCIX))) {
+		u16 cmd;
 
 		cmd = sky2_pci_read16(hw, cap + PCI_X_CMD);
- 		cmd &= ~PCI_X_CMD_MAX_SPLIT;
- 		sky2_pci_write16(hw, cap + PCI_X_CMD, cmd);
+		cmd &= ~PCI_X_CMD_MAX_SPLIT;
+		sky2_pci_write16(hw, cap + PCI_X_CMD, cmd);
 	}
 
 	sky2_mac_init(hw, port);
@@ -1749,8 +1749,8 @@ static netdev_tx_t sky2_xmit_frame(struct sk_buff *skb,
 	u16 mss;
 	u8 ctrl;
 
- 	if (unlikely(tx_avail(sky2) < tx_le_req(skb)))
-  		return NETDEV_TX_BUSY;
+	if (unlikely(tx_avail(sky2) < tx_le_req(skb)))
+		return NETDEV_TX_BUSY;
 
 	len = skb_headlen(skb);
 	mapping = pci_map_single(hw->pdev, skb->data, len, PCI_DMA_TODEVICE);
@@ -1778,9 +1778,9 @@ static netdev_tx_t sky2_xmit_frame(struct sk_buff *skb,
 		if (!(hw->flags & SKY2_HW_NEW_LE))
 			mss += ETH_HLEN + ip_hdrlen(skb) + tcp_hdrlen(skb);
 
-  		if (mss != sky2->tx_last_mss) {
+		if (mss != sky2->tx_last_mss) {
 			le = get_tx_le(sky2, &slot);
-  			le->addr = cpu_to_le32(mss);
+			le->addr = cpu_to_le32(mss);
 
 			if (hw->flags & SKY2_HW_NEW_LE)
 				le->opcode = OP_MSS | HW_OWNER;
@@ -1808,8 +1808,8 @@ static netdev_tx_t sky2_xmit_frame(struct sk_buff *skb,
 	/* Handle TCP checksum offload */
 	if (skb->ip_summed == CHECKSUM_PARTIAL) {
 		/* On Yukon EX (some versions) encoding change. */
- 		if (hw->flags & SKY2_HW_AUTO_TX_SUM)
- 			ctrl |= CALSUM;	/* auto checksum */
+		if (hw->flags & SKY2_HW_AUTO_TX_SUM)
+			ctrl |= CALSUM;	/* auto checksum */
 		else {
 			const unsigned offset = skb_transport_offset(skb);
 			u32 tcpsum;
@@ -2430,7 +2430,7 @@ nobuf:
 static struct sk_buff *sky2_receive(struct net_device *dev,
 				    u16 length, u32 status)
 {
- 	struct sky2_port *sky2 = netdev_priv(dev);
+	struct sky2_port *sky2 = netdev_priv(dev);
 	struct rx_ring_info *re = sky2->rx_ring + sky2->rx_next;
 	struct sk_buff *skb = NULL;
 	u16 count = (status & GMR_FS_LEN) >> 16;
@@ -2751,7 +2751,7 @@ static void sky2_hw_intr(struct sky2_hw *hw)
 		pci_err = sky2_pci_read16(hw, PCI_STATUS);
 		if (net_ratelimit())
 			dev_err(&pdev->dev, "PCI hardware error (0x%x)\n",
-			        pci_err);
+				pci_err);
 
 		sky2_pci_write16(hw, PCI_STATUS,
 				      pci_err | PCI_STATUS_ERROR_BITS);
@@ -3019,7 +3019,7 @@ static int __devinit sky2_init(struct sky2_hw *hw)
 	hw->chip_id = sky2_read8(hw, B2_CHIP_ID);
 	hw->chip_rev = (sky2_read8(hw, B2_MAC_CFG) & CFG_CHIP_R_MSK) >> 4;
 
-	switch(hw->chip_id) {
+	switch (hw->chip_id) {
 	case CHIP_ID_YUKON_XL:
 		hw->flags = SKY2_HW_GIGABIT | SKY2_HW_NEWER_PHY;
 		if (hw->chip_rev < CHIP_REV_YU_XL_A2)
@@ -3543,13 +3543,13 @@ static const struct sky2_stat {
 	{ "tx_mac_pause",  GM_TXF_MPAUSE },
 	{ "rx_mac_pause",  GM_RXF_MPAUSE },
 	{ "collisions",    GM_TXF_COL },
-	{ "late_collision",GM_TXF_LAT_COL },
-	{ "aborted", 	   GM_TXF_ABO_COL },
+	{ "late_collision", GM_TXF_LAT_COL },
+	{ "aborted",	   GM_TXF_ABO_COL },
 	{ "single_collisions", GM_TXF_SNG_COL },
 	{ "multi_collisions", GM_TXF_MUL_COL },
 
 	{ "rx_short",      GM_RXF_SHT },
-	{ "rx_runt", 	   GM_RXE_FRAG },
+	{ "rx_runt",	   GM_RXE_FRAG },
 	{ "rx_64_byte_packets", GM_RXF_64B },
 	{ "rx_65_to_127_byte_packets", GM_RXF_127B },
 	{ "rx_128_to_255_byte_packets", GM_RXF_255B },
@@ -3690,7 +3690,7 @@ static int sky2_set_mac_address(struct net_device *dev, void *p)
 	return 0;
 }
 
-static void inline sky2_add_filter(u8 filter[8], const u8 *addr)
+static inline void sky2_add_filter(u8 filter[8], const u8 *addr)
 {
 	u32 bit;
 
@@ -3916,7 +3916,7 @@ static int sky2_set_coalesce(struct net_device *dev,
 		return -EINVAL;
 	if (ecmd->rx_max_coalesced_frames > RX_MAX_PENDING)
 		return -EINVAL;
-	if (ecmd->rx_max_coalesced_frames_irq >RX_MAX_PENDING)
+	if (ecmd->rx_max_coalesced_frames_irq > RX_MAX_PENDING)
 		return -EINVAL;
 
 	if (ecmd->tx_coalesce_usecs == 0)
@@ -4095,14 +4095,14 @@ static int sky2_get_eeprom_len(struct net_device *dev)
 	u16 reg2;
 
 	reg2 = sky2_pci_read16(hw, PCI_DEV_REG2);
-	return 1 << ( ((reg2 & PCI_VPD_ROM_SZ) >> 14) + 8);
+	return 1 << (((reg2 & PCI_VPD_ROM_SZ) >> 14) + 8);
 }
 
 static int sky2_vpd_wait(const struct sky2_hw *hw, int cap, u16 busy)
 {
 	unsigned long start = jiffies;
 
-	while ( (sky2_pci_read16(hw, cap + PCI_VPD_ADDR) & PCI_VPD_ADDR_F) == busy) {
+	while ((sky2_pci_read16(hw, cap + PCI_VPD_ADDR) & PCI_VPD_ADDR_F) == busy) {
 		/* Can take up to 10.6 ms for write */
 		if (time_after(jiffies, start + HZ/4)) {
 			dev_err(&hw->pdev->dev, "VPD cycle timed out\n");
@@ -4225,7 +4225,7 @@ static const struct ethtool_ops sky2_ethtool_ops = {
 	.get_eeprom_len	= sky2_get_eeprom_len,
 	.get_eeprom	= sky2_get_eeprom,
 	.set_eeprom	= sky2_set_eeprom,
-	.set_sg 	= ethtool_op_set_sg,
+	.set_sg		= ethtool_op_set_sg,
 	.set_tx_csum	= sky2_set_tx_csum,
 	.set_tso	= sky2_set_tso,
 	.get_rx_csum	= sky2_get_rx_csum,
@@ -4278,7 +4278,7 @@ static void sky2_show_vpd(struct seq_file *seq, struct sky2_hw *hw)
 	u16 reg2;
 
 	reg2 = sky2_pci_read16(hw, PCI_DEV_REG2);
-	vpd_size = 1 << ( ((reg2 & PCI_VPD_ROM_SZ) >> 14) + 8);
+	vpd_size = 1 << (((reg2 & PCI_VPD_ROM_SZ) >> 14) + 8);
 
 	seq_printf(seq, "%s Product Data\n", pci_name(hw->pdev));
 	buf = kmalloc(vpd_size, GFP_KERNEL);
@@ -4381,7 +4381,7 @@ static int sky2_debug_show(struct seq_file *seq, void *v)
 			seq_printf(seq, "%u:", idx);
 		sop = 0;
 
-		switch(le->opcode & ~HW_OWNER) {
+		switch (le->opcode & ~HW_OWNER) {
 		case OP_ADDR64:
 			seq_printf(seq, " %#x:", a);
 			break;
@@ -4450,7 +4450,7 @@ static int sky2_device_event(struct notifier_block *unused,
 	if (dev->netdev_ops->ndo_open != sky2_up || !sky2_debug)
 		return NOTIFY_DONE;
 
-	switch(event) {
+	switch (event) {
 	case NETDEV_CHANGENAME:
 		if (sky2->debugfs) {
 			sky2->debugfs = debugfs_rename(sky2_debug, sky2->debugfs,
@@ -4645,7 +4645,7 @@ static int __devinit sky2_test_msi(struct sky2_hw *hw)
 	struct pci_dev *pdev = hw->pdev;
 	int err;
 
-	init_waitqueue_head (&hw->msi_wait);
+	init_waitqueue_head(&hw->msi_wait);
 
 	sky2_write32(hw, B0_IMSK, Y2_IS_IRQ_SW);
 
@@ -4682,7 +4682,7 @@ static const char *sky2_name(u8 chipid, char *buf, int sz)
 {
 	const char *name[] = {
 		"XL",		/* 0xb3 */
-		"EC Ultra", 	/* 0xb4 */
+		"EC Ultra",	/* 0xb4 */
 		"Extreme",	/* 0xb5 */
 		"EC",		/* 0xb6 */
 		"FE",		/* 0xb7 */
@@ -4762,7 +4762,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
 	 * this driver uses software swapping.
 	 */
 	reg &= ~PCI_REV_DESC;
-	err = pci_write_config_dword(pdev,PCI_DEV_REG2, reg);
+	err = pci_write_config_dword(pdev, PCI_DEV_REG2, reg);
 	if (err) {
 		dev_err(&pdev->dev, "PCI write config failed\n");
 		goto err_out_free_regions;
@@ -4814,10 +4814,10 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
 	if (!disable_msi && pci_enable_msi(pdev) == 0) {
 		err = sky2_test_msi(hw);
 		if (err == -EOPNOTSUPP)
- 			pci_disable_msi(pdev);
+			pci_disable_msi(pdev);
 		else if (err)
 			goto err_out_free_netdev;
- 	}
+	}
 
 	err = register_netdev(dev);
 	if (err) {
-- 
1.5.6.5


^ permalink raw reply related

* lock_sock or sock_hold ?
From: Neshama Parhoti @ 2010-07-26 14:00 UTC (permalink / raw)
  To: netdev

hello everyone,

can you please be kind and help me understand the differences between
lock_sock and sock_hold ?

i can see that lock_sock takes a spin lock (bh) to mark owned = 1, and
then takes a mutex, whereas sock_hold only increases the atomic
refcnt.

but how do i know which of them I should use ?

i'm puzzled as to when should those two different APIs be used..

thank you a lot
~pnesh

^ permalink raw reply

* Last Ipv6 address removal causes "addrconf_sysctl_unregister", which inihibits from changing disable_ipv6 setting
From: Mahesh Kelkar @ 2010-07-26 14:03 UTC (permalink / raw)
  To: Brian Haley; +Cc: netdev, David Miller

Odd behavior associated with the patch:
**Last address removal causes "addrconf_sysctl_unregister", which
inihibits from changing disable_ipv6 setting
(connected issue: With disable_ipv6 set to 1 on an interface, ff00:/8
and fe80::/64 are still added on device UP)

Current sysctl config:
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

Steps:
- Remove last IPv6 address assigned to the "eth0" interface
- inet6_addr_del => addrconf_ifdown(idev->dev, 1) => does the device
sysctl unregister
******Not sure why the addrconf_sysctl_unregister is necessary on last
address removal*******
- Now, "sysctl -a" does not show "net.ipv6.conf.eth0.disable_ipv6"

Problem:
- If you WANT to assign IPv6 address to eth0,
-> Do it once, which fails due to "disable_ipv6" check in
addrconf_add_dev OR ipv6_add_addr
-> But, this process does "addrconf_sysctl_register" (addrconf_add_dev
=> ipv6_find_idev => ipv6_add_dev)
-> set net.ipv6.conf.eth0.disable_ipv6=0 and then successfully assign
ipv6-address to the eth0
(Another alternative is to change all or default to 1; but I wanted to
disable ipv6 by default)

===============
Probable Solution:
===============
@@ -1948,7 +1959,7 @@ static int inet6_addr_del(int ifindex, s
 			   disable IPv6 on this interface.
 			 */
 			if (idev->addr_list == NULL)
-				addrconf_ifdown(idev->dev, 1);
+				addrconf_ifdown(idev->dev, 0);
 			return 0;
 		}
 	}
I have tested the above solution and it seems to work fine - so far.

^ permalink raw reply

* [PATCH] ethoc: add devinit/devexit section initializers
From: Jonas Bonn @ 2010-07-26 14:01 UTC (permalink / raw)
  To: netdev; +Cc: thomas, Jonas Bonn

Signed-off-by: Jonas Bonn <jonas@southpole.se>
---
 drivers/net/ethoc.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c
index fc26097..7fc2de5 100644
--- a/drivers/net/ethoc.c
+++ b/drivers/net/ethoc.c
@@ -637,7 +637,7 @@ static void ethoc_mdio_poll(struct net_device *dev)
 {
 }
 
-static int ethoc_mdio_probe(struct net_device *dev)
+static int __devinit ethoc_mdio_probe(struct net_device *dev)
 {
 	struct ethoc *priv = netdev_priv(dev);
 	struct phy_device *phy;
@@ -877,7 +877,7 @@ static const struct net_device_ops ethoc_netdev_ops = {
  * ethoc_probe() - initialize OpenCores ethernet MAC
  * pdev:	platform device
  */
-static int ethoc_probe(struct platform_device *pdev)
+static int __devinit ethoc_probe(struct platform_device *pdev)
 {
 	struct net_device *netdev = NULL;
 	struct resource *res = NULL;
@@ -1088,7 +1088,7 @@ out:
  * ethoc_remove() - shutdown OpenCores ethernet MAC
  * @pdev:	platform device
  */
-static int ethoc_remove(struct platform_device *pdev)
+static int __devexit ethoc_remove(struct platform_device *pdev)
 {
 	struct net_device *netdev = platform_get_drvdata(pdev);
 	struct ethoc *priv = netdev_priv(netdev);
@@ -1142,7 +1142,7 @@ MODULE_DEVICE_TABLE(of, ethoc_match);
 
 static struct platform_driver ethoc_driver = {
 	.probe   = ethoc_probe,
-	.remove  = ethoc_remove,
+	.remove  = __devexit_p(ethoc_remove),
 	.suspend = ethoc_suspend,
 	.resume  = ethoc_resume,
 	.driver  = {
-- 
1.7.1


^ permalink raw reply related

* Re: [Bug #15704] [r8169] WARNING: at net/sched/sch_generic.c
From: Eric Dumazet @ 2010-07-26 14:34 UTC (permalink / raw)
  To: Sergey Senozhatsky
  Cc: Rafael J. Wysocki, Linux Kernel Mailing List, Kernel Testers List,
	Maciej Rutecki, netdev
In-Reply-To: <20100726131629.GA4398@swordfish.minsk.epam.com>

Le lundi 26 juillet 2010 à 16:16 +0300, Sergey Senozhatsky a écrit :
> On (07/23/10 14:15), Rafael J. Wysocki wrote:
> > Bug-Entry	: http://bugzilla.kernel.org/show_bug.cgi?id=15704
> > Subject		: [r8169] WARNING: at net/sched/sch_generic.c
> > Submitter	: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> > Date		: 2010-03-31 10:21 (115 days old)
> > Message-ID	: <20100331102142.GA3294@swordfish.minsk.epam.com>
> > References	: http://marc.info/?l=linux-kernel&m=127003090406108&w=2
> > 
> > 
> 
> Hello,
> Sorry for the dealy - I've been away.
> So, the bad news are that this is probably the last time I can test this bug. This laptop will
> no longer be available. Sorry.
> 
> 
> [ 2599.495508] pktgen 2.73: Packet Generator for packet performance testing.
> [ 2630.016019] ------------[ cut here ]------------
> [ 2630.016031] WARNING: at net/sched/sch_generic.c:258 dev_watchdog+0xc1/0x129()
> [ 2630.016035] Hardware name: F3JC                
> [ 2630.016038] NETDEV WATCHDOG: eth0 (r8169): transmit queue 0 timed out
> [ 2630.016041] Modules linked in: pktgen ipv6 arc4 ecb iwl3945 snd_hwdep iwlcore snd_seq_dummy snd_hda_codec_si3054 snd_hda_codec_realtek snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device mac80211 snd_pcm_oss snd_mixer_oss asus_laptop
> snd_hda_intel sparse_keymap sdhci_pci sdhci mmc_core led_class cfg80211 snd_hda_codec snd_pcm snd_timer snd_page_alloc snd rng_core soundcore usb_storage sg psmouse evdev i2c_i801 serio_raw r8169 mii uhci_hcd ehci_hcd sd_mod sr_mod usbcore
> cdrom ata_piix
> [ 2630.016114] Pid: 4282, comm: kpktgend_0 Not tainted 2.6.35-rc6-dbg-git1-00136-g459ab2a-dirty #75
> [ 2630.016118] Call Trace:
> [ 2630.016125]  [<c102e3ae>] warn_slowpath_common+0x65/0x7a
> [ 2630.016131]  [<c12695f3>] ? dev_watchdog+0xc1/0x129
> [ 2630.016136]  [<c102e427>] warn_slowpath_fmt+0x26/0x2a
> [ 2630.016142]  [<c12695f3>] dev_watchdog+0xc1/0x129
> [ 2630.016149]  [<c10370b3>] ? run_timer_softirq+0x136/0x22b
> [ 2630.016154]  [<c103710c>] run_timer_softirq+0x18f/0x22b
> [ 2630.016160]  [<c10370b3>] ? run_timer_softirq+0x136/0x22b
> [ 2630.016165]  [<c1269532>] ? dev_watchdog+0x0/0x129
> [ 2630.016171]  [<c1032c35>] __do_softirq+0x88/0x10c
> [ 2630.016177]  [<c1032ce8>] do_softirq+0x2f/0x47
> [ 2630.016182]  [<c1032fa5>] irq_exit+0x38/0x75
> [ 2630.016187]  [<c10159b8>] smp_apic_timer_interrupt+0x5f/0x6d
> [ 2630.016195]  [<f80555e4>] ? pktgen_xmit+0xda2/0xe6f [pktgen]
> [ 2630.016202]  [<c12c75a2>] apic_timer_interrupt+0x36/0x3c
> [ 2630.016208]  [<f80555e4>] ? pktgen_xmit+0xda2/0xe6f [pktgen]
> [ 2630.016214]  [<f80555e4>] ? pktgen_xmit+0xda2/0xe6f [pktgen]
> [ 2630.016220]  [<c104007b>] ? __kfifo_peek_n+0x13/0x2b
> [ 2630.016226]  [<c1032edd>] ? _local_bh_enable_ip+0x9d/0xb3
> [ 2630.016231]  [<c1032efb>] local_bh_enable_ip+0x8/0xa
> [ 2630.016236]  [<c12c6aaa>] _raw_spin_unlock_bh+0x2f/0x32
> [ 2630.016242]  [<f80555e4>] pktgen_xmit+0xda2/0xe6f [pktgen]
> [ 2630.016253]  [<f91707b8>] ? rtl8169_start_xmit+0x0/0x307 [r8169]
> [ 2630.016261]  [<c11800d8>] ? plist_add+0x85/0x87
> [ 2630.016267]  [<f80558ac>] ? pktgen_thread_worker+0x96/0x5c3 [pktgen]
> [ 2630.016273]  [<c1029096>] ? get_parent_ip+0xb/0x31
> [ 2630.016279]  [<c1029138>] ? sub_preempt_count+0x7c/0x89
> [ 2630.016285]  [<f8055986>] pktgen_thread_worker+0x170/0x5c3 [pktgen]
> [ 2630.016290]  [<c12c52bb>] ? schedule+0x535/0x545
> [ 2630.016296]  [<c103fd96>] ? autoremove_wake_function+0x0/0x2f
> [ 2630.016301]  [<c103fd96>] ? autoremove_wake_function+0x0/0x2f
> [ 2630.016307]  [<f8055816>] ? pktgen_thread_worker+0x0/0x5c3 [pktgen]
> [ 2630.016313]  [<c103faa6>] kthread+0x6a/0x6f
> [ 2630.016318]  [<c103fa3c>] ? kthread+0x0/0x6f
> [ 2630.016324]  [<c1002d82>] kernel_thread_helper+0x6/0x10
> [ 2630.016328] ---[ end trace 0bdadff7f249bd0d ]---
> [ 2630.032549] r8169 0000:02:00.0: eth0: link up
> 
> 
> 	Sergey

r8169 driver misses a netif_carrier_off() call somewhere, probably when
adapter is reset

Sergey, do you run a pktgen only test (sending packets, and not
receiving packets during the test), or a mixed workload ?

r8169 is known to reset if the RX ring buffer is stressed too much.

^ permalink raw reply

* Re: [patch] usbnet: fix 100% CPU use on suspended device
From: Alan Stern @ 2010-07-26 14:36 UTC (permalink / raw)
  To: Elly Jones; +Cc: David Miller, netdev, linux-usb
In-Reply-To: <AANLkTik=b3ps_iMOC=mjDs2quLwBPUKbiqn0nKU3EbB1@mail.gmail.com>

On Mon, 26 Jul 2010, Elly Jones wrote:

> On Mon, Jul 26, 2010 at 12:57 AM, David Miller <davem@davemloft.net> wrote:
> > From: Elly Jones <ellyjones@google.com>
> > Date: Wed, 21 Jul 2010 14:51:48 -0400
> >
> >> Subject: [patch] usbnet: fix 100% CPU use on suspended device
> >> From: Elly Jones <ellyjones@google.com>
> >>
> >> This patch causes the usbnet module not to attempt to submit URBs to the device
> >> if the device is not ready to accept them. This fixes a misbehavior trigged by
> >> the Qualcomm Gobi driver (released under GPL through their Code Aurora
> >> initiative) which causes the usbnet core to consume 100% of CPU attempting and
> >> failing to submit URBs. This patch is against Linus's 2.6 repo commit
> >> a9f7f2e74ae0e6a801a2433dc8e9124d73da0cb4.
> >> Signed-off-by: Elizabeth Jones <ellyjones@google.com>
> >
> > If the Qualcomm Gobi driver is the only one where this happens, maybe the
> > real problem is in that driver.
> 
> The member in question (dev->udev->can_submit) is documented as 'URBs
> may be submitted'. The existing code doesn't honor that flag. It is
> somewhat puzzling that (so far) only the Gobi driver seems to use that
> flag, but I don't think the bug lies in their driver here.

That flag is not intended for use by drivers but by the USB core.  (It
gets cleared only when the device is suspended.)  usbnet and Gobi
shouldn't need to look at it.

> > I'm not applying this until a USB person looks more deeply into this.
> 
> Alright. Can you suggest a particular USB person to bother?
> 
> >> ---
> >> diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
> >> index 81c76ad..df7e72e 100644
> >> --- a/drivers/net/usb/usbnet.c
> >> +++ b/drivers/net/usb/usbnet.c
> >> @@ -1172,6 +1172,7 @@ static void usbnet_bh (unsigned long param)
> >>       // or are we maybe short a few urbs?
> >>       } else if (netif_running (dev->net) &&
> >>                  netif_device_present (dev->net) &&
> >> +                dev->udev->can_submit &&
> >>                  !timer_pending (&dev->delay) &&
> >>                  !test_bit (EVENT_RX_HALT, &dev->flags)) {
> >>               int     temp = dev->rxq.qlen;

This isn't right.  The problem should be fixed some other way.  Under
what circumstances are URBs submitted incorrectly?

Alan Stern


^ permalink raw reply

* Re: lock_sock or sock_hold ?
From: Eric Dumazet @ 2010-07-26 14:43 UTC (permalink / raw)
  To: Neshama Parhoti; +Cc: netdev
In-Reply-To: <AANLkTim7LQ65RWvy+TQ+HtwjJM89zt4g12H6mFinQT0v@mail.gmail.com>

Le lundi 26 juillet 2010 à 17:00 +0300, Neshama Parhoti a écrit :
> hello everyone,
> 
> can you please be kind and help me understand the differences between
> lock_sock and sock_hold ?
> 
> i can see that lock_sock takes a spin lock (bh) to mark owned = 1, and
> then takes a mutex, whereas sock_hold only increases the atomic
> refcnt.
> 
> but how do i know which of them I should use ?
> 
> i'm puzzled as to when should those two different APIs be used..

sock_hold() only increments a refcount, so that you are sure nobody can
destroy the socket (and its memory) under you. But you cannot modify
socket state only with this refcount taken.

To get exclusive access to the socket you either :

1) Are in process context and use lock_sock().

2) Are in softirq context (input path for example) :
 2.1) Lookup the socket in protocol hash tables, and get a refcount on
it (by sock_hold() or other atomic operation on refcnt)

 2.2) Then, get semi exclusive access using bh_lock_sock()
 2.3) Check if another process already is using the socket (we
interrupted this process on same CPU, or run on another cpu)
   if (sock_owned_by_user(sk)) {
	// queue work to socket backlog (delayed work)
   } else {
	// process packet right now
   }



^ permalink raw reply

* Re: [patch] usbnet: fix 100% CPU use on suspended device
From: Elly Jones @ 2010-07-26 14:47 UTC (permalink / raw)
  To: Alan Stern
  Cc: David Miller, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <Pine.LNX.4.44L0.1007261033090.1550-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>

On Mon, Jul 26, 2010 at 10:36 AM, Alan Stern <stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org> wrote:
> On Mon, 26 Jul 2010, Elly Jones wrote:
>
>> On Mon, Jul 26, 2010 at 12:57 AM, David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org> wrote:
>> > From: Elly Jones <ellyjones-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
>> > Date: Wed, 21 Jul 2010 14:51:48 -0400
>> >
>> >> Subject: [patch] usbnet: fix 100% CPU use on suspended device
>> >> From: Elly Jones <ellyjones-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
>> >>
>> >> This patch causes the usbnet module not to attempt to submit URBs to the device
>> >> if the device is not ready to accept them. This fixes a misbehavior trigged by
>> >> the Qualcomm Gobi driver (released under GPL through their Code Aurora
>> >> initiative) which causes the usbnet core to consume 100% of CPU attempting and
>> >> failing to submit URBs. This patch is against Linus's 2.6 repo commit
>> >> a9f7f2e74ae0e6a801a2433dc8e9124d73da0cb4.
>> >> Signed-off-by: Elizabeth Jones <ellyjones-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
>> >
>> > If the Qualcomm Gobi driver is the only one where this happens, maybe the
>> > real problem is in that driver.
>>
>> The member in question (dev->udev->can_submit) is documented as 'URBs
>> may be submitted'. The existing code doesn't honor that flag. It is
>> somewhat puzzling that (so far) only the Gobi driver seems to use that
>> flag, but I don't think the bug lies in their driver here.
>
> That flag is not intended for use by drivers but by the USB core.  (It
> gets cleared only when the device is suspended.)  usbnet and Gobi
> shouldn't need to look at it.

Aha!

>> > I'm not applying this until a USB person looks more deeply into this.
>>
>> Alright. Can you suggest a particular USB person to bother?
>>
>> >> ---
>> >> diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
>> >> index 81c76ad..df7e72e 100644
>> >> --- a/drivers/net/usb/usbnet.c
>> >> +++ b/drivers/net/usb/usbnet.c
>> >> @@ -1172,6 +1172,7 @@ static void usbnet_bh (unsigned long param)
>> >>       // or are we maybe short a few urbs?
>> >>       } else if (netif_running (dev->net) &&
>> >>                  netif_device_present (dev->net) &&
>> >> +                dev->udev->can_submit &&
>> >>                  !timer_pending (&dev->delay) &&
>> >>                  !test_bit (EVENT_RX_HALT, &dev->flags)) {
>> >>               int     temp = dev->rxq.qlen;
>
> This isn't right.  The problem should be fixed some other way.  Under
> what circumstances are URBs submitted incorrectly?

When the device is autosuspended. What is the proper thing for a
device to do here?

> Alan Stern

-- Elly
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [Bug #15704] [r8169] WARNING: at net/sched/sch_generic.c
From: Sergey Senozhatsky @ 2010-07-26 14:57 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Sergey Senozhatsky, Rafael J. Wysocki, Linux Kernel Mailing List,
	Kernel Testers List, Maciej Rutecki, netdev
In-Reply-To: <1280154873.2899.390.camel@edumazet-laptop>

[-- Attachment #1: Type: text/plain, Size: 4172 bytes --]

On (07/26/10 16:34), Eric Dumazet wrote:
> > Sorry for the dealy - I've been away.
> > So, the bad news are that this is probably the last time I can test this bug. This laptop will
> > no longer be available. Sorry.
> > 
> > 
> > [ 2599.495508] pktgen 2.73: Packet Generator for packet performance testing.
> > [ 2630.016019] ------------[ cut here ]------------
> > [ 2630.016031] WARNING: at net/sched/sch_generic.c:258 dev_watchdog+0xc1/0x129()
> > [ 2630.016035] Hardware name: F3JC                
> > [ 2630.016038] NETDEV WATCHDOG: eth0 (r8169): transmit queue 0 timed out
> > [ 2630.016041] Modules linked in: pktgen ipv6 arc4 ecb iwl3945 snd_hwdep iwlcore snd_seq_dummy snd_hda_codec_si3054 snd_hda_codec_realtek snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device mac80211 snd_pcm_oss snd_mixer_oss asus_laptop
> > snd_hda_intel sparse_keymap sdhci_pci sdhci mmc_core led_class cfg80211 snd_hda_codec snd_pcm snd_timer snd_page_alloc snd rng_core soundcore usb_storage sg psmouse evdev i2c_i801 serio_raw r8169 mii uhci_hcd ehci_hcd sd_mod sr_mod usbcore
> > cdrom ata_piix
> > [ 2630.016114] Pid: 4282, comm: kpktgend_0 Not tainted 2.6.35-rc6-dbg-git1-00136-g459ab2a-dirty #75
> > [ 2630.016118] Call Trace:
> > [ 2630.016125]  [<c102e3ae>] warn_slowpath_common+0x65/0x7a
> > [ 2630.016131]  [<c12695f3>] ? dev_watchdog+0xc1/0x129
> > [ 2630.016136]  [<c102e427>] warn_slowpath_fmt+0x26/0x2a
> > [ 2630.016142]  [<c12695f3>] dev_watchdog+0xc1/0x129
> > [ 2630.016149]  [<c10370b3>] ? run_timer_softirq+0x136/0x22b
> > [ 2630.016154]  [<c103710c>] run_timer_softirq+0x18f/0x22b
> > [ 2630.016160]  [<c10370b3>] ? run_timer_softirq+0x136/0x22b
> > [ 2630.016165]  [<c1269532>] ? dev_watchdog+0x0/0x129
> > [ 2630.016171]  [<c1032c35>] __do_softirq+0x88/0x10c
> > [ 2630.016177]  [<c1032ce8>] do_softirq+0x2f/0x47
> > [ 2630.016182]  [<c1032fa5>] irq_exit+0x38/0x75
> > [ 2630.016187]  [<c10159b8>] smp_apic_timer_interrupt+0x5f/0x6d
> > [ 2630.016195]  [<f80555e4>] ? pktgen_xmit+0xda2/0xe6f [pktgen]
> > [ 2630.016202]  [<c12c75a2>] apic_timer_interrupt+0x36/0x3c
> > [ 2630.016208]  [<f80555e4>] ? pktgen_xmit+0xda2/0xe6f [pktgen]
> > [ 2630.016214]  [<f80555e4>] ? pktgen_xmit+0xda2/0xe6f [pktgen]
> > [ 2630.016220]  [<c104007b>] ? __kfifo_peek_n+0x13/0x2b
> > [ 2630.016226]  [<c1032edd>] ? _local_bh_enable_ip+0x9d/0xb3
> > [ 2630.016231]  [<c1032efb>] local_bh_enable_ip+0x8/0xa
> > [ 2630.016236]  [<c12c6aaa>] _raw_spin_unlock_bh+0x2f/0x32
> > [ 2630.016242]  [<f80555e4>] pktgen_xmit+0xda2/0xe6f [pktgen]
> > [ 2630.016253]  [<f91707b8>] ? rtl8169_start_xmit+0x0/0x307 [r8169]
> > [ 2630.016261]  [<c11800d8>] ? plist_add+0x85/0x87
> > [ 2630.016267]  [<f80558ac>] ? pktgen_thread_worker+0x96/0x5c3 [pktgen]
> > [ 2630.016273]  [<c1029096>] ? get_parent_ip+0xb/0x31
> > [ 2630.016279]  [<c1029138>] ? sub_preempt_count+0x7c/0x89
> > [ 2630.016285]  [<f8055986>] pktgen_thread_worker+0x170/0x5c3 [pktgen]
> > [ 2630.016290]  [<c12c52bb>] ? schedule+0x535/0x545
> > [ 2630.016296]  [<c103fd96>] ? autoremove_wake_function+0x0/0x2f
> > [ 2630.016301]  [<c103fd96>] ? autoremove_wake_function+0x0/0x2f
> > [ 2630.016307]  [<f8055816>] ? pktgen_thread_worker+0x0/0x5c3 [pktgen]
> > [ 2630.016313]  [<c103faa6>] kthread+0x6a/0x6f
> > [ 2630.016318]  [<c103fa3c>] ? kthread+0x0/0x6f
> > [ 2630.016324]  [<c1002d82>] kernel_thread_helper+0x6/0x10
> > [ 2630.016328] ---[ end trace 0bdadff7f249bd0d ]---
> > [ 2630.032549] r8169 0000:02:00.0: eth0: link up
> > 
> > 
> > 	Sergey
>

Hello,
 
> r8169 driver misses a netif_carrier_off() call somewhere, probably when
> adapter is reset
> 
> Sergey, do you run a pktgen only test (sending packets, and not
> receiving packets during the test), or a mixed workload ?
>

Only sending. 

--
 PGDEV=/proc/net/pktgen/eth0
 echo "Configuring $PGDEV"
 pgset "$COUNT"
 pgset "$CLONE_SKB"
 pgset "$PKT_SIZE"
 pgset "$DELAY"
 pgset "dst 192.168.x.x"
 pgset "dst_mac  x:x:x:x:x:x"

 PGDEV=/proc/net/pktgen/pgctrl

 echo "Running..."
 pgset "start"
--

 
> r8169 is known to reset if the RX ring buffer is stressed too much.
> 

	Sergey

[-- Attachment #2: Type: application/pgp-signature, Size: 316 bytes --]

^ permalink raw reply

* [PATCH] [PATCH] s2io: fixing DBG_PRINT() macro
From: leitao @ 2010-07-26 15:07 UTC (permalink / raw)
  To: davem; +Cc: netdev, Breno Leitao

Patch 9e39f7c5b311a306977c5471f9e2ce4c456aa038 changed the
DBG_PRINT() macro and the if clause was wrongly changed. It means
that currently all the DBG_PRINT are being printed, flooding the
kernel log buffer with things like:

s2io: eth6: Next block at: c0000000b9c90000
s2io: eth6: In Neterion Tx routine

Signed-off-by: Breno Leitao <leitao@linux.vnet.ibm.com>
Acked-by: Sreenivasa Honnur <Sreenivasa.Honnur@neterion.com>
---
 drivers/net/s2io.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h
index 3645fb3..0af0335 100644
--- a/drivers/net/s2io.h
+++ b/drivers/net/s2io.h
@@ -65,7 +65,7 @@ static int debug_level = ERR_DBG;
 
 /* DEBUG message print. */
 #define DBG_PRINT(dbg_level, fmt, args...) do {			\
-	if (dbg_level >= debug_level)				\
+	if (dbg_level <= debug_level)				\
 		pr_info(fmt, ##args);				\
 	} while (0)
 
-- 
1.6.5.2


^ permalink raw reply related

* Re: [patch] usbnet: fix 100% CPU use on suspended device
From: Alan Stern @ 2010-07-26 15:13 UTC (permalink / raw)
  To: Elly Jones, Oliver Neukum; +Cc: David Miller, netdev, USB list
In-Reply-To: <AANLkTin_pduYCHVv_q4DSfSoQ7o4kFo43X8t1rXJ+7fa@mail.gmail.com>

On Mon, 26 Jul 2010, Elly Jones wrote:

> > This isn't right.  The problem should be fixed some other way.  Under
> > what circumstances are URBs submitted incorrectly?
> 
> When the device is autosuspended. What is the proper thing for a
> device to do here?

From looking at the code, it appears that the EVENT_DEV_ASLEEP flag
should be tested in usbnet_bh() the way it is in rx_submit().  But I'm
not an expert on usbnet; we should ask someone who is, like Oliver.

Alan Stern


^ permalink raw reply

* Re: [Bug #15704] [r8169] WARNING: at net/sched/sch_generic.c
From: Eric Dumazet @ 2010-07-26 15:20 UTC (permalink / raw)
  To: Sergey Senozhatsky
  Cc: Rafael J. Wysocki, Linux Kernel Mailing List, Kernel Testers List,
	Maciej Rutecki, netdev
In-Reply-To: <20100726145742.GA4888-dY8u8AhHFaWtd10JCjopabkcH5ONE+aC@public.gmane.org>

Le lundi 26 juillet 2010 à 17:57 +0300, Sergey Senozhatsky a écrit :

> 
> Only sending. 
> 
> --
>  PGDEV=/proc/net/pktgen/eth0
>  echo "Configuring $PGDEV"
>  pgset "$COUNT"
>  pgset "$CLONE_SKB"
>  pgset "$PKT_SIZE"
>  pgset "$DELAY"
>  pgset "dst 192.168.x.x"
>  pgset "dst_mac  x:x:x:x:x:x"
> 
>  PGDEV=/proc/net/pktgen/pgctrl
> 
>  echo "Running..."
>  pgset "start"
> --
> 
>  

If you try with a DELAY=3000 (or 5000), what happens ?

Do you have TX pause enabled ? If yes, try to disable pauses.

# ethtool -a eth0
Pause parameters for eth0:
Autonegotiate:	on
RX:		on
TX:		on

# ethtool -A eth0 rx off tx off
# ethtool -a eth0
Pause parameters for eth0:
Autonegotiate:	on
RX:		off
TX:		off

^ permalink raw reply

* Re: [PATCH UPDATED 1/3] vhost: replace vhost_workqueue with per-vhost kthread
From: Michael S. Tsirkin @ 2010-07-26 15:25 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Oleg Nesterov, Sridhar Samudrala, netdev, lkml,
	kvm@vger.kernel.org, Andrew Morton, Dmitri Vorobiev, Jiri Kosina,
	Thomas Gleixner, Ingo Molnar, Andi Kleen
In-Reply-To: <4C4BEAA2.6040301@kernel.org>

On Sun, Jul 25, 2010 at 09:41:22AM +0200, Tejun Heo wrote:
> Hello,
> 
> On 07/24/2010 09:14 PM, Michael S. Tsirkin wrote:
> >> I've created kthread_worker in wq#for-next tree and already converted
> >> ivtv to use it.  Once this lands in mainline, I think converting vhost
> >> to use it would be better choice.  kthread worker code uses basically
> >> the same logic used in the vhost_workqueue code but is better
> >> organized and documented.  So, I think it would be better to stick
> >> with the original implementation, as otherwise we're likely to just
> >> decrease test coverage without much gain.
> >>
> >>   http://git.kernel.org/?p=linux/kernel/git/tj/wq.git;a=commitdiff;h=b56c0d8937e665a27d90517ee7a746d0aa05af46;hp=53c5f5ba42c194cb13dd3083ed425f2c5b1ec439
> > 
> > Sure, if we keep using workqueue. But I'd like to investigate this
> > direction a bit more because there's discussion to switching from kthread to
> > regular threads altogether.
> 
> Hmmm? It doesn't have much to do with workqueue.  kthread_worker is a
> simple wrapper around kthread.  It now assumes kthread but changing it
> to be useable with any thread shouldn't be too hard.  Wouldn't that be
> better?

BTW, kthread_worker would benefit from the optimization I implemented
here as well.

-- 
MST

^ permalink raw reply

* Re: [PATCH UPDATED 1/3] vhost: replace vhost_workqueue with per-vhost kthread
From: Tejun Heo @ 2010-07-26 15:34 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Oleg Nesterov, Sridhar Samudrala, netdev, lkml,
	kvm@vger.kernel.org, Andrew Morton, Dmitri Vorobiev, Jiri Kosina,
	Thomas Gleixner, Ingo Molnar, Andi Kleen
In-Reply-To: <20100726152510.GA26223@redhat.com>

Hello,

On 07/26/2010 05:25 PM, Michael S. Tsirkin wrote:
> BTW, kthread_worker would benefit from the optimization I implemented
> here as well.

Hmmm... I'm not quite sure whether it's an optimization.  I thought
the patch was due to feeling uncomfortable about using barriers?  Is
it an optimization?

Thanks.

-- 
tejun

^ permalink raw reply

* slub numa: Fix rare allocation from unexpected node
From: Christoph Lameter @ 2010-07-26 15:41 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: linux-mm, jamal, netdev

Subject: slub numa: Fix rare allocation from unexpected node

The network developers have seen sporadic allocations resulting in objects
coming from unexpected NUMA nodes despite asking for objects from a
specific node.

This is due to get_partial() calling get_any_partial() if partial
slabs are exhausted for a node even if a node was specified and therefore
one would expect allocations only from the specified node.

get_any_partial() sporadically may return a slab from a foreign
node to gradually reduce the size of partial lists on remote nodes
and thereby reduce total memory use for a slab cache.

The behavior is controlled by the remote_defrag_ratio of each cache.

Strictly speaking this is permitted behavior since __GFP_THISNODE was
not specified for the allocation but it is certain surprising.

This patch makes sure that the remote defrag behavior only occurs
if no node was specified.

Signed-off-by: Christoph Lameter <cl@linux-foundation.org>

---
 mm/slub.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/mm/slub.c
===================================================================
--- linux-2.6.orig/mm/slub.c	2010-07-23 09:24:11.000000000 -0500
+++ linux-2.6/mm/slub.c	2010-07-23 09:25:15.000000000 -0500
@@ -1390,7 +1390,7 @@ static struct page *get_partial(struct k
 	int searchnode = (node == -1) ? numa_node_id() : node;

 	page = get_partial_node(get_node(s, searchnode));
-	if (page || (flags & __GFP_THISNODE))
+	if (page || node != -1)
 		return page;

 	return get_any_partial(s, flags);

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply

* Re: [PATCH UPDATED 1/3] vhost: replace vhost_workqueue with per-vhost kthread
From: Tejun Heo @ 2010-07-26 15:46 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Oleg Nesterov, Sridhar Samudrala, netdev, lkml,
	kvm@vger.kernel.org, Andrew Morton, Dmitri Vorobiev, Jiri Kosina,
	Thomas Gleixner, Ingo Molnar, Andi Kleen
In-Reply-To: <4C4DAB14.5050809@kernel.org>

On 07/26/2010 05:34 PM, Tejun Heo wrote:
> Hello,
> 
> On 07/26/2010 05:25 PM, Michael S. Tsirkin wrote:
>> BTW, kthread_worker would benefit from the optimization I implemented
>> here as well.
> 
> Hmmm... I'm not quite sure whether it's an optimization.  I thought
> the patch was due to feeling uncomfortable about using barriers?  Is
> it an optimization?

Yeah, one less smp_mb() in execution path.  The lock dancing in
flush() is ugly but then again mucking with barriers could be harder
to understand.  Care to send a patch against wq#for-next tree?

Thanks.

-- 
tejun

^ permalink raw reply

* Re: [PATCH] sky2: Fix most checkpatch errors
From: Stephen Hemminger @ 2010-07-26 15:46 UTC (permalink / raw)
  To: Mike McCormack; +Cc: netdev
In-Reply-To: <4C4D8D67.7080008@ring3k.org>

On Mon, 26 Jul 2010 22:28:07 +0900
Mike McCormack <mikem@ring3k.org> wrote:

> Tidy up whitespace and formatting to reduce from
>  38 errors to 4 and 20 fewer warnings.
> 
> Signed-off-by: Mike McCormack <mikem@ring3k.org>

Please don't bother fixing the stupid checkpatch whitespace noise.
Any patch that just substitutes space for tab (or vice versa) with
no human visible impact is just stupid.

But there are some useful tidbits in there.

--- a/drivers/net/sky2.c	2010-07-26 08:40:37.554612692 -0700
+++ b/drivers/net/sky2.c	2010-07-26 08:44:18.683011839 -0700
@@ -79,7 +79,7 @@
 
 #define SKY2_EEPROM_MAGIC	0x9955aabb
 
-#define RING_NEXT(x,s)	(((x)+1) & ((s)-1))
+#define RING_NEXT(x, s)	(((x)+1) & ((s)-1))
 
 static const u32 default_msg =
     NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK
@@ -172,7 +172,7 @@ static int gm_phy_write(struct sky2_hw *
 		udelay(10);
 	}
 
-	dev_warn(&hw->pdev->dev,"%s: phy write timeout\n", hw->dev[port]->name);
+	dev_warn(&hw->pdev->dev, "%s: phy write timeout\n", hw->dev[port]->name);
 	return -ETIMEDOUT;
 
 io_error:
@@ -1067,7 +1067,7 @@ static inline struct sky2_rx_le *sky2_ne
 	return le;
 }
 
-static unsigned sky2_get_rx_threshold(struct sky2_port* sky2)
+static unsigned sky2_get_rx_threshold(struct sky2_port *sky2)
 {
 	unsigned size;
 
@@ -1078,7 +1078,7 @@ static unsigned sky2_get_rx_threshold(st
 	return (size - 8) / sizeof(u32);
 }
 
-static unsigned sky2_get_rx_data_size(struct sky2_port* sky2)
+static unsigned sky2_get_rx_data_size(struct sky2_port *sky2)
 {
 	struct rx_ring_info *re;
 	unsigned size;
@@ -3014,7 +3014,7 @@ static int __devinit sky2_init(struct sk
 	hw->chip_id = sky2_read8(hw, B2_CHIP_ID);
 	hw->chip_rev = (sky2_read8(hw, B2_MAC_CFG) & CFG_CHIP_R_MSK) >> 4;
 
-	switch(hw->chip_id) {
+	switch (hw->chip_id) {
 	case CHIP_ID_YUKON_XL:
 		hw->flags = SKY2_HW_GIGABIT | SKY2_HW_NEWER_PHY;
 		if (hw->chip_rev < CHIP_REV_YU_XL_A2)
@@ -3685,7 +3685,7 @@ static int sky2_set_mac_address(struct n
 	return 0;
 }
 
-static void inline sky2_add_filter(u8 filter[8], const u8 *addr)
+static inline void sky2_add_filter(u8 filter[8], const u8 *addr)
 {
 	u32 bit;
 
@@ -3911,7 +3911,7 @@ static int sky2_set_coalesce(struct net_
 		return -EINVAL;
 	if (ecmd->rx_max_coalesced_frames > RX_MAX_PENDING)
 		return -EINVAL;
-	if (ecmd->rx_max_coalesced_frames_irq >RX_MAX_PENDING)
+	if (ecmd->rx_max_coalesced_frames_irq > RX_MAX_PENDING)
 		return -EINVAL;
 
 	if (ecmd->tx_coalesce_usecs == 0)
@@ -4372,7 +4372,7 @@ static int sky2_debug_show(struct seq_fi
 			seq_printf(seq, "%u:", idx);
 		sop = 0;
 
-		switch(le->opcode & ~HW_OWNER) {
+		switch (le->opcode & ~HW_OWNER) {
 		case OP_ADDR64:
 			seq_printf(seq, " %#x:", a);
 			break;
@@ -4441,7 +4441,7 @@ static int sky2_device_event(struct noti
 	if (dev->netdev_ops->ndo_open != sky2_up || !sky2_debug)
 		return NOTIFY_DONE;
 
-	switch(event) {
+	switch (event) {
 	case NETDEV_CHANGENAME:
 		if (sky2->debugfs) {
 			sky2->debugfs = debugfs_rename(sky2_debug, sky2->debugfs,
@@ -4636,7 +4636,7 @@ static int __devinit sky2_test_msi(struc
 	struct pci_dev *pdev = hw->pdev;
 	int err;
 
-	init_waitqueue_head (&hw->msi_wait);
+	init_waitqueue_head(&hw->msi_wait);
 
 	sky2_write32(hw, B0_IMSK, Y2_IS_IRQ_SW);
 

^ permalink raw reply

* Re: [PATCH UPDATED 1/3] vhost: replace vhost_workqueue with per-vhost kthread
From: Michael S. Tsirkin @ 2010-07-26 15:50 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Oleg Nesterov, Sridhar Samudrala, netdev, lkml,
	kvm@vger.kernel.org, Andrew Morton, Dmitri Vorobiev, Jiri Kosina,
	Thomas Gleixner, Ingo Molnar, Andi Kleen
In-Reply-To: <4C4DAB14.5050809@kernel.org>

On Mon, Jul 26, 2010 at 05:34:44PM +0200, Tejun Heo wrote:
> Hello,
> 
> On 07/26/2010 05:25 PM, Michael S. Tsirkin wrote:
> > BTW, kthread_worker would benefit from the optimization I implemented
> > here as well.
> 
> Hmmm... I'm not quite sure whether it's an optimization.  I thought
> the patch was due to feeling uncomfortable about using barriers?

Oh yes. But getting rid of barriers is what motivated me originally.

>  Is it an optimization?
> 
> Thanks.

Yes, sure. This removes atomic read and 2 barrier operations on data path.  And
it does not add any new synchronization: instead, we reuse the lock that we
take anyway.  The relevant part is:


+               if (work) {
+                       __set_current_state(TASK_RUNNING);
+                       work->fn(work);
+               } else
+                       schedule();

-       if (work) {
-               __set_current_state(TASK_RUNNING);
-               work->fn(work);
-               smp_wmb();      /* wmb worker-b0 paired with flush-b1 */
-               work->done_seq = work->queue_seq;
-               smp_mb();       /* mb worker-b1 paired with flush-b0 */
-               if (atomic_read(&work->flushing))
-                       wake_up_all(&work->done);
-       } else
-               schedule();
-
-       goto repeat;

Is there a git tree with kthread_worker applied?
I might do this just for fun ...


> -- 
> tejun

^ permalink raw reply

* Re: [PATCH UPDATED 1/3] vhost: replace vhost_workqueue with per-vhost kthread
From: Michael S. Tsirkin @ 2010-07-26 15:51 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Oleg Nesterov, Sridhar Samudrala, netdev, lkml,
	kvm@vger.kernel.org, Andrew Morton, Dmitri Vorobiev, Jiri Kosina,
	Thomas Gleixner, Ingo Molnar, Andi Kleen
In-Reply-To: <4C4DADD6.90507@kernel.org>

On Mon, Jul 26, 2010 at 05:46:30PM +0200, Tejun Heo wrote:
> On 07/26/2010 05:34 PM, Tejun Heo wrote:
> > Hello,
> > 
> > On 07/26/2010 05:25 PM, Michael S. Tsirkin wrote:
> >> BTW, kthread_worker would benefit from the optimization I implemented
> >> here as well.
> > 
> > Hmmm... I'm not quite sure whether it's an optimization.  I thought
> > the patch was due to feeling uncomfortable about using barriers?  Is
> > it an optimization?
> 
> Yeah, one less smp_mb() in execution path.  The lock dancing in
> flush() is ugly but then again mucking with barriers could be harder
> to understand.  Care to send a patch against wq#for-next tree?
> 
> Thanks.

Sure. Where's that, exactly?

> -- 
> tejun

^ permalink raw reply

* Re: [PATCH UPDATED 1/3] vhost: replace vhost_workqueue with per-vhost kthread
From: Tejun Heo @ 2010-07-26 16:05 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Oleg Nesterov, Sridhar Samudrala, netdev, lkml,
	kvm@vger.kernel.org, Andrew Morton, Dmitri Vorobiev, Jiri Kosina,
	Thomas Gleixner, Ingo Molnar, Andi Kleen
In-Reply-To: <20100726155014.GA26412@redhat.com>

Hello,

On 07/26/2010 05:50 PM, Michael S. Tsirkin wrote:
>> Hmmm... I'm not quite sure whether it's an optimization.  I thought
>> the patch was due to feeling uncomfortable about using barriers?
> 
> Oh yes. But getting rid of barriers is what motivated me originally.

Yeah, getting rid of barriers is always good.  :-)

> Is there a git tree with kthread_worker applied?
> I might do this just for fun ...

 git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git for-next

For the original implementaiton, please take a look at commit
b56c0d8937e665a27d90517ee7a746d0aa05af46.

* Can you please keep the outer goto repeat loop?  I just don't like
  outermost for (;;).

* Placing try_to_freeze() could be a bit annoying.  It shouldn't be
  executed when there's a work to flush.

* I think A - B <= 0 test would be more familiar.  At least
  time_before/after() are implemented that way.

Thanks.

-- 
tejun

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox