Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH net-next] net: phy: remove states PHY_STARTING and PHY_PENDING
From: David Miller @ 2018-11-11 18:05 UTC (permalink / raw)
  To: hkallweit1; +Cc: andrew, f.fainelli, netdev
In-Reply-To: <4bb8b90e-4958-6774-6984-0ca51e57b011@gmail.com>

From: Heiner Kallweit <hkallweit1@gmail.com>
Date: Sat, 10 Nov 2018 23:40:50 +0100

> Both states aren't used. Most likely they result from an idea that
> never materialized. So remove them.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Applied.

^ permalink raw reply

* Re: [RFC] mm: Replace all open encodings for NUMA_NO_NODE
From: Joseph Qi @ 2018-11-12  3:57 UTC (permalink / raw)
  To: Anshuman Khandual, linux-mm, linux-kernel
  Cc: ocfs2-devel, linux-fbdev, dri-devel, netdev, intel-wired-lan,
	linux-media, iommu, linux-rdma, dmaengine, linux-block,
	sparclinux, linuxppc-dev, linux-ia64, linux-alpha
In-Reply-To: <1541990515-11670-1-git-send-email-anshuman.khandual@arm.com>

For ocfs2 part, node means host in the cluster, not NUMA node.

Thanks,
Joseph

On 18/11/12 10:41, Anshuman Khandual wrote:
> At present there are multiple places where invalid node number is encoded
> as -1. Even though implicitly understood it is always better to have macros
> in there. Replace these open encodings for an invalid node number with the
> global macro NUMA_NO_NODE. This helps remove NUMA related assumptions like
> 'invalid node' from various places redirecting them to a common definition.
> 
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> Build tested this with multiple cross compiler options like alpha, sparc,
> arm64, x86, powerpc64le etc with their default config which might not have
> compiled tested all driver related changes. I will appreciate folks giving
> this a test in their respective build environment.
> 
> All these places for replacement were found by running the following grep
> patterns on the entire kernel code. Please let me know if this might have
> missed some instances. This might also have replaced some false positives.
> I will appreciate suggestions, inputs and review.
> 
> 1. git grep "nid == -1"
> 2. git grep "node == -1"
> 3. git grep "nid = -1"
> 4. git grep "node = -1"
> 
>  arch/alpha/include/asm/topology.h             |  2 +-
>  arch/ia64/kernel/numa.c                       |  2 +-
>  arch/ia64/mm/discontig.c                      |  6 +++---
>  arch/ia64/sn/kernel/io_common.c               |  2 +-
>  arch/powerpc/include/asm/pci-bridge.h         |  2 +-
>  arch/powerpc/kernel/paca.c                    |  2 +-
>  arch/powerpc/kernel/pci-common.c              |  2 +-
>  arch/powerpc/mm/numa.c                        | 14 +++++++-------
>  arch/powerpc/platforms/powernv/memtrace.c     |  4 ++--
>  arch/sparc/kernel/auxio_32.c                  |  2 +-
>  arch/sparc/kernel/pci_fire.c                  |  2 +-
>  arch/sparc/kernel/pci_schizo.c                |  2 +-
>  arch/sparc/kernel/pcic.c                      |  6 +++---
>  arch/sparc/kernel/psycho_common.c             |  2 +-
>  arch/sparc/kernel/sbus.c                      |  2 +-
>  arch/sparc/mm/init_64.c                       |  6 +++---
>  arch/sparc/prom/init_32.c                     |  2 +-
>  arch/sparc/prom/init_64.c                     |  4 ++--
>  arch/sparc/prom/tree_32.c                     | 12 ++++++------
>  arch/sparc/prom/tree_64.c                     | 18 +++++++++---------
>  arch/x86/include/asm/pci.h                    |  2 +-
>  arch/x86/kernel/apic/x2apic_uv_x.c            |  6 +++---
>  arch/x86/kernel/smpboot.c                     |  2 +-
>  arch/x86/platform/olpc/olpc_dt.c              | 16 ++++++++--------
>  drivers/block/mtip32xx/mtip32xx.c             |  4 ++--
>  drivers/dma/dmaengine.c                       |  3 ++-
>  drivers/infiniband/hw/hfi1/affinity.c         |  2 +-
>  drivers/infiniband/hw/hfi1/init.c             |  2 +-
>  drivers/iommu/dmar.c                          |  4 ++--
>  drivers/iommu/intel-iommu.c                   |  2 +-
>  drivers/media/pci/ivtv/ivtvfb.c               |  2 +-
>  drivers/media/platform/vivid/vivid-osd.c      |  2 +-
>  drivers/misc/sgi-xp/xpc_uv.c                  |  2 +-
>  drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |  4 ++--
>  drivers/video/fbdev/mmp/fb/mmpfb.c            |  2 +-
>  drivers/video/fbdev/pxa168fb.c                |  2 +-
>  drivers/video/fbdev/w100fb.c                  |  2 +-
>  fs/ocfs2/dlm/dlmcommon.h                      |  2 +-
>  fs/ocfs2/dlm/dlmdomain.c                      | 10 +++++-----
>  fs/ocfs2/dlm/dlmmaster.c                      |  2 +-
>  fs/ocfs2/dlm/dlmrecovery.c                    |  2 +-
>  fs/ocfs2/stack_user.c                         |  6 +++---
>  init/init_task.c                              |  2 +-
>  kernel/kthread.c                              |  2 +-
>  kernel/sched/fair.c                           | 15 ++++++++-------
>  lib/cpumask.c                                 |  2 +-
>  mm/huge_memory.c                              | 12 ++++++------
>  mm/hugetlb.c                                  |  2 +-
>  mm/ksm.c                                      |  2 +-
>  mm/memory.c                                   |  6 +++---
>  mm/memory_hotplug.c                           | 12 ++++++------
>  mm/mempolicy.c                                |  2 +-
>  mm/page_alloc.c                               |  4 ++--
>  mm/page_ext.c                                 |  2 +-
>  net/core/pktgen.c                             |  2 +-
>  net/qrtr/qrtr.c                               |  2 +-
>  tools/perf/bench/numa.c                       |  6 +++---
>  57 files changed, 125 insertions(+), 123 deletions(-)
> 
> diff --git a/arch/alpha/include/asm/topology.h b/arch/alpha/include/asm/topology.h
> index e6e13a8..f6dc89c 100644
> --- a/arch/alpha/include/asm/topology.h
> +++ b/arch/alpha/include/asm/topology.h
> @@ -29,7 +29,7 @@ static const struct cpumask *cpumask_of_node(int node)
>  {
>  	int cpu;
>  
> -	if (node == -1)
> +	if (node == NUMA_NO_NODE)
>  		return cpu_all_mask;
>  
>  	cpumask_clear(&node_to_cpumask_map[node]);
> diff --git a/arch/ia64/kernel/numa.c b/arch/ia64/kernel/numa.c
> index 92c3762..1315da6 100644
> --- a/arch/ia64/kernel/numa.c
> +++ b/arch/ia64/kernel/numa.c
> @@ -74,7 +74,7 @@ void __init build_cpu_to_node_map(void)
>  		cpumask_clear(&node_to_cpu_mask[node]);
>  
>  	for_each_possible_early_cpu(cpu) {
> -		node = -1;
> +		node = NUMA_NO_NODE;
>  		for (i = 0; i < NR_CPUS; ++i)
>  			if (cpu_physical_id(cpu) == node_cpuid[i].phys_id) {
>  				node = node_cpuid[i].nid;
> diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
> index 8a96578..f9c3675 100644
> --- a/arch/ia64/mm/discontig.c
> +++ b/arch/ia64/mm/discontig.c
> @@ -227,7 +227,7 @@ void __init setup_per_cpu_areas(void)
>  	 * CPUs are put into groups according to node.  Walk cpu_map
>  	 * and create new groups at node boundaries.
>  	 */
> -	prev_node = -1;
> +	prev_node = NUMA_NO_NODE;
>  	ai->nr_groups = 0;
>  	for (unit = 0; unit < nr_units; unit++) {
>  		cpu = cpu_map[unit];
> @@ -435,7 +435,7 @@ static void __init *memory_less_node_alloc(int nid, unsigned long pernodesize)
>  {
>  	void *ptr = NULL;
>  	u8 best = 0xff;
> -	int bestnode = -1, node, anynode = 0;
> +	int bestnode = NUMA_NO_NODE, node, anynode = 0;
>  
>  	for_each_online_node(node) {
>  		if (node_isset(node, memory_less_mask))
> @@ -447,7 +447,7 @@ static void __init *memory_less_node_alloc(int nid, unsigned long pernodesize)
>  		anynode = node;
>  	}
>  
> -	if (bestnode == -1)
> +	if (bestnode == NUMA_NO_NODE)
>  		bestnode = anynode;
>  
>  	ptr = memblock_alloc_try_nid(pernodesize, PERCPU_PAGE_SIZE,
> diff --git a/arch/ia64/sn/kernel/io_common.c b/arch/ia64/sn/kernel/io_common.c
> index 8df13d0..86b3fcb 100644
> --- a/arch/ia64/sn/kernel/io_common.c
> +++ b/arch/ia64/sn/kernel/io_common.c
> @@ -344,7 +344,7 @@ sn_common_bus_fixup(struct pci_bus *bus,
>  		printk(KERN_WARNING "on node %d but only %d nodes online."
>  		       "Association set to undetermined.\n",
>  		       controller->node, num_online_nodes());
> -		controller->node = -1;
> +		controller->node = NUMA_NO_NODE;
>  	}
>  }
>  
> diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
> index 94d4490..25a9e33 100644
> --- a/arch/powerpc/include/asm/pci-bridge.h
> +++ b/arch/powerpc/include/asm/pci-bridge.h
> @@ -264,7 +264,7 @@ extern int pcibios_map_io_space(struct pci_bus *bus);
>  #ifdef CONFIG_NUMA
>  #define PHB_SET_NODE(PHB, NODE)		((PHB)->node = (NODE))
>  #else
> -#define PHB_SET_NODE(PHB, NODE)		((PHB)->node = -1)
> +#define PHB_SET_NODE(PHB, NODE)		((PHB)->node = NUMA_NO_NODE)
>  #endif
>  
>  #endif	/* CONFIG_PPC64 */
> diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
> index 913bfca..6a0bd51 100644
> --- a/arch/powerpc/kernel/paca.c
> +++ b/arch/powerpc/kernel/paca.c
> @@ -36,7 +36,7 @@ static void *__init alloc_paca_data(unsigned long size, unsigned long align,
>  	 * which will put its paca in the right place.
>  	 */
>  	if (cpu == boot_cpuid) {
> -		nid = -1;
> +		nid = NUMA_NO_NODE;
>  		memblock_set_bottom_up(true);
>  	} else {
>  		nid = early_cpu_to_node(cpu);
> diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
> index 88e4f69..14c33a9 100644
> --- a/arch/powerpc/kernel/pci-common.c
> +++ b/arch/powerpc/kernel/pci-common.c
> @@ -132,7 +132,7 @@ struct pci_controller *pcibios_alloc_controller(struct device_node *dev)
>  		int nid = of_node_to_nid(dev);
>  
>  		if (nid < 0 || !node_online(nid))
> -			nid = -1;
> +			nid = NUMA_NO_NODE;
>  
>  		PHB_SET_NODE(phb, nid);
>  	}
> diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
> index 3a048e9..77808a2 100644
> --- a/arch/powerpc/mm/numa.c
> +++ b/arch/powerpc/mm/numa.c
> @@ -215,7 +215,7 @@ static void initialize_distance_lookup_table(int nid,
>   */
>  static int associativity_to_nid(const __be32 *associativity)
>  {
> -	int nid = -1;
> +	int nid = NUMA_NO_NODE;
>  
>  	if (min_common_depth == -1)
>  		goto out;
> @@ -225,7 +225,7 @@ static int associativity_to_nid(const __be32 *associativity)
>  
>  	/* POWER4 LPAR uses 0xffff as invalid node */
>  	if (nid == 0xffff || nid >= MAX_NUMNODES)
> -		nid = -1;
> +		nid = NUMA_NO_NODE;
>  
>  	if (nid > 0 &&
>  		of_read_number(associativity, 1) >= distance_ref_points_depth) {
> @@ -244,7 +244,7 @@ static int associativity_to_nid(const __be32 *associativity)
>   */
>  static int of_node_to_nid_single(struct device_node *device)
>  {
> -	int nid = -1;
> +	int nid = NUMA_NO_NODE;
>  	const __be32 *tmp;
>  
>  	tmp = of_get_associativity(device);
> @@ -256,7 +256,7 @@ static int of_node_to_nid_single(struct device_node *device)
>  /* Walk the device tree upwards, looking for an associativity id */
>  int of_node_to_nid(struct device_node *device)
>  {
> -	int nid = -1;
> +	int nid = NUMA_NO_NODE;
>  
>  	of_node_get(device);
>  	while (device) {
> @@ -454,7 +454,7 @@ static int of_drconf_to_nid_single(struct drmem_lmb *lmb)
>   */
>  static int numa_setup_cpu(unsigned long lcpu)
>  {
> -	int nid = -1;
> +	int nid = NUMA_NO_NODE;
>  	struct device_node *cpu;
>  
>  	/*
> @@ -930,7 +930,7 @@ static int hot_add_drconf_scn_to_nid(unsigned long scn_addr)
>  {
>  	struct drmem_lmb *lmb;
>  	unsigned long lmb_size;
> -	int nid = -1;
> +	int nid = NUMA_NO_NODE;
>  
>  	lmb_size = drmem_lmb_size();
>  
> @@ -960,7 +960,7 @@ static int hot_add_drconf_scn_to_nid(unsigned long scn_addr)
>  static int hot_add_node_scn_to_nid(unsigned long scn_addr)
>  {
>  	struct device_node *memory;
> -	int nid = -1;
> +	int nid = NUMA_NO_NODE;
>  
>  	for_each_node_by_type(memory, "memory") {
>  		unsigned long start, size;
> diff --git a/arch/powerpc/platforms/powernv/memtrace.c b/arch/powerpc/platforms/powernv/memtrace.c
> index 84d038e..1ce3bfc 100644
> --- a/arch/powerpc/platforms/powernv/memtrace.c
> +++ b/arch/powerpc/platforms/powernv/memtrace.c
> @@ -223,7 +223,7 @@ static int memtrace_online(void)
>  		ent = &memtrace_array[i];
>  
>  		/* We have onlined this chunk previously */
> -		if (ent->nid == -1)
> +		if (ent->nid == NUMA_NO_NODE)
>  			continue;
>  
>  		/* Remove from io mappings */
> @@ -257,7 +257,7 @@ static int memtrace_online(void)
>  		 */
>  		debugfs_remove_recursive(ent->dir);
>  		pr_info("Added trace memory back to node %d\n", ent->nid);
> -		ent->size = ent->start = ent->nid = -1;
> +		ent->size = ent->start = ent->nid = NUMA_NO_NODE;
>  	}
>  	if (ret)
>  		return ret;
> diff --git a/arch/sparc/kernel/auxio_32.c b/arch/sparc/kernel/auxio_32.c
> index a32d588..39f6c59 100644
> --- a/arch/sparc/kernel/auxio_32.c
> +++ b/arch/sparc/kernel/auxio_32.c
> @@ -120,7 +120,7 @@ void __init auxio_power_probe(void)
>  	node = prom_searchsiblings(node, "obio");
>  	node = prom_getchild(node);
>  	node = prom_searchsiblings(node, "power");
> -	if (node == 0 || (s32)node == -1)
> +	if (node == 0 || (s32)node == NUMA_NO_NODE)
>  		return;
>  
>  	/* Map the power control register. */
> diff --git a/arch/sparc/kernel/pci_fire.c b/arch/sparc/kernel/pci_fire.c
> index be71ae0..474d3be 100644
> --- a/arch/sparc/kernel/pci_fire.c
> +++ b/arch/sparc/kernel/pci_fire.c
> @@ -416,7 +416,7 @@ static int pci_fire_pbm_init(struct pci_pbm_info *pbm,
>  	struct device_node *dp = op->dev.of_node;
>  	int err;
>  
> -	pbm->numa_node = -1;
> +	pbm->numa_node = NUMA_NO_NODE;
>  
>  	pbm->pci_ops = &sun4u_pci_ops;
>  	pbm->config_space_reg_bits = 12;
> diff --git a/arch/sparc/kernel/pci_schizo.c b/arch/sparc/kernel/pci_schizo.c
> index 934b97c..87bb231 100644
> --- a/arch/sparc/kernel/pci_schizo.c
> +++ b/arch/sparc/kernel/pci_schizo.c
> @@ -1347,7 +1347,7 @@ static int schizo_pbm_init(struct pci_pbm_info *pbm,
>  	pbm->next = pci_pbm_root;
>  	pci_pbm_root = pbm;
>  
> -	pbm->numa_node = -1;
> +	pbm->numa_node = NUMA_NO_NODE;
>  
>  	pbm->pci_ops = &sun4u_pci_ops;
>  	pbm->config_space_reg_bits = 8;
> diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
> index ee4c9a9..d5fe898 100644
> --- a/arch/sparc/kernel/pcic.c
> +++ b/arch/sparc/kernel/pcic.c
> @@ -476,7 +476,7 @@ static void pcic_map_pci_device(struct linux_pcic *pcic,
>  	unsigned long flags;
>  	int j;
>  
> -	if (node == 0 || node == -1) {
> +	if (node == 0 || node == NUMA_NO_NODE) {
>  		strcpy(namebuf, "???");
>  	} else {
>  		prom_getstring(node, "name", namebuf, 63); namebuf[63] = 0;
> @@ -535,7 +535,7 @@ pcic_fill_irq(struct linux_pcic *pcic, struct pci_dev *dev, int node)
>  	int i, ivec;
>  	char namebuf[64];
>  
> -	if (node == 0 || node == -1) {
> +	if (node == 0 || node == NUMA_NO_NODE) {
>  		strcpy(namebuf, "???");
>  	} else {
>  		prom_getstring(node, "name", namebuf, sizeof(namebuf));
> @@ -625,7 +625,7 @@ void pcibios_fixup_bus(struct pci_bus *bus)
>  	list_for_each_entry(dev, &bus->devices, bus_list) {
>  		node = pdev_to_pnode(&pcic->pbm, dev);
>  		if(node == 0)
> -			node = -1;
> +			node = NUMA_NO_NODE;
>  
>  		/* cookies */
>  		pcp = pci_devcookie_alloc();
> diff --git a/arch/sparc/kernel/psycho_common.c b/arch/sparc/kernel/psycho_common.c
> index 81aa91e..dcbf492 100644
> --- a/arch/sparc/kernel/psycho_common.c
> +++ b/arch/sparc/kernel/psycho_common.c
> @@ -454,7 +454,7 @@ void psycho_pbm_init_common(struct pci_pbm_info *pbm, struct platform_device *op
>  	struct device_node *dp = op->dev.of_node;
>  
>  	pbm->name = dp->full_name;
> -	pbm->numa_node = -1;
> +	pbm->numa_node = NUMA_NO_NODE;
>  	pbm->chip_type = chip_type;
>  	pbm->chip_version = of_getintprop_default(dp, "version#", 0);
>  	pbm->chip_revision = of_getintprop_default(dp, "module-revision#", 0);
> diff --git a/arch/sparc/kernel/sbus.c b/arch/sparc/kernel/sbus.c
> index c133dfc..28a4aa9 100644
> --- a/arch/sparc/kernel/sbus.c
> +++ b/arch/sparc/kernel/sbus.c
> @@ -561,7 +561,7 @@ static void __init sbus_iommu_init(struct platform_device *op)
>  
>  	op->dev.archdata.iommu = iommu;
>  	op->dev.archdata.stc = strbuf;
> -	op->dev.archdata.numa_node = -1;
> +	op->dev.archdata.numa_node = NUMA_NO_NODE;
>  
>  	reg_base = regs + SYSIO_IOMMUREG_BASE;
>  	iommu->iommu_control = reg_base + IOMMU_CONTROL;
> diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
> index 3c8aac2..cb1bed1 100644
> --- a/arch/sparc/mm/init_64.c
> +++ b/arch/sparc/mm/init_64.c
> @@ -976,13 +976,13 @@ static u64 __init memblock_nid_range_sun4u(u64 start, u64 end, int *nid)
>  {
>  	int prev_nid, new_nid;
>  
> -	prev_nid = -1;
> +	prev_nid = NUMA_NO_NODE;
>  	for ( ; start < end; start += PAGE_SIZE) {
>  		for (new_nid = 0; new_nid < num_node_masks; new_nid++) {
>  			struct node_mem_mask *p = &node_masks[new_nid];
>  
>  			if ((start & p->mask) == p->match) {
> -				if (prev_nid == -1)
> +				if (prev_nid == NUMA_NO_NODE)
>  					prev_nid = new_nid;
>  				break;
>  			}
> @@ -1208,7 +1208,7 @@ int of_node_to_nid(struct device_node *dp)
>  	md = mdesc_grab();
>  
>  	count = 0;
> -	nid = -1;
> +	nid = NUMA_NO_NODE;
>  	mdesc_for_each_node_by_name(md, grp, "group") {
>  		if (!scan_arcs_for_cfg_handle(md, grp, cfg_handle)) {
>  			nid = count;
> diff --git a/arch/sparc/prom/init_32.c b/arch/sparc/prom/init_32.c
> index d204701..4c6e540 100644
> --- a/arch/sparc/prom/init_32.c
> +++ b/arch/sparc/prom/init_32.c
> @@ -58,7 +58,7 @@ void __init prom_init(struct linux_romvec *rp)
>  	prom_nodeops = romvec->pv_nodeops;
>  
>  	prom_root_node = prom_getsibling(0);
> -	if ((prom_root_node == 0) || ((s32)prom_root_node == -1))
> +	if ((prom_root_node == 0) || ((s32)prom_root_node == NUMA_NO_NODE))
>  		prom_halt();
>  
>  	if((((unsigned long) prom_nodeops) == 0) || 
> diff --git a/arch/sparc/prom/init_64.c b/arch/sparc/prom/init_64.c
> index 103aa91..85669c0 100644
> --- a/arch/sparc/prom/init_64.c
> +++ b/arch/sparc/prom/init_64.c
> @@ -36,13 +36,13 @@ void __init prom_init(void *cif_handler)
>  	prom_cif_init(cif_handler);
>  
>  	prom_chosen_node = prom_finddevice(prom_chosen_path);
> -	if (!prom_chosen_node || (s32)prom_chosen_node == -1)
> +	if (!prom_chosen_node || (s32)prom_chosen_node == NUMA_NO_NODE)
>  		prom_halt();
>  
>  	prom_stdout = prom_getint(prom_chosen_node, "stdout");
>  
>  	node = prom_finddevice("/openprom");
> -	if (!node || (s32)node == -1)
> +	if (!node || (s32)node == NUMA_NO_NODE)
>  		prom_halt();
>  
>  	prom_getstring(node, "version", prom_version, sizeof(prom_version));
> diff --git a/arch/sparc/prom/tree_32.c b/arch/sparc/prom/tree_32.c
> index 0fed893..2d0a204 100644
> --- a/arch/sparc/prom/tree_32.c
> +++ b/arch/sparc/prom/tree_32.c
> @@ -41,11 +41,11 @@ phandle prom_getchild(phandle node)
>  {
>  	phandle cnode;
>  
> -	if ((s32)node == -1)
> +	if ((s32)node == NUMA_NO_NODE)
>  		return 0;
>  
>  	cnode = __prom_getchild(node);
> -	if (cnode == 0 || (s32)cnode == -1)
> +	if (cnode == 0 || (s32)cnode == NUMA_NO_NODE)
>  		return 0;
>  
>  	return cnode;
> @@ -73,11 +73,11 @@ phandle prom_getsibling(phandle node)
>  {
>  	phandle sibnode;
>  
> -	if ((s32)node == -1)
> +	if ((s32)node == NUMA_NO_NODE)
>  		return 0;
>  
>  	sibnode = __prom_getsibling(node);
> -	if (sibnode == 0 || (s32)sibnode == -1)
> +	if (sibnode == 0 || (s32)sibnode == NUMA_NO_NODE)
>  		return 0;
>  
>  	return sibnode;
> @@ -220,7 +220,7 @@ static char *__prom_nextprop(phandle node, char * oprop)
>   */
>  char *prom_nextprop(phandle node, char *oprop, char *buffer)
>  {
> -	if (node == 0 || (s32)node == -1)
> +	if (node == 0 || (s32)node == NUMA_NO_NODE)
>  		return "";
>  
>  	return __prom_nextprop(node, oprop);
> @@ -304,7 +304,7 @@ phandle prom_inst2pkg(int inst)
>  	node = (*romvec->pv_v2devops.v2_inst2pkg)(inst);
>  	restore_current();
>  	spin_unlock_irqrestore(&prom_lock, flags);
> -	if ((s32)node == -1)
> +	if ((s32)node == NUMA_NO_NODE)
>  		return 0;
>  	return node;
>  }
> diff --git a/arch/sparc/prom/tree_64.c b/arch/sparc/prom/tree_64.c
> index 989e799..2b4c515 100644
> --- a/arch/sparc/prom/tree_64.c
> +++ b/arch/sparc/prom/tree_64.c
> @@ -44,10 +44,10 @@ phandle prom_getchild(phandle node)
>  {
>  	phandle cnode;
>  
> -	if ((s32)node == -1)
> +	if ((s32)node == NUMA_NO_NODE)
>  		return 0;
>  	cnode = __prom_getchild(node);
> -	if ((s32)cnode == -1)
> +	if ((s32)cnode == NUMA_NO_NODE)
>  		return 0;
>  	return cnode;
>  }
> @@ -57,10 +57,10 @@ inline phandle prom_getparent(phandle node)
>  {
>  	phandle cnode;
>  
> -	if ((s32)node == -1)
> +	if ((s32)node == NUMA_NO_NODE)
>  		return 0;
>  	cnode = prom_node_to_node("parent", node);
> -	if ((s32)cnode == -1)
> +	if ((s32)cnode == NUMA_NO_NODE)
>  		return 0;
>  	return cnode;
>  }
> @@ -77,10 +77,10 @@ phandle prom_getsibling(phandle node)
>  {
>  	phandle sibnode;
>  
> -	if ((s32)node == -1)
> +	if ((s32)node == NUMA_NO_NODE)
>  		return 0;
>  	sibnode = __prom_getsibling(node);
> -	if ((s32)sibnode == -1)
> +	if ((s32)sibnode == NUMA_NO_NODE)
>  		return 0;
>  
>  	return sibnode;
> @@ -241,7 +241,7 @@ char *prom_firstprop(phandle node, char *buffer)
>  	unsigned long args[7];
>  
>  	*buffer = 0;
> -	if ((s32)node == -1)
> +	if ((s32)node == NUMA_NO_NODE)
>  		return buffer;
>  
>  	args[0] = (unsigned long) prom_nextprop_name;
> @@ -267,7 +267,7 @@ char *prom_nextprop(phandle node, const char *oprop, char *buffer)
>  	unsigned long args[7];
>  	char buf[32];
>  
> -	if ((s32)node == -1) {
> +	if ((s32)node == NUMA_NO_NODE) {
>  		*buffer = 0;
>  		return buffer;
>  	}
> @@ -370,7 +370,7 @@ inline phandle prom_inst2pkg(int inst)
>  	p1275_cmd_direct(args);
>  
>  	node = (int) args[4];
> -	if ((s32)node == -1)
> +	if ((s32)node == NUMA_NO_NODE)
>  		return 0;
>  	return node;
>  }
> diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
> index 6629636..dee2a31 100644
> --- a/arch/x86/include/asm/pci.h
> +++ b/arch/x86/include/asm/pci.h
> @@ -141,7 +141,7 @@ cpumask_of_pcibus(const struct pci_bus *bus)
>  	int node;
>  
>  	node = __pcibus_to_node(bus);
> -	return (node == -1) ? cpu_online_mask :
> +	return (node == NUMA_NO_NODE) ? cpu_online_mask :
>  			      cpumask_of_node(node);
>  }
>  #endif
> diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
> index 391f358..3c3378a 100644
> --- a/arch/x86/kernel/apic/x2apic_uv_x.c
> +++ b/arch/x86/kernel/apic/x2apic_uv_x.c
> @@ -1390,7 +1390,7 @@ static void __init build_socket_tables(void)
>  	}
>  
>  	/* Set socket -> node values: */
> -	lnid = -1;
> +	lnid = NUMA_NO_NODE;
>  	for_each_present_cpu(cpu) {
>  		int nid = cpu_to_node(cpu);
>  		int apicid, sockid;
> @@ -1521,7 +1521,7 @@ static void __init uv_system_init_hub(void)
>  			new_hub->pnode = 0xffff;
>  
>  		new_hub->numa_blade_id = uv_node_to_blade_id(nodeid);
> -		new_hub->memory_nid = -1;
> +		new_hub->memory_nid = NUMA_NO_NODE;
>  		new_hub->nr_possible_cpus = 0;
>  		new_hub->nr_online_cpus = 0;
>  	}
> @@ -1538,7 +1538,7 @@ static void __init uv_system_init_hub(void)
>  
>  		uv_cpu_info_per(cpu)->p_uv_hub_info = uv_hub_info_list(nodeid);
>  		uv_cpu_info_per(cpu)->blade_cpu_id = uv_cpu_hub_info(cpu)->nr_possible_cpus++;
> -		if (uv_cpu_hub_info(cpu)->memory_nid == -1)
> +		if (uv_cpu_hub_info(cpu)->memory_nid == NUMA_NO_NODE)
>  			uv_cpu_hub_info(cpu)->memory_nid = cpu_to_node(cpu);
>  
>  		/* Init memoryless node: */
> diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
> index a9134d1..c1d45dc 100644
> --- a/arch/x86/kernel/smpboot.c
> +++ b/arch/x86/kernel/smpboot.c
> @@ -841,7 +841,7 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip)
>  /* reduce the number of lines printed when booting a large cpu count system */
>  static void announce_cpu(int cpu, int apicid)
>  {
> -	static int current_node = -1;
> +	static int current_node = NUMA_NO_NODE;
>  	int node = early_cpu_to_node(cpu);
>  	static int width, node_width;
>  
> diff --git a/arch/x86/platform/olpc/olpc_dt.c b/arch/x86/platform/olpc/olpc_dt.c
> index 24d2175..7098127 100644
> --- a/arch/x86/platform/olpc/olpc_dt.c
> +++ b/arch/x86/platform/olpc/olpc_dt.c
> @@ -29,10 +29,10 @@ static phandle __init olpc_dt_getsibling(phandle node)
>  	const void *args[] = { (void *)node };
>  	void *res[] = { &node };
>  
> -	if ((s32)node == -1)
> +	if ((s32)node == NUMA_NO_NODE)
>  		return 0;
>  
> -	if (olpc_ofw("peer", args, res) || (s32)node == -1)
> +	if (olpc_ofw("peer", args, res) || (s32)node == NUMA_NO_NODE)
>  		return 0;
>  
>  	return node;
> @@ -43,10 +43,10 @@ static phandle __init olpc_dt_getchild(phandle node)
>  	const void *args[] = { (void *)node };
>  	void *res[] = { &node };
>  
> -	if ((s32)node == -1)
> +	if ((s32)node == NUMA_NO_NODE)
>  		return 0;
>  
> -	if (olpc_ofw("child", args, res) || (s32)node == -1) {
> +	if (olpc_ofw("child", args, res) || (s32)node == NUMA_NO_NODE) {
>  		pr_err("PROM: %s: fetching child failed!\n", __func__);
>  		return 0;
>  	}
> @@ -60,7 +60,7 @@ static int __init olpc_dt_getproplen(phandle node, const char *prop)
>  	int len;
>  	void *res[] = { &len };
>  
> -	if ((s32)node == -1)
> +	if ((s32)node == NUMA_NO_NODE)
>  		return -1;
>  
>  	if (olpc_ofw("getproplen", args, res)) {
> @@ -100,7 +100,7 @@ static int __init olpc_dt_nextprop(phandle node, char *prev, char *buf)
>  
>  	buf[0] = '\0';
>  
> -	if ((s32)node == -1)
> +	if ((s32)node == NUMA_NO_NODE)
>  		return -1;
>  
>  	if (olpc_ofw("nextprop", args, res) || success != 1)
> @@ -115,7 +115,7 @@ static int __init olpc_dt_pkg2path(phandle node, char *buf,
>  	const void *args[] = { (void *)node, buf, (void *)buflen };
>  	void *res[] = { len };
>  
> -	if ((s32)node == -1)
> +	if ((s32)node == NUMA_NO_NODE)
>  		return -1;
>  
>  	if (olpc_ofw("package-to-path", args, res) || *len < 1)
> @@ -176,7 +176,7 @@ static phandle __init olpc_dt_finddevice(const char *path)
>  		return 0;
>  	}
>  
> -	if ((s32) node == -1)
> +	if ((s32) node == NUMA_NO_NODE)
>  		return 0;
>  
>  	return node;
> diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
> index a7daa8a..b889452 100644
> --- a/drivers/block/mtip32xx/mtip32xx.c
> +++ b/drivers/block/mtip32xx/mtip32xx.c
> @@ -4084,9 +4084,9 @@ static int get_least_used_cpu_on_node(int node)
>  /* Helper for selecting a node in round robin mode */
>  static inline int mtip_get_next_rr_node(void)
>  {
> -	static int next_node = -1;
> +	static int next_node = NUMA_NO_NODE;
>  
> -	if (next_node == -1) {
> +	if (next_node == NUMA_NO_NODE) {
>  		next_node = first_online_node;
>  		return next_node;
>  	}
> diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
> index f1a441ab..1aeefc7 100644
> --- a/drivers/dma/dmaengine.c
> +++ b/drivers/dma/dmaengine.c
> @@ -386,7 +386,8 @@ EXPORT_SYMBOL(dma_issue_pending_all);
>  static bool dma_chan_is_local(struct dma_chan *chan, int cpu)
>  {
>  	int node = dev_to_node(chan->device->dev);
> -	return node == -1 || cpumask_test_cpu(cpu, cpumask_of_node(node));
> +	return node == NUMA_NO_NODE ||
> +		cpumask_test_cpu(cpu, cpumask_of_node(node));
>  }
>  
>  /**
> diff --git a/drivers/infiniband/hw/hfi1/affinity.c b/drivers/infiniband/hw/hfi1/affinity.c
> index 2baf38c..3e8acb8 100644
> --- a/drivers/infiniband/hw/hfi1/affinity.c
> +++ b/drivers/infiniband/hw/hfi1/affinity.c
> @@ -777,7 +777,7 @@ void hfi1_dev_affinity_clean_up(struct hfi1_devdata *dd)
>  	_dev_comp_vect_cpu_mask_clean_up(dd, entry);
>  unlock:
>  	mutex_unlock(&node_affinity.lock);
> -	dd->node = -1;
> +	dd->node = NUMA_NO_NODE;
>  }
>  
>  /*
> diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c
> index 0904490..0bf4577 100644
> --- a/drivers/infiniband/hw/hfi1/init.c
> +++ b/drivers/infiniband/hw/hfi1/init.c
> @@ -1303,7 +1303,7 @@ static struct hfi1_devdata *hfi1_alloc_devdata(struct pci_dev *pdev,
>  		dd->unit = ret;
>  		list_add(&dd->list, &hfi1_dev_list);
>  	}
> -	dd->node = -1;
> +	dd->node = NUMA_NO_NODE;
>  
>  	spin_unlock_irqrestore(&hfi1_devs_lock, flags);
>  	idr_preload_end();
> diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
> index d9c748b..86a9c19 100644
> --- a/drivers/iommu/dmar.c
> +++ b/drivers/iommu/dmar.c
> @@ -477,7 +477,7 @@ static int dmar_parse_one_rhsa(struct acpi_dmar_header *header, void *arg)
>  			int node = acpi_map_pxm_to_node(rhsa->proximity_domain);
>  
>  			if (!node_online(node))
> -				node = -1;
> +				node = NUMA_NO_NODE;
>  			drhd->iommu->node = node;
>  			return 0;
>  		}
> @@ -1062,7 +1062,7 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd)
>  	iommu->msagaw = msagaw;
>  	iommu->segment = drhd->segment;
>  
> -	iommu->node = -1;
> +	iommu->node = NUMA_NO_NODE;
>  
>  	ver = readl(iommu->reg + DMAR_VER_REG);
>  	pr_info("%s: reg_base_addr %llx ver %d:%d cap %llx ecap %llx\n",
> diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
> index f3ccf02..9f6fb13 100644
> --- a/drivers/iommu/intel-iommu.c
> +++ b/drivers/iommu/intel-iommu.c
> @@ -1772,7 +1772,7 @@ static struct dmar_domain *alloc_domain(int flags)
>  		return NULL;
>  
>  	memset(domain, 0, sizeof(*domain));
> -	domain->nid = -1;
> +	domain->nid = NUMA_NO_NODE;
>  	domain->flags = flags;
>  	domain->has_iotlb_device = false;
>  	INIT_LIST_HEAD(&domain->devices);
> diff --git a/drivers/media/pci/ivtv/ivtvfb.c b/drivers/media/pci/ivtv/ivtvfb.c
> index 3e02de0..81bd41c 100644
> --- a/drivers/media/pci/ivtv/ivtvfb.c
> +++ b/drivers/media/pci/ivtv/ivtvfb.c
> @@ -1054,7 +1054,7 @@ static int ivtvfb_init_vidmode(struct ivtv *itv)
>  
>  	/* Generate valid fb_info */
>  
> -	oi->ivtvfb_info.node = -1;
> +	oi->ivtvfb_info.node = NUMA_NO_NODE;
>  	oi->ivtvfb_info.flags = FBINFO_FLAG_DEFAULT;
>  	oi->ivtvfb_info.fbops = &ivtvfb_ops;
>  	oi->ivtvfb_info.par = itv;
> diff --git a/drivers/media/platform/vivid/vivid-osd.c b/drivers/media/platform/vivid/vivid-osd.c
> index 1a89593..56a2d41 100644
> --- a/drivers/media/platform/vivid/vivid-osd.c
> +++ b/drivers/media/platform/vivid/vivid-osd.c
> @@ -309,7 +309,7 @@ static int vivid_fb_init_vidmode(struct vivid_dev *dev)
>  
>  	/* Generate valid fb_info */
>  
> -	dev->fb_info.node = -1;
> +	dev->fb_info.node = NUMA_NO_NODE;
>  	dev->fb_info.flags = FBINFO_FLAG_DEFAULT;
>  	dev->fb_info.fbops = &vivid_fb_ops;
>  	dev->fb_info.par = dev;
> diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c
> index 0441abe..eef36dd 100644
> --- a/drivers/misc/sgi-xp/xpc_uv.c
> +++ b/drivers/misc/sgi-xp/xpc_uv.c
> @@ -61,7 +61,7 @@ static struct xpc_heartbeat_uv *xpc_heartbeat_uv;
>  					 XPC_NOTIFY_MSG_SIZE_UV)
>  #define XPC_NOTIFY_IRQ_NAME		"xpc_notify"
>  
> -static int xpc_mq_node = -1;
> +static int xpc_mq_node = NUMA_NO_NODE;
>  
>  static struct xpc_gru_mq_uv *xpc_activate_mq_uv;
>  static struct xpc_gru_mq_uv *xpc_notify_mq_uv;
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> index 113b38e..4fae85c 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> @@ -6414,7 +6414,7 @@ int ixgbe_setup_tx_resources(struct ixgbe_ring *tx_ring)
>  {
>  	struct device *dev = tx_ring->dev;
>  	int orig_node = dev_to_node(dev);
> -	int ring_node = -1;
> +	int ring_node = NUMA_NO_NODE;
>  	int size;
>  
>  	size = sizeof(struct ixgbe_tx_buffer) * tx_ring->count;
> @@ -6508,7 +6508,7 @@ int ixgbe_setup_rx_resources(struct ixgbe_adapter *adapter,
>  {
>  	struct device *dev = rx_ring->dev;
>  	int orig_node = dev_to_node(dev);
> -	int ring_node = -1;
> +	int ring_node = NUMA_NO_NODE;
>  	int size;
>  
>  	size = sizeof(struct ixgbe_rx_buffer) * rx_ring->count;
> diff --git a/drivers/video/fbdev/mmp/fb/mmpfb.c b/drivers/video/fbdev/mmp/fb/mmpfb.c
> index ee212be..298be9b 100644
> --- a/drivers/video/fbdev/mmp/fb/mmpfb.c
> +++ b/drivers/video/fbdev/mmp/fb/mmpfb.c
> @@ -519,7 +519,7 @@ static int fb_info_setup(struct fb_info *info,
>  	/* Initialise static fb parameters.*/
>  	info->flags = FBINFO_DEFAULT | FBINFO_PARTIAL_PAN_OK |
>  		FBINFO_HWACCEL_XPAN | FBINFO_HWACCEL_YPAN;
> -	info->node = -1;
> +	info->node = NUMA_NO_NODE;
>  	strcpy(info->fix.id, fbi->name);
>  	info->fix.type = FB_TYPE_PACKED_PIXELS;
>  	info->fix.type_aux = 0;
> diff --git a/drivers/video/fbdev/pxa168fb.c b/drivers/video/fbdev/pxa168fb.c
> index e31340f..7d775de 100644
> --- a/drivers/video/fbdev/pxa168fb.c
> +++ b/drivers/video/fbdev/pxa168fb.c
> @@ -649,7 +649,7 @@ static int pxa168fb_probe(struct platform_device *pdev)
>  	 */
>  	info->flags = FBINFO_DEFAULT | FBINFO_PARTIAL_PAN_OK |
>  		      FBINFO_HWACCEL_XPAN | FBINFO_HWACCEL_YPAN;
> -	info->node = -1;
> +	info->node = NUMA_NO_NODE;
>  	strlcpy(info->fix.id, mi->id, 16);
>  	info->fix.type = FB_TYPE_PACKED_PIXELS;
>  	info->fix.type_aux = 0;
> diff --git a/drivers/video/fbdev/w100fb.c b/drivers/video/fbdev/w100fb.c
> index 696106e..8b0f20c 100644
> --- a/drivers/video/fbdev/w100fb.c
> +++ b/drivers/video/fbdev/w100fb.c
> @@ -703,7 +703,7 @@ int w100fb_probe(struct platform_device *pdev)
>  	info->fbops = &w100fb_ops;
>  	info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_COPYAREA |
>  		FBINFO_HWACCEL_FILLRECT;
> -	info->node = -1;
> +	info->node = NUMA_NO_NODE;
>  	info->screen_base = remapped_fbuf + (W100_FB_BASE-MEM_WINDOW_BASE);
>  	info->screen_size = REMAPPED_FB_LEN;
>  
> diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h
> index d06e27e..11111f6 100644
> --- a/fs/ocfs2/dlm/dlmcommon.h
> +++ b/fs/ocfs2/dlm/dlmcommon.h
> @@ -1121,7 +1121,7 @@ static inline void dlm_node_iter_init(unsigned long *map,
>  				      struct dlm_node_iter *iter)
>  {
>  	memcpy(iter->node_map, map, sizeof(iter->node_map));
> -	iter->curnode = -1;
> +	iter->curnode = NUMA_NO_NODE;
>  }
>  
>  static inline int dlm_node_iter_next(struct dlm_node_iter *iter)
> diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c
> index 2acd58b..381a323 100644
> --- a/fs/ocfs2/dlm/dlmdomain.c
> +++ b/fs/ocfs2/dlm/dlmdomain.c
> @@ -546,7 +546,7 @@ static void dlm_mark_domain_leaving(struct dlm_ctxt *dlm)
>  
>  static void __dlm_print_nodes(struct dlm_ctxt *dlm)
>  {
> -	int node = -1, num = 0;
> +	int node = NUMA_NO_NODE, num = 0;
>  
>  	assert_spin_locked(&dlm->spinlock);
>  
> @@ -613,7 +613,7 @@ static int dlm_send_one_domain_exit(struct dlm_ctxt *dlm, u32 msg_type,
>  
>  static void dlm_begin_exit_domain(struct dlm_ctxt *dlm)
>  {
> -	int node = -1;
> +	int node = NUMA_NO_NODE;
>  
>  	/* Support for begin exit domain was added in 1.2 */
>  	if (dlm->dlm_locking_proto.pv_major == 1 &&
> @@ -1407,7 +1407,7 @@ static int dlm_send_join_cancels(struct dlm_ctxt *dlm,
>  	}
>  
>  	status = 0;
> -	node = -1;
> +	node = NUMA_NO_NODE;
>  	while ((node = find_next_bit(node_map, O2NM_MAX_NODES,
>  				     node + 1)) < O2NM_MAX_NODES) {
>  		if (node == dlm->node_num)
> @@ -1547,7 +1547,7 @@ static void dlm_send_join_asserts(struct dlm_ctxt *dlm,
>  	int status, node, live;
>  
>  	status = 0;
> -	node = -1;
> +	node = NUMA_NO_NODE;
>  	while ((node = find_next_bit(node_map, O2NM_MAX_NODES,
>  				     node + 1)) < O2NM_MAX_NODES) {
>  		if (node == dlm->node_num)
> @@ -1631,7 +1631,7 @@ static int dlm_try_to_join_domain(struct dlm_ctxt *dlm)
>  
>  	spin_unlock(&dlm->spinlock);
>  
> -	node = -1;
> +	node = NUMA_NO_NODE;
>  	while ((node = find_next_bit(ctxt->live_map, O2NM_MAX_NODES,
>  				     node + 1)) < O2NM_MAX_NODES) {
>  		if (node == dlm->node_num)
> diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
> index 826f056..e54bbbc 100644
> --- a/fs/ocfs2/dlm/dlmmaster.c
> +++ b/fs/ocfs2/dlm/dlmmaster.c
> @@ -1183,7 +1183,7 @@ static void dlm_bitmap_diff_iter_init(struct dlm_bitmap_diff_iter *iter,
>  	unsigned long p1, p2;
>  	int i;
>  
> -	iter->curnode = -1;
> +	iter->curnode = NUMA_NO_NODE;
>  	iter->orig_bm = orig_bm;
>  	iter->cur_bm = cur_bm;
>  
> diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
> index 802636d5..704fa8b 100644
> --- a/fs/ocfs2/dlm/dlmrecovery.c
> +++ b/fs/ocfs2/dlm/dlmrecovery.c
> @@ -2903,7 +2903,7 @@ static int dlm_send_finalize_reco_message(struct dlm_ctxt *dlm)
>  	}
>  	if (stage == 1) {
>  		/* reset the node_iter back to the top and send finalize2 */
> -		iter.curnode = -1;
> +		iter.curnode = NUMA_NO_NODE;
>  		stage = 2;
>  		goto stage2;
>  	}
> diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c
> index d2fb97b..a673efa 100644
> --- a/fs/ocfs2/stack_user.c
> +++ b/fs/ocfs2/stack_user.c
> @@ -171,7 +171,7 @@ union ocfs2_control_message {
>  static struct ocfs2_stack_plugin ocfs2_user_plugin;
>  
>  static atomic_t ocfs2_control_opened;
> -static int ocfs2_control_this_node = -1;
> +static int ocfs2_control_this_node = NUMA_NO_NODE;
>  static struct ocfs2_protocol_version running_proto;
>  
>  static LIST_HEAD(ocfs2_live_connection_list);
> @@ -589,7 +589,7 @@ static int ocfs2_control_release(struct inode *inode, struct file *file)
>  		 * Last valid close clears the node number and resets
>  		 * the locking protocol version
>  		 */
> -		ocfs2_control_this_node = -1;
> +		ocfs2_control_this_node = NUMA_NO_NODE;
>  		running_proto.pv_major = 0;
>  		running_proto.pv_minor = 0;
>  	}
> @@ -612,7 +612,7 @@ static int ocfs2_control_open(struct inode *inode, struct file *file)
>  	p = kzalloc(sizeof(struct ocfs2_control_private), GFP_KERNEL);
>  	if (!p)
>  		return -ENOMEM;
> -	p->op_this_node = -1;
> +	p->op_this_node = NUMA_NO_NODE;
>  
>  	mutex_lock(&ocfs2_control_lock);
>  	file->private_data = p;
> diff --git a/init/init_task.c b/init/init_task.c
> index 5aebe3b..6641836 100644
> --- a/init/init_task.c
> +++ b/init/init_task.c
> @@ -154,7 +154,7 @@ struct task_struct init_task
>  	.vtime.state	= VTIME_SYS,
>  #endif
>  #ifdef CONFIG_NUMA_BALANCING
> -	.numa_preferred_nid = -1,
> +	.numa_preferred_nid = NUMA_NO_NODE,
>  	.numa_group	= NULL,
>  	.numa_faults	= NULL,
>  #endif
> diff --git a/kernel/kthread.c b/kernel/kthread.c
> index 087d18d..77f3d94 100644
> --- a/kernel/kthread.c
> +++ b/kernel/kthread.c
> @@ -675,7 +675,7 @@ __kthread_create_worker(int cpu, unsigned int flags,
>  {
>  	struct kthread_worker *worker;
>  	struct task_struct *task;
> -	int node = -1;
> +	int node = NUMA_NO_NODE;
>  
>  	worker = kzalloc(sizeof(*worker), GFP_KERNEL);
>  	if (!worker)
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index ee271bb..d830fa7 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -1161,7 +1161,7 @@ void init_numa_balancing(unsigned long clone_flags, struct task_struct *p)
>  
>  	/* New address space, reset the preferred nid */
>  	if (!(clone_flags & CLONE_VM)) {
> -		p->numa_preferred_nid = -1;
> +		p->numa_preferred_nid = NUMA_NO_NODE;
>  		return;
>  	}
>  
> @@ -1181,13 +1181,13 @@ void init_numa_balancing(unsigned long clone_flags, struct task_struct *p)
>  
>  static void account_numa_enqueue(struct rq *rq, struct task_struct *p)
>  {
> -	rq->nr_numa_running += (p->numa_preferred_nid != -1);
> +	rq->nr_numa_running += (p->numa_preferred_nid != NUMA_NO_NODE);
>  	rq->nr_preferred_running += (p->numa_preferred_nid == task_node(p));
>  }
>  
>  static void account_numa_dequeue(struct rq *rq, struct task_struct *p)
>  {
> -	rq->nr_numa_running -= (p->numa_preferred_nid != -1);
> +	rq->nr_numa_running -= (p->numa_preferred_nid != NUMA_NO_NODE);
>  	rq->nr_preferred_running -= (p->numa_preferred_nid == task_node(p));
>  }
>  
> @@ -1401,7 +1401,7 @@ bool should_numa_migrate_memory(struct task_struct *p, struct page * page,
>  	 * two full passes of the "multi-stage node selection" test that is
>  	 * executed below.
>  	 */
> -	if ((p->numa_preferred_nid == -1 || p->numa_scan_seq <= 4) &&
> +	if ((p->numa_preferred_nid == NUMA_NO_NODE || p->numa_scan_seq <= 4) &&
>  	    (cpupid_pid_unset(last_cpupid) || cpupid_match_pid(p, last_cpupid)))
>  		return true;
>  
> @@ -1849,7 +1849,7 @@ static void numa_migrate_preferred(struct task_struct *p)
>  	unsigned long interval = HZ;
>  
>  	/* This task has no NUMA fault statistics yet */
> -	if (unlikely(p->numa_preferred_nid == -1 || !p->numa_faults))
> +	if (unlikely(p->numa_preferred_nid == NUMA_NO_NODE || !p->numa_faults))
>  		return;
>  
>  	/* Periodically retry migrating the task to the preferred node */
> @@ -2096,7 +2096,7 @@ static int preferred_group_nid(struct task_struct *p, int nid)
>  
>  static void task_numa_placement(struct task_struct *p)
>  {
> -	int seq, nid, max_nid = -1;
> +	int seq, nid, max_nid = NUMA_NO_NODE;
>  	unsigned long max_faults = 0;
>  	unsigned long fault_types[2] = { 0, 0 };
>  	unsigned long total_faults;
> @@ -2639,7 +2639,8 @@ static void update_scan_period(struct task_struct *p, int new_cpu)
>  		 * the preferred node.
>  		 */
>  		if (dst_nid == p->numa_preferred_nid ||
> -		    (p->numa_preferred_nid != -1 && src_nid != p->numa_preferred_nid))
> +		    (p->numa_preferred_nid != NUMA_NO_NODE &&
> +			src_nid != p->numa_preferred_nid))
>  			return;
>  	}
>  
> diff --git a/lib/cpumask.c b/lib/cpumask.c
> index 8d666ab..a089c3f 100644
> --- a/lib/cpumask.c
> +++ b/lib/cpumask.c
> @@ -206,7 +206,7 @@ unsigned int cpumask_local_spread(unsigned int i, int node)
>  	/* Wrap: we always want a cpu. */
>  	i %= num_online_cpus();
>  
> -	if (node == -1) {
> +	if (node == NUMA_NO_NODE) {
>  		for_each_cpu(cpu, cpu_online_mask)
>  			if (i-- == 0)
>  				return cpu;
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 55478ab..5ccf89e 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -1480,7 +1480,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
>  	struct anon_vma *anon_vma = NULL;
>  	struct page *page;
>  	unsigned long haddr = vmf->address & HPAGE_PMD_MASK;
> -	int page_nid = -1, this_nid = numa_node_id();
> +	int page_nid = NUMA_NO_NODE, this_nid = numa_node_id();
>  	int target_nid, last_cpupid = -1;
>  	bool page_locked;
>  	bool migrated = false;
> @@ -1526,7 +1526,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
>  	 */
>  	page_locked = trylock_page(page);
>  	target_nid = mpol_misplaced(page, vma, haddr);
> -	if (target_nid == -1) {
> +	if (target_nid == NUMA_NO_NODE) {
>  		/* If the page was locked, there are no parallel migrations */
>  		if (page_locked)
>  			goto clear_pmdnuma;
> @@ -1534,7 +1534,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
>  
>  	/* Migration could have started since the pmd_trans_migrating check */
>  	if (!page_locked) {
> -		page_nid = -1;
> +		page_nid = NUMA_NO_NODE;
>  		if (!get_page_unless_zero(page))
>  			goto out_unlock;
>  		spin_unlock(vmf->ptl);
> @@ -1556,14 +1556,14 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
>  	if (unlikely(!pmd_same(pmd, *vmf->pmd))) {
>  		unlock_page(page);
>  		put_page(page);
> -		page_nid = -1;
> +		page_nid = NUMA_NO_NODE;
>  		goto out_unlock;
>  	}
>  
>  	/* Bail if we fail to protect against THP splits for any reason */
>  	if (unlikely(!anon_vma)) {
>  		put_page(page);
> -		page_nid = -1;
> +		page_nid = NUMA_NO_NODE;
>  		goto clear_pmdnuma;
>  	}
>  
> @@ -1625,7 +1625,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
>  	if (anon_vma)
>  		page_unlock_anon_vma_read(anon_vma);
>  
> -	if (page_nid != -1)
> +	if (page_nid != NUMA_NO_NODE)
>  		task_numa_fault(last_cpupid, page_nid, HPAGE_PMD_NR,
>  				flags);
>  
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index c007fb5..b769db7 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -887,7 +887,7 @@ static struct page *dequeue_huge_page_nodemask(struct hstate *h, gfp_t gfp_mask,
>  	struct zonelist *zonelist;
>  	struct zone *zone;
>  	struct zoneref *z;
> -	int node = -1;
> +	int node = NUMA_NO_NODE;
>  
>  	zonelist = node_zonelist(nid, gfp_mask);
>  
> diff --git a/mm/ksm.c b/mm/ksm.c
> index 5b0894b..d5f8834 100644
> --- a/mm/ksm.c
> +++ b/mm/ksm.c
> @@ -597,7 +597,7 @@ static struct stable_node *alloc_stable_node_chain(struct stable_node *dup,
>  		chain->chain_prune_time = jiffies;
>  		chain->rmap_hlist_len = STABLE_NODE_CHAIN;
>  #if defined (CONFIG_DEBUG_VM) && defined(CONFIG_NUMA)
> -		chain->nid = -1; /* debug */
> +		chain->nid = NUMA_NO_NODE; /* debug */
>  #endif
>  		ksm_stable_node_chains++;
>  
> diff --git a/mm/memory.c b/mm/memory.c
> index 4ad2d29..c0e0348 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -3564,7 +3564,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
>  {
>  	struct vm_area_struct *vma = vmf->vma;
>  	struct page *page = NULL;
> -	int page_nid = -1;
> +	int page_nid = NUMA_NO_NODE;
>  	int last_cpupid;
>  	int target_nid;
>  	bool migrated = false;
> @@ -3631,7 +3631,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
>  	target_nid = numa_migrate_prep(page, vma, vmf->address, page_nid,
>  			&flags);
>  	pte_unmap_unlock(vmf->pte, vmf->ptl);
> -	if (target_nid == -1) {
> +	if (target_nid == NUMA_NO_NODE) {
>  		put_page(page);
>  		goto out;
>  	}
> @@ -3645,7 +3645,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
>  		flags |= TNF_MIGRATE_FAIL;
>  
>  out:
> -	if (page_nid != -1)
> +	if (page_nid != NUMA_NO_NODE)
>  		task_numa_fault(last_cpupid, page_nid, 1, flags);
>  	return 0;
>  }
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 2b2b3cc..70e02f8 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -688,9 +688,9 @@ static void node_states_check_changes_online(unsigned long nr_pages,
>  {
>  	int nid = zone_to_nid(zone);
>  
> -	arg->status_change_nid = -1;
> -	arg->status_change_nid_normal = -1;
> -	arg->status_change_nid_high = -1;
> +	arg->status_change_nid = NUMA_NO_NODE;
> +	arg->status_change_nid_normal = NUMA_NO_NODE;
> +	arg->status_change_nid_high = NUMA_NO_NODE;
>  
>  	if (!node_state(nid, N_MEMORY))
>  		arg->status_change_nid = nid;
> @@ -1484,9 +1484,9 @@ static void node_states_check_changes_offline(unsigned long nr_pages,
>  	unsigned long present_pages = 0;
>  	enum zone_type zt;
>  
> -	arg->status_change_nid = -1;
> -	arg->status_change_nid_normal = -1;
> -	arg->status_change_nid_high = -1;
> +	arg->status_change_nid = NUMA_NO_NODE;
> +	arg->status_change_nid_normal = NUMA_NO_NODE;
> +	arg->status_change_nid_high = NUMA_NO_NODE;
>  
>  	/*
>  	 * Check whether node_states[N_NORMAL_MEMORY] will be changed.
> diff --git a/mm/mempolicy.c b/mm/mempolicy.c
> index 5837a06..e4f8248 100644
> --- a/mm/mempolicy.c
> +++ b/mm/mempolicy.c
> @@ -2278,7 +2278,7 @@ int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned long
>  	unsigned long pgoff;
>  	int thiscpu = raw_smp_processor_id();
>  	int thisnid = cpu_to_node(thiscpu);
> -	int polnid = -1;
> +	int polnid = NUMA_NO_NODE;
>  	int ret = -1;
>  
>  	pol = get_vma_policy(vma, addr);
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index a919ba5..9d38d9c 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -5846,7 +5846,7 @@ int __meminit __early_pfn_to_nid(unsigned long pfn,
>  		return state->last_nid;
>  
>  	nid = memblock_search_pfn_nid(pfn, &start_pfn, &end_pfn);
> -	if (nid != -1) {
> +	if (nid != NUMA_NO_NODE) {
>  		state->last_start = start_pfn;
>  		state->last_end = end_pfn;
>  		state->last_nid = nid;
> @@ -6607,7 +6607,7 @@ unsigned long __init node_map_pfn_alignment(void)
>  {
>  	unsigned long accl_mask = 0, last_end = 0;
>  	unsigned long start, end, mask;
> -	int last_nid = -1;
> +	int last_nid = NUMA_NO_NODE;
>  	int i, nid;
>  
>  	for_each_mem_pfn_range(i, MAX_NUMNODES, &start, &end, &nid) {
> diff --git a/mm/page_ext.c b/mm/page_ext.c
> index ae44f7a..dfb0206 100644
> --- a/mm/page_ext.c
> +++ b/mm/page_ext.c
> @@ -300,7 +300,7 @@ static int __meminit online_page_ext(unsigned long start_pfn,
>  	start = SECTION_ALIGN_DOWN(start_pfn);
>  	end = SECTION_ALIGN_UP(start_pfn + nr_pages);
>  
> -	if (nid == -1) {
> +	if (nid == NUMA_NO_NODE) {
>  		/*
>  		 * In this case, "nid" already exists and contains valid memory.
>  		 * "start_pfn" passed to us is a pfn which is an arg for
> diff --git a/net/core/pktgen.c b/net/core/pktgen.c
> index 6ac9198..af3a746 100644
> --- a/net/core/pktgen.c
> +++ b/net/core/pktgen.c
> @@ -3625,7 +3625,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)
>  	pkt_dev->svlan_cfi = 0;
>  	pkt_dev->svlan_id = 0xffff;
>  	pkt_dev->burst = 1;
> -	pkt_dev->node = -1;
> +	pkt_dev->node = NUMA_NO_NODE;
>  
>  	err = pktgen_setup_dev(t->net, pkt_dev, ifname);
>  	if (err)
> diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
> index 86e1e37..0c56ae2 100644
> --- a/net/qrtr/qrtr.c
> +++ b/net/qrtr/qrtr.c
> @@ -101,7 +101,7 @@ static inline struct qrtr_sock *qrtr_sk(struct sock *sk)
>  	return container_of(sk, struct qrtr_sock, sk);
>  }
>  
> -static unsigned int qrtr_local_nid = -1;
> +static unsigned int qrtr_local_nid = NUMA_NO_NODE;
>  
>  /* for node ids */
>  static RADIX_TREE(qrtr_nodes, GFP_KERNEL);
> diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c
> index 4419551..e0ad5f1 100644
> --- a/tools/perf/bench/numa.c
> +++ b/tools/perf/bench/numa.c
> @@ -298,7 +298,7 @@ static cpu_set_t bind_to_node(int target_node)
>  
>  	CPU_ZERO(&mask);
>  
> -	if (target_node == -1) {
> +	if (target_node == NUMA_NO_NODE) {
>  		for (cpu = 0; cpu < g->p.nr_cpus; cpu++)
>  			CPU_SET(cpu, &mask);
>  	} else {
> @@ -339,7 +339,7 @@ static void bind_to_memnode(int node)
>  	unsigned long nodemask;
>  	int ret;
>  
> -	if (node == -1)
> +	if (node == NUMA_NO_NODE)
>  		return;
>  
>  	BUG_ON(g->p.nr_nodes > (int)sizeof(nodemask)*8);
> @@ -1363,7 +1363,7 @@ static void init_thread_data(void)
>  		int cpu;
>  
>  		/* Allow all nodes by default: */
> -		td->bind_node = -1;
> +		td->bind_node = NUMA_NO_NODE;
>  
>  		/* Allow all CPUs by default: */
>  		CPU_ZERO(&td->bind_cpumask);
> 

^ permalink raw reply

* Re: [PATCH net-next 0/5] net: phy: convert advertise and supported to linkmode
From: David Miller @ 2018-11-11 18:10 UTC (permalink / raw)
  To: andrew; +Cc: netdev, florain
In-Reply-To: <1541889817-2295-1-git-send-email-andrew@lunn.ch>

From: Andrew Lunn <andrew@lunn.ch>
Date: Sat, 10 Nov 2018 23:43:32 +0100

> This is the last part in converting phylib to make use of a linux
> bitmap, not a u32, to represent links modes. This will allow support
> for PHYs > 1Gbps, which need to use link modes represented by a bit >
> 32.
> 
> A number of MAC and PHY drivers need changes to support this. However
> the previous two patchesets reduced the number somewhat, the helpers
> which were introduced have been modified instead of the actual
> drivers.
> 
> The follow on patches then make use of the extra bits, adding support
> for more link modes.

Series applied.

> Given how invasive this change is, i expect the build is broken for
> some architectures i did not test. I will fixup the breakage as fast
> as i can.

I will hold you to this :-)

^ permalink raw reply

* Re: [PATCH net-next 0/4] net: dsa: mv88e6xxx: Support more SERDES interfacxes
From: David Miller @ 2018-11-11 18:18 UTC (permalink / raw)
  To: andrew; +Cc: netdev, f.fainelli
In-Reply-To: <1541892737-3960-1-git-send-email-andrew@lunn.ch>

From: Andrew Lunn <andrew@lunn.ch>
Date: Sun, 11 Nov 2018 00:32:13 +0100

> Currently the SERDES interfaces for ports 9 and 10 on the mv88e6390x
> are supported, allowing upto 10G. However, when unused, these SERDES
> interfaces can be used by some of the lower ports for 1000Base-X.
> 
> The tricky bit here is ordering. The SERDES have to become free from
> ports 9 or 10 before they can be used with lower ports. Normally, this
> would happen only when these ports would be configured up, which is
> too late. So at probe time, defaulting ports 9 and 10 to 1000BaseX
> frees them for use with lower ports. If they are actually needed, they
> will be taken back when port 9 and 10 goes up.

Series applied, thanks Andrew.

^ permalink raw reply

* Re: [patch net] net: dsa: mv88e6xxx: Fix clearing of stats counters
From: David Miller @ 2018-11-11 18:19 UTC (permalink / raw)
  To: andrew; +Cc: netdev
In-Reply-To: <1541893270-4442-1-git-send-email-andrew@lunn.ch>

From: Andrew Lunn <andrew@lunn.ch>
Date: Sun, 11 Nov 2018 00:41:10 +0100

> The mv88e6161 would sometime fail to probe with a timeout waiting for
> the switch to complete an operation. This operation is supposed to
> clear the statistics counters. However, due to a read/modify/write,
> without the needed mask, the operation actually carried out was more
> random, with invalid parameters, resulting in the switch not
> responding. We need to preserve the histogram mode bits, so apply a
> mask to keep them.
> 
> Reported-by: Chris Healy <Chris.Healy@zii.aero>
> Fixes: 40cff8fca9e3 ("net: dsa: mv88e6xxx: Fix stats histogram mode")
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>

Oops.

Applied and queued up for -stable.

^ permalink raw reply

* Re: [PATCH net-next] net: dsa: mv88e6xxx: Work around mv886e6161 SERDES missing MII_PHYSID2
From: David Miller @ 2018-11-11 18:20 UTC (permalink / raw)
  To: andrew; +Cc: netdev
In-Reply-To: <1541893839-4828-1-git-send-email-andrew@lunn.ch>

From: Andrew Lunn <andrew@lunn.ch>
Date: Sun, 11 Nov 2018 00:50:39 +0100

> We already have a workaround for a couple of switches whose internal
> PHYs only have the Marvel OUI, but no model number. We detect such
> PHYs and give them the 6390 ID as the model number. However the
> mv88e6161 has two SERDES interfaces in the same address range as its
> internal PHYs. These suffer from the same problem, the Marvell OUI,
> but no model number. As a result, these SERDES interfaces were getting
> the same PHY ID as the mv88e6390, even though they are not PHYs, and
> the Marvell PHY driver was trying to drive them.
> 
> Add a special case to stop this happen.
> 
> Reported-by: Chris Healy <Chris.Healy@zii.aero>
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>

Please address Sergei's feedback, thank you.

^ permalink raw reply

* Re: [RFC] mm: Replace all open encodings for NUMA_NO_NODE
From: Anshuman Khandual @ 2018-11-12  4:10 UTC (permalink / raw)
  To: Joseph Qi, linux-mm, linux-kernel
  Cc: ocfs2-devel, linux-fbdev, dri-devel, netdev, intel-wired-lan,
	linux-media, iommu, linux-rdma, dmaengine, linux-block,
	sparclinux, linuxppc-dev, linux-ia64, linux-alpha
In-Reply-To: <1e9393c5-ff43-8ec7-dd6c-a662f09ef7c1@gmail.com>



On 11/12/2018 09:27 AM, Joseph Qi wrote:
> For ocfs2 part, node means host in the cluster, not NUMA node.
> 

Does not -1 indicate an invalid node which can never be present ?

^ permalink raw reply

* Re: [PATCH net] act_mirred: clear skb->tstamp on redirect
From: David Miller @ 2018-11-11 18:21 UTC (permalink / raw)
  To: edumazet; +Cc: netdev, eric.dumazet
In-Reply-To: <20181111002229.157219-1-edumazet@google.com>

From: Eric Dumazet <edumazet@google.com>
Date: Sat, 10 Nov 2018 16:22:29 -0800

> If sch_fq is used at ingress, skbs that might have been
> timestamped by net_timestamp_set() if a packet capture
> is requesting timestamps could be delayed by arbitrary
> amount of time, since sch_fq time base is MONOTONIC.
> 
> Fix this problem by moving code from sch_netem.c to act_mirred.c.
> 
> Fixes: fb420d5d91c1 ("tcp/fq: move back to CLOCK_MONOTONIC")
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied.

^ permalink raw reply

* Re: [PATCH net-next v2] PCI: add USR vendor id and use it in r8169 and w6692 driver
From: David Miller @ 2018-11-11 18:23 UTC (permalink / raw)
  To: hkallweit1; +Cc: bhelgaas, isdn, netdev, linux-pci
In-Reply-To: <f35fbe1d-b1f3-c0f8-82d6-18b0c7cda0b4@gmail.com>

From: Heiner Kallweit <hkallweit1@gmail.com>
Date: Sun, 11 Nov 2018 11:50:08 +0100

> diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
> index 69f0abe1b..1fac231fe 100644
> --- a/include/linux/pci_ids.h
> +++ b/include/linux/pci_ids.h
> @@ -2359,6 +2359,10 @@
>  
>  #define PCI_VENDOR_ID_SYNOPSYS		0x16c3
>  
> +#define PCI_VENDOR_ID_USR		0x16ec
> +#define PCI_DEVICE_ID_USR_997902	0x0116
> +#define PCI_DEVICE_ID_USR_6692		0x3409
> +
>  #define PCI_VENDOR_ID_VITESSE		0x1725
>  #define PCI_DEVICE_ID_VITESSE_VSC7174	0x7174

Generally, as I understand the policy for linux/pci_ids.h, we only add
things used in multiple locations.

So PCI_VENDOR_ID_USR is OK, since it is used in both r8169 and w6692.

But the device IDs are not, since only w6692 uses them.

^ permalink raw reply

* Re: [PATCH net 4/4] qed: Fix reading wrong value in loop condition
From: David Miller @ 2018-11-11 18:26 UTC (permalink / raw)
  To: denis.bolotin; +Cc: netdev, michal.kalderon, ariel.elior
In-Reply-To: <20181111150500.4345-5-denis.bolotin@cavium.com>

From: Denis Bolotin <denis.bolotin@cavium.com>
Date: Sun, 11 Nov 2018 17:05:00 +0200

> diff --git a/drivers/net/ethernet/qlogic/qed/qed_int.c b/drivers/net/ethernet/qlogic/qed/qed_int.c
> index 0f0aba7..aa7504a 100644
> --- a/drivers/net/ethernet/qlogic/qed/qed_int.c
> +++ b/drivers/net/ethernet/qlogic/qed/qed_int.c
> @@ -992,6 +992,8 @@ static int qed_int_attentions(struct qed_hwfn *p_hwfn)
>  	 */
>  	do {
>  		index = p_sb_attn->sb_index;
> +		/* finish reading index before the loop condition */
> +		rmb();

Please use dma_rmb().

^ permalink raw reply

* Re: [PATCH net-next] net_sched: sch_fq: add dctcp-like marking
From: Neal Cardwell @ 2018-11-11 18:50 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, Netdev, Eric Dumazet
In-Reply-To: <20181111171131.24115-1-edumazet@google.com>

On Sun, Nov 11, 2018 at 12:11 PM Eric Dumazet <edumazet@google.com> wrote:
>
> Similar to 80ba92fa1a92 ("codel: add ce_threshold attribute")
>
> After EDT adoption, it became easier to implement DCTCP-like CE marking.
>
> In many cases, queues are not building in the network fabric but on
> the hosts themselves.
>
> If packets leaving fq missed their Earliest Departure Time by XXX usec,
> we mark them with ECN CE. This gives a feedback (after one RTT) to
> the sender to slow down and find better operating mode.
>
> Example :
>
> tc qd replace dev eth0 root fq ce_threshold 2.5ms
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---

Very nice! Thanks, Eric. :-)

Acked-by: Neal Cardwell <ncardwell@google.com>

neal

^ permalink raw reply

* Re: [PATCH net-next 1/3] tcp: do not try to defer skbs with eor mark (MSG_EOR)
From: Neal Cardwell @ 2018-11-11 18:58 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, Netdev, Soheil Hassas Yeganeh, Eric Dumazet
In-Reply-To: <20181111144131.156754-2-edumazet@google.com>

On Sun, Nov 11, 2018 at 9:41 AM Eric Dumazet <edumazet@google.com> wrote:
>
> Applications using MSG_EOR are giving a strong hint to TCP stack :
>
> Subsequent sendmsg() can not append more bytes to skbs having
> the EOR mark.
>
> Do not try to TSO defer suchs skbs, there is really no hope.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
> ---
>  net/ipv4/tcp_output.c | 4 ++++
>  1 file changed, 4 insertions(+)

Thanks!

Acked-by: Neal Cardwell <ncardwell@google.com>

neal

^ permalink raw reply

* Re: [PATCH net-next 2/3] tcp: refine tcp_tso_should_defer() after EDT adoption
From: Neal Cardwell @ 2018-11-11 19:02 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, Netdev, Soheil Hassas Yeganeh, Eric Dumazet
In-Reply-To: <20181111144131.156754-3-edumazet@google.com>

On Sun, Nov 11, 2018 at 9:41 AM Eric Dumazet <edumazet@google.com> wrote:
>
> tcp_tso_should_defer() last step tries to check if the probable
> next ACK packet is coming in less than half rtt.
>
> Problem is that the head->tstamp might be in the future,
> so we need to use signed arithmetics to avoid overflows.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
> ---
>  net/ipv4/tcp_output.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

Thanks!

Acked-by: Neal Cardwell <ncardwell@google.com>

neal

^ permalink raw reply

* Re: [PATCH net-next 3/3] tcp: get rid of tcp_tso_should_defer() dependency on HZ/jiffies
From: Neal Cardwell @ 2018-11-11 19:06 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, Netdev, Soheil Hassas Yeganeh, Eric Dumazet
In-Reply-To: <20181111144131.156754-4-edumazet@google.com>

On Sun, Nov 11, 2018 at 9:41 AM Eric Dumazet <edumazet@google.com> wrote:
>
> tcp_tso_should_defer() first heuristic is to not defer
> if last send is "old enough".
>
> Its current implementation uses jiffies and its low granularity.
>
> TSO autodefer performance should not rely on kernel HZ :/
>
> After EDT conversion, we have state variables in nanoseconds that
> can allow us to properly implement the heuristic.
>
> This patch increases TSO chunk sizes on medium rate flows,
> especially when receivers do not use GRO or similar aggregation.
>
> It also reduces bursts for HZ=100 or HZ=250 kernels, making TCP
> behavior more uniform.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
> ---

Nice. Thanks!

Acked-by: Neal Cardwell <ncardwell@google.com>

neal

^ permalink raw reply

* [PATCH net-next v3] PCI: add USR vendor id and use it in r8169 and w6692 driver
From: Heiner Kallweit @ 2018-11-11 19:31 UTC (permalink / raw)
  To: Bjorn Helgaas, David Miller, Karsten Keil
  Cc: netdev@vger.kernel.org, linux-pci@vger.kernel.org
In-Reply-To: <9af6abf5-ba01-155f-17d1-ca4b71b74fa6@gmail.com>

The PCI vendor id of U.S. Robotics isn't defined in pci_ids.h so far,
only ISDN driver w6692 has a private definition. Move the definition
to pci_ids.h and use it in the r8169 driver too.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
v2:
- The original patch caused a build failure in w6692 driver because
  it broke the private PCI device id definition.
v3:
- Don't move device id's to pci_ids.h because they are used in
  one module only respectively.
---
 drivers/isdn/hardware/mISDN/w6692.c  | 3 ---
 drivers/net/ethernet/realtek/r8169.c | 2 +-
 include/linux/pci_ids.h              | 2 ++
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/isdn/hardware/mISDN/w6692.c b/drivers/isdn/hardware/mISDN/w6692.c
index 5acf6ab67..6f60aced1 100644
--- a/drivers/isdn/hardware/mISDN/w6692.c
+++ b/drivers/isdn/hardware/mISDN/w6692.c
@@ -52,10 +52,7 @@ static const struct w6692map  w6692_map[] =
 	{W6692_USR, "USR W6692"}
 };
 
-#ifndef PCI_VENDOR_ID_USR
-#define PCI_VENDOR_ID_USR	0x16ec
 #define PCI_DEVICE_ID_USR_6692	0x3409
-#endif
 
 struct w6692_ch {
 	struct bchannel		bch;
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 1fd01688d..366a690eb 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -224,7 +224,7 @@ static const struct pci_device_id rtl8169_pci_tbl[] = {
 	{ PCI_DEVICE(PCI_VENDOR_ID_DLINK,	0x4300), 0, 0, RTL_CFG_0 },
 	{ PCI_DEVICE(PCI_VENDOR_ID_DLINK,	0x4302), 0, 0, RTL_CFG_0 },
 	{ PCI_DEVICE(PCI_VENDOR_ID_AT,		0xc107), 0, 0, RTL_CFG_0 },
-	{ PCI_DEVICE(0x16ec,			0x0116), 0, 0, RTL_CFG_0 },
+	{ PCI_DEVICE(PCI_VENDOR_ID_USR,		0x0116), 0, 0, RTL_CFG_0 },
 	{ PCI_VENDOR_ID_LINKSYS,		0x1032,
 		PCI_ANY_ID, 0x0024, 0, 0, RTL_CFG_0 },
 	{ 0x0001,				0x8168,
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 69f0abe1b..144de2e89 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2359,6 +2359,8 @@
 
 #define PCI_VENDOR_ID_SYNOPSYS		0x16c3
 
+#define PCI_VENDOR_ID_USR		0x16ec
+
 #define PCI_VENDOR_ID_VITESSE		0x1725
 #define PCI_DEVICE_ID_VITESSE_VSC7174	0x7174
 
-- 
2.19.1

^ permalink raw reply related

* [PATCH tip/core/rcu 33/41] net/bridge: Replace call_rcu_bh() and rcu_barrier_bh()
From: Paul E. McKenney @ 2018-11-11 19:44 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, jiangshanlai, dipankar, akpm, mathieu.desnoyers, josh,
	tglx, peterz, rostedt, dhowells, edumazet, fweisbec, oleg, joel,
	Paul E. McKenney, Roopa Prabhu, Nikolay Aleksandrov,
	David S. Miller, bridge, netdev
In-Reply-To: <20181111194104.GA4787@linux.ibm.com>

Now that call_rcu()'s callback is not invoked until after all bh-disable
regions of code have completed (in addition to explicitly marked
RCU read-side critical sections), call_rcu() can be used in place
of call_rcu_bh().  Similarly, rcu_barrier() can be used in place of
rcu_barrier_bh().  This commit therefore makes these changes.

Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
Cc: Roopa Prabhu <roopa@cumulusnetworks.com>
Cc: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: <bridge@lists.linux-foundation.org>
Cc: <netdev@vger.kernel.org>
---
 net/bridge/br_mdb.c       |  2 +-
 net/bridge/br_multicast.c | 14 +++++++-------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c
index a7ea2d431714..596ec6e7df11 100644
--- a/net/bridge/br_mdb.c
+++ b/net/bridge/br_mdb.c
@@ -728,7 +728,7 @@ static int __br_mdb_del(struct net_bridge *br, struct br_mdb_entry *entry)
 		rcu_assign_pointer(*pp, p->next);
 		hlist_del_init(&p->mglist);
 		del_timer(&p->timer);
-		call_rcu_bh(&p->rcu, br_multicast_free_pg);
+		call_rcu(&p->rcu, br_multicast_free_pg);
 		err = 0;
 
 		if (!mp->ports && !mp->host_joined &&
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index 6bac0d6b7b94..0255223f2001 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -260,7 +260,7 @@ static void br_multicast_group_expired(struct timer_list *t)
 	hlist_del_rcu(&mp->hlist[mdb->ver]);
 	mdb->size--;
 
-	call_rcu_bh(&mp->rcu, br_multicast_free_group);
+	call_rcu(&mp->rcu, br_multicast_free_group);
 
 out:
 	spin_unlock(&br->multicast_lock);
@@ -291,7 +291,7 @@ static void br_multicast_del_pg(struct net_bridge *br,
 		del_timer(&p->timer);
 		br_mdb_notify(br->dev, p->port, &pg->addr, RTM_DELMDB,
 			      p->flags);
-		call_rcu_bh(&p->rcu, br_multicast_free_pg);
+		call_rcu(&p->rcu, br_multicast_free_pg);
 
 		if (!mp->ports && !mp->host_joined &&
 		    netif_running(br->dev))
@@ -358,7 +358,7 @@ static int br_mdb_rehash(struct net_bridge_mdb_htable __rcu **mdbp, int max,
 	}
 
 	br_mdb_rehash_seq++;
-	call_rcu_bh(&mdb->rcu, br_mdb_free);
+	call_rcu(&mdb->rcu, br_mdb_free);
 
 out:
 	rcu_assign_pointer(*mdbp, mdb);
@@ -1629,7 +1629,7 @@ br_multicast_leave_group(struct net_bridge *br,
 			rcu_assign_pointer(*pp, p->next);
 			hlist_del_init(&p->mglist);
 			del_timer(&p->timer);
-			call_rcu_bh(&p->rcu, br_multicast_free_pg);
+			call_rcu(&p->rcu, br_multicast_free_pg);
 			br_mdb_notify(br->dev, port, group, RTM_DELMDB,
 				      p->flags);
 
@@ -2051,19 +2051,19 @@ void br_multicast_dev_del(struct net_bridge *br)
 		hlist_for_each_entry_safe(mp, n, &mdb->mhash[i],
 					  hlist[ver]) {
 			del_timer(&mp->timer);
-			call_rcu_bh(&mp->rcu, br_multicast_free_group);
+			call_rcu(&mp->rcu, br_multicast_free_group);
 		}
 	}
 
 	if (mdb->old) {
 		spin_unlock_bh(&br->multicast_lock);
-		rcu_barrier_bh();
+		rcu_barrier();
 		spin_lock_bh(&br->multicast_lock);
 		WARN_ON(mdb->old);
 	}
 
 	mdb->old = mdb;
-	call_rcu_bh(&mdb->rcu, br_mdb_free);
+	call_rcu(&mdb->rcu, br_mdb_free);
 
 out:
 	spin_unlock_bh(&br->multicast_lock);
-- 
2.17.1

^ permalink raw reply related

* [PATCH tip/core/rcu 39/41] net/decnet: Replace rcu_barrier_bh() with rcu_barrier()
From: Paul E. McKenney @ 2018-11-11 19:44 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, jiangshanlai, dipankar, akpm, mathieu.desnoyers, josh,
	tglx, peterz, rostedt, dhowells, edumazet, fweisbec, oleg, joel,
	Paul E. McKenney, David S. Miller, linux-decnet-user, netdev
In-Reply-To: <20181111194104.GA4787@linux.ibm.com>

Now that all RCU flavors have been consolidated, rcu_barrier_bh()
is but a synonym for rcu_barrier().  This commit therefore replaces
the former with the latter.

Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: <linux-decnet-user@lists.sourceforge.net>
Cc: <netdev@vger.kernel.org>
---
 net/decnet/af_decnet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index 7d6ff983ba2c..dbd0f7bae00a 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -2405,7 +2405,7 @@ static void __exit decnet_exit(void)
 
 	proto_unregister(&dn_proto);
 
-	rcu_barrier_bh(); /* Wait for completion of call_rcu_bh()'s */
+	rcu_barrier(); /* Wait for completion of call_rcu()'s */
 }
 module_exit(decnet_exit);
 #endif
-- 
2.17.1

^ permalink raw reply related

* [PATCH tip/core/rcu 12/41] ethernet/realtek: Replace synchronize_sched() with synchronize_rcu()
From: Paul E. McKenney @ 2018-11-11 19:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, jiangshanlai, dipankar, akpm, mathieu.desnoyers, josh,
	tglx, peterz, rostedt, dhowells, edumazet, fweisbec, oleg, joel,
	Paul E. McKenney, Realtek linux nic maintainers, David S. Miller,
	netdev
In-Reply-To: <20181111194104.GA4787@linux.ibm.com>

Now that synchronize_rcu() waits for preempt-disable regions of code
as well as RCU read-side critical sections, synchronize_sched() can be
replaced by synchronize_rcu().  This commit therefore makes this change.

Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
Cc: Realtek linux nic maintainers <nic_swsd@realtek.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>
---
 drivers/net/ethernet/realtek/8139too.c | 2 +-
 drivers/net/ethernet/realtek/r8169.c   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/realtek/8139too.c b/drivers/net/ethernet/realtek/8139too.c
index ffd68a7bc9e1..69d752f0b621 100644
--- a/drivers/net/ethernet/realtek/8139too.c
+++ b/drivers/net/ethernet/realtek/8139too.c
@@ -1661,7 +1661,7 @@ static void rtl8139_tx_timeout_task (struct work_struct *work)
 
 	napi_disable(&tp->napi);
 	netif_stop_queue(dev);
-	synchronize_sched();
+	synchronize_rcu();
 
 	netdev_dbg(dev, "Transmit timeout, status %02x %04x %04x media %02x\n",
 		   RTL_R8(ChipCmd), RTL_R16(IntrStatus),
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 1fd01688d37b..4f1d89f0dc24 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -5866,7 +5866,7 @@ static void rtl_reset_work(struct rtl8169_private *tp)
 
 	napi_disable(&tp->napi);
 	netif_stop_queue(dev);
-	synchronize_sched();
+	synchronize_rcu();
 
 	rtl8169_hw_reset(tp);
 
@@ -6609,7 +6609,7 @@ static void rtl8169_down(struct net_device *dev)
 	rtl8169_rx_missed(dev);
 
 	/* Give a racing hard_start_xmit a few cycles to complete. */
-	synchronize_sched();
+	synchronize_rcu();
 
 	rtl8169_tx_clear(tp);
 
-- 
2.17.1

^ permalink raw reply related

* [PATCH tip/core/rcu 31/41] net/sched: Replace call_rcu_bh() and rcu_barrier_bh()
From: Paul E. McKenney @ 2018-11-11 19:44 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, jiangshanlai, dipankar, akpm, mathieu.desnoyers, josh,
	tglx, peterz, rostedt, dhowells, edumazet, fweisbec, oleg, joel,
	Paul E. McKenney, Jamal Hadi Salim, Cong Wang, Jiri Pirko,
	David S. Miller, netdev
In-Reply-To: <20181111194104.GA4787@linux.ibm.com>

Now that call_rcu()'s callback is not invoked until after bh-disable
regions of code have completed (in addition to explicitly marked
RCU read-side critical sections), call_rcu() can be used in place
of call_rcu_bh().  Similarly, rcu_barrier() can be used in place o
frcu_barrier_bh().  This commit therefore makes these changes.

Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: Cong Wang <xiyou.wangcong@gmail.com>
Cc: Jiri Pirko <jiri@resnulli.us>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>
---
 net/sched/sch_api.c     | 2 +-
 net/sched/sch_generic.c | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index ca3b0f46de53..016e628c6ac9 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -540,7 +540,7 @@ void qdisc_put_stab(struct qdisc_size_table *tab)
 
 	if (--tab->refcnt == 0) {
 		list_del(&tab->list);
-		call_rcu_bh(&tab->rcu, stab_kfree_rcu);
+		call_rcu(&tab->rcu, stab_kfree_rcu);
 	}
 }
 EXPORT_SYMBOL(qdisc_put_stab);
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index de1663f7d3ad..66ba2ce2320f 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -1372,7 +1372,7 @@ void mini_qdisc_pair_swap(struct mini_Qdisc_pair *miniqp,
 	if (!tp_head) {
 		RCU_INIT_POINTER(*miniqp->p_miniq, NULL);
 		/* Wait for flying RCU callback before it is freed. */
-		rcu_barrier_bh();
+		rcu_barrier();
 		return;
 	}
 
@@ -1380,10 +1380,10 @@ void mini_qdisc_pair_swap(struct mini_Qdisc_pair *miniqp,
 		&miniqp->miniq1 : &miniqp->miniq2;
 
 	/* We need to make sure that readers won't see the miniq
-	 * we are about to modify. So wait until previous call_rcu_bh callback
+	 * we are about to modify. So wait until previous call_rcu callback
 	 * is done.
 	 */
-	rcu_barrier_bh();
+	rcu_barrier();
 	miniq->filter_list = tp_head;
 	rcu_assign_pointer(*miniqp->p_miniq, miniq);
 
@@ -1392,7 +1392,7 @@ void mini_qdisc_pair_swap(struct mini_Qdisc_pair *miniqp,
 		 * block potential new user of miniq_old until all readers
 		 * are not seeing it.
 		 */
-		call_rcu_bh(&miniq_old->rcu, mini_qdisc_rcu_func);
+		call_rcu(&miniq_old->rcu, mini_qdisc_rcu_func);
 }
 EXPORT_SYMBOL(mini_qdisc_pair_swap);
 
-- 
2.17.1

^ permalink raw reply related

* [PATCH tip/core/rcu 38/41] net/core/skmsg: Replace call_rcu_sched() with call_rcu()
From: Paul E. McKenney @ 2018-11-11 19:44 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, jiangshanlai, dipankar, akpm, mathieu.desnoyers, josh,
	tglx, peterz, rostedt, dhowells, edumazet, fweisbec, oleg, joel,
	Paul E. McKenney, John Fastabend, Daniel Borkmann,
	David S. Miller, netdev
In-Reply-To: <20181111194104.GA4787@linux.ibm.com>

Now that call_rcu()'s callback is not invoked until after all
preempt-disable regions of code have completed (in addition to explicitly
marked RCU read-side critical sections), call_rcu() can be used in place
of call_rcu_sched().  This commit therefore makes that change.

Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>
---
 net/core/skmsg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/skmsg.c b/net/core/skmsg.c
index 56a99d0c9aa0..c92d6ccce610 100644
--- a/net/core/skmsg.c
+++ b/net/core/skmsg.c
@@ -580,7 +580,7 @@ void sk_psock_drop(struct sock *sk, struct sk_psock *psock)
 	write_unlock_bh(&sk->sk_callback_lock);
 	sk_psock_clear_state(psock, SK_PSOCK_TX_ENABLED);
 
-	call_rcu_sched(&psock->rcu, sk_psock_destroy);
+	call_rcu(&psock->rcu, sk_psock_destroy);
 }
 EXPORT_SYMBOL_GPL(sk_psock_drop);
 
-- 
2.17.1

^ permalink raw reply related

* general protection fault in rds_recv_rcvbuf_delta
From: syzbot @ 2018-11-12  5:51 UTC (permalink / raw)
  To: davem, linux-kernel, linux-rdma, netdev, rds-devel,
	santosh.shilimkar, syzkaller-bugs

Hello,

syzbot found the following crash on:

HEAD commit:    e255aee5b66c Merge tag 'tty-4.20-rc2' of git://git.kernel...
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=124d66a3400000
kernel config:  https://syzkaller.appspot.com/x/.config?x=8f215f21f041a0d7
dashboard link: https://syzkaller.appspot.com/bug?extid=4b4f8163c2e246df3c4c
compiler:       gcc (GCC) 8.0.1 20180413 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+4b4f8163c2e246df3c4c@syzkaller.appspotmail.com

vhci_hcd: default hub control req: 0000 v0000 i0001 l50287
kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] PREEMPT SMP KASAN
CPU: 0 PID: 18919 Comm: syz-executor3 Not tainted 4.20.0-rc1+ #109
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
RIP: 0010:rds_recv_rcvbuf_delta.part.3+0x14a/0x3f0 net/rds/recv.c:103
Code: c1 ea 03 80 3c 02 00 0f 85 6e 02 00 00 4c 8b a3 c0 04 00 00 48 b8 00  
00 00 00 00 fc ff df 49 8d 7c 24 2c 48 89 fa 48 c1 ea 03 <0f> b6 14 02 48  
89 f8 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85 00
RSP: 0018:ffff88018b39efc0 EFLAGS: 00010007
RAX: dffffc0000000000 RBX: ffff8801be730780 RCX: ffffc9001061b000
RDX: 0000000000000005 RSI: ffffffff8749949b RDI: 000000000000002c
RBP: ffff88018b39eff8 R08: ffff8801ce388300 R09: ffffed0031673ded
R10: ffffed0031673ded R11: 0000000000000003 R12: 0000000000000000
R13: ffff8801be730ca4 R14: 000000000002e0c0 R15: ffff8801cbe88b00
FS:  00007fa7bf29b700(0000) GS:ffff8801dae00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b33a27000 CR3: 00000001bf445000 CR4: 00000000001406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
  rds_recv_rcvbuf_delta net/rds/recv.c:379 [inline]
  rds_recv_incoming+0x8bb/0x1400 net/rds/recv.c:379
  rds_loop_xmit+0xf3/0x2a0 net/rds/loop.c:96
  rds_send_xmit+0x13ef/0x2bb0 net/rds/send.c:355
  rds_sendmsg+0x290f/0x3180 net/rds/send.c:1338
  sock_sendmsg_nosec net/socket.c:621 [inline]
  sock_sendmsg+0xd5/0x120 net/socket.c:631
  __sys_sendto+0x3d7/0x670 net/socket.c:1788
  __do_sys_sendto net/socket.c:1800 [inline]
  __se_sys_sendto net/socket.c:1796 [inline]
  __x64_sys_sendto+0xe1/0x1a0 net/socket.c:1796
  do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
  entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x457569
Code: fd b3 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7  
48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff  
ff 0f 83 cb b3 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fa7bf29ac78 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 0000000000000006 RCX: 0000000000457569
RDX: 0000000000000241 RSI: 0000000020000a00 RDI: 0000000000000008
RBP: 000000000072bf00 R08: 000000002069affb R09: 0000000000000010
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fa7bf29b6d4
R13: 00000000004c3c11 R14: 00000000004d5e80 R15: 00000000ffffffff
Modules linked in:
---[ end trace ffda6d1117cbc209 ]---
RIP: 0010:rds_recv_rcvbuf_delta.part.3+0x14a/0x3f0 net/rds/recv.c:103
Code: c1 ea 03 80 3c 02 00 0f 85 6e 02 00 00 4c 8b a3 c0 04 00 00 48 b8 00  
00 00 00 00 fc ff df 49 8d 7c 24 2c 48 89 fa 48 c1 ea 03 <0f> b6 14 02 48  
89 f8 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85 00
RSP: 0018:ffff88018b39efc0 EFLAGS: 00010007
RAX: dffffc0000000000 RBX: ffff8801be730780 RCX: ffffc9001061b000
RDX: 0000000000000005 RSI: ffffffff8749949b RDI: 000000000000002c
RBP: ffff88018b39eff8 R08: ffff8801ce388300 R09: ffffed0031673ded
R10: ffffed0031673ded R11: 0000000000000003 R12: 0000000000000000
R13: ffff8801be730ca4 R14: 000000000002e0c0 R15: ffff8801cbe88b00
FS:  00007fa7bf29b700(0000) GS:ffff8801dae00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b33a27000 CR3: 00000001bf445000 CR4: 00000000001406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with  
syzbot.

^ permalink raw reply

* [PATCH tip/core/rcu 3/7] smsc: Replace spin_is_locked() with lockdep
From: Paul E. McKenney @ 2018-11-11 20:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, jiangshanlai, dipankar, akpm, mathieu.desnoyers, josh,
	tglx, peterz, rostedt, dhowells, edumazet, fweisbec, oleg, joel,
	Lance Roy, Steve Glendinning, David S. Miller, netdev,
	Paul E . McKenney
In-Reply-To: <20181111200421.GA10551@linux.ibm.com>

From: Lance Roy <ldr709@gmail.com>

lockdep_assert_held() is better suited to checking locking requirements,
since it only checks if the current thread holds the lock regardless of
whether someone else does. This is also a step towards possibly removing
spin_is_locked().

Signed-off-by: Lance Roy <ldr709@gmail.com>
Cc: Steve Glendinning <steve.glendinning@shawell.net>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
---
 drivers/net/ethernet/smsc/smsc911x.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/smsc/smsc911x.h b/drivers/net/ethernet/smsc/smsc911x.h
index 8d75508acd2b..51b2fc1a395f 100644
--- a/drivers/net/ethernet/smsc/smsc911x.h
+++ b/drivers/net/ethernet/smsc/smsc911x.h
@@ -67,7 +67,7 @@
 
 #ifdef CONFIG_DEBUG_SPINLOCK
 #define SMSC_ASSERT_MAC_LOCK(pdata) \
-		WARN_ON_SMP(!spin_is_locked(&pdata->mac_lock))
+		lockdep_assert_held(&pdata->mac_lock)
 #else
 #define SMSC_ASSERT_MAC_LOCK(pdata) do {} while (0)
 #endif				/* CONFIG_DEBUG_SPINLOCK */
-- 
2.17.1

^ permalink raw reply related

* [PATCH tip/core/rcu 2/7] sfc: Replace spin_is_locked() with lockdep
From: Paul E. McKenney @ 2018-11-11 20:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, jiangshanlai, dipankar, akpm, mathieu.desnoyers, josh,
	tglx, peterz, rostedt, dhowells, edumazet, fweisbec, oleg, joel,
	Lance Roy, Solarflare linux maintainers, Edward Cree,
	Bert Kenward, David S. Miller, netdev, Paul E . McKenney
In-Reply-To: <20181111200421.GA10551@linux.ibm.com>

From: Lance Roy <ldr709@gmail.com>

lockdep_assert_held() is better suited to checking locking requirements,
since it only checks if the current thread holds the lock regardless of
whether someone else does. This is also a step towards possibly removing
spin_is_locked().

Signed-off-by: Lance Roy <ldr709@gmail.com>
Cc: Solarflare linux maintainers <linux-net-drivers@solarflare.com>
Cc: Edward Cree <ecree@solarflare.com>
Cc: Bert Kenward <bkenward@solarflare.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
---
 drivers/net/ethernet/sfc/efx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c
index 98fe7e762e17..3643015a55cf 100644
--- a/drivers/net/ethernet/sfc/efx.c
+++ b/drivers/net/ethernet/sfc/efx.c
@@ -3167,7 +3167,7 @@ struct hlist_head *efx_rps_hash_bucket(struct efx_nic *efx,
 {
 	u32 hash = efx_filter_spec_hash(spec);
 
-	WARN_ON(!spin_is_locked(&efx->rps_hash_lock));
+	lockdep_assert_held(&efx->rps_hash_lock);
 	if (!efx->rps_hash_table)
 		return NULL;
 	return &efx->rps_hash_table[hash % EFX_ARFS_HASH_TABLE_SIZE];
-- 
2.17.1

^ permalink raw reply related

* Re: WARN_ON() in netconsole with PREEMPT_RT
From: Oleksandr Natalenko @ 2018-11-11 20:16 UTC (permalink / raw)
  To: David S. Miller
  Cc: Steven Rostedt, Sebastian Andrzej Siewior, Thomas Gleixner,
	Eric Dumazet, Dave Jones, netdev, linux-rt-users, linux-kernel
In-Reply-To: <f9111ab09dbc264c8ff8b3b79e9f4c06@natalenko.name>

On 11.11.2018 20:13, Oleksandr Natalenko wrote:
> Hi.
> 
> I was just curious about PREEMPT_RT and decided to give it a (small)
> shot on my laptop. As a safety measure, I've enabled netconsole to
> catch all the weird stuff that can pop up, and immediately it indeed
> did… in the netconsole code itself (irony):
> 
> ===
> [   64.018949] WARNING: CPU: 0 PID: 1204 at net/core/netpoll.c:372
> netpoll_send_udp+0x3e8/0x3ef
> …
> [   64.019057] CPU: 0 PID: 1204 Comm: bash Not tainted 4.19.0-ig1 #1
> [   64.019058] Hardware name: Dell Inc.          Vostro 3360/0F5DWF,
> BIOS A18 09/25/2013
> [   64.019063] RIP: 0010:netpoll_send_udp+0x3e8/0x3ef
>                                                                [
> 64.019066] Code: dd ff ff 41 ba 86 dd ff ff 49 2b 96 d0 00 00 00 66 41
> 89 96 c6 00 00 00 66 44 89 48 0c 66 45 89 96 c0 00 00 00 e9
>  93 fe ff ff <0f> 0b e9 40 fc ff ff 0f 1f 44 00 00 53 0f b7 57 42 48 89 
> fb 48 8b
> [   64.019068] RSP: 0018:ffffaa6743f87c98 EFLAGS: 00010202
> [   64.019070] RAX: 0000000000000292 RBX: 0000000000000014 RCX: 
> 0000000000000028
> [   64.019072] RDX: 0000000000000014 RSI: ffffffffb1e6a300 RDI: 
> ffff95973d905668
> [   64.019073] RBP: ffffaa6743f87cd8 R08: ffffffffc11f6ba0 R09: 
> 0000000000000000
> [   64.019075] R10: 0000000000000008 R11: 0000000000000000 R12: 
> 00000000000003e8
> [   64.019076] R13: ffff95973d905668 R14: 0000000000000014 R15: 
> ffff95973d905668
> [   64.019079] FS:  00007f2f8b809b80(0000) GS:ffff95976f000000(0000)
> knlGS:0000000000000000
> [   64.019081] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [   64.019083] CR2: 000055b8e126fbc8 CR3: 0000000415440006 CR4: 
> 00000000001606f0
> [   64.019084] Call Trace:
> [   64.019098]  write_msg+0xd1/0xe0 [netconsole]
> [   64.019107]  console_unlock.part.6+0x55b/0x5a0
> [   64.019115]  ? _raw_spin_unlock_irqrestore+0x20/0x60
> [   64.019120]  vprintk_emit+0x16a/0x1a0
> [   64.019125]  printk_emit+0x44/0x5b
> [   64.019130]  ? _raw_spin_trylock+0x13/0x80
> [   64.019134]  devkmsg_write.cold.16+0x21/0x4e
> [   64.019140]  __vfs_write+0x136/0x1a0
> [   64.019145]  vfs_write+0xa9/0x1a0
> [   64.019149]  ksys_write+0x52/0xc0
> [   64.019156]  do_syscall_64+0x5b/0x170
> [   64.019160]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
> …
> ===
> 
> This is a v4.19.1-rt3-based kernel.
> 
> The WARN_ON() is:
> 
> 362 void netpoll_send_udp(struct netpoll *np, const char *msg, int len)
> 363 {
> …
> 372     WARN_ON_ONCE(!irqs_disabled());
> …
> 
> If that matters, I have "threadirqs" passed to the kernel.
> 
> Netconsole seems to work even after this warning. Is this OK/expected?
> 
> Thanks.

Oh, I see that write_msg() calls netpoll_send_udp() under 
spin_lock_irqsave(), but in PREEMPT_RT this, AFAIK, does not disable 
interrupts.

So, the real question here is whether the interrupts should be indeed 
disabled. And if so, -rt should replace spin_lock_irqsave() call there 
with what? local_irq_save()? and get rid of the warning?

-- 
   Oleksandr Natalenko (post-factum)

^ permalink raw reply

* [PATCH net-next] net: phy: icplus: add config_intr callback
From: Heiner Kallweit @ 2018-11-11 20:49 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli, David Miller; +Cc: netdev@vger.kernel.org

Move IRQ configuration for IP101A/G from config_init to config_intr
callback. Reasons:

1. This allows phylib to disable interrupts if needed.
2. Icplus was the only driver supporting interrupts w/o defining a
   config_intr callback. Now we can add a phylib plausibility check
   disabling interrupt mode if one of the two irq-related callbacks
   isn't defined.

I don't own hardware with this PHY, and the change is based on the
datasheet for IP101A LF (which is supposed to be register-compatible
with IP101A/G). Change is compile-tested only.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/phy/icplus.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/drivers/net/phy/icplus.c b/drivers/net/phy/icplus.c
index 21ce68964..ad87bd328 100644
--- a/drivers/net/phy/icplus.c
+++ b/drivers/net/phy/icplus.c
@@ -42,8 +42,8 @@ MODULE_LICENSE("GPL");
 #define IP1001_APS_ON			11	/* IP1001 APS Mode  bit */
 #define IP101A_G_APS_ON			2	/* IP101A/G APS Mode bit */
 #define IP101A_G_IRQ_CONF_STATUS	0x11	/* Conf Info IRQ & Status Reg */
-#define	IP101A_G_IRQ_PIN_USED		(1<<15) /* INTR pin used */
-#define	IP101A_G_IRQ_DEFAULT		IP101A_G_IRQ_PIN_USED
+#define	IP101A_G_IRQ_PIN_USED		BIT(15) /* INTR pin used */
+#define	IP101A_G_NO_IRQ			BIT(11) /* IRQ's inactive */
 
 static int ip175c_config_init(struct phy_device *phydev)
 {
@@ -170,11 +170,6 @@ static int ip101a_g_config_init(struct phy_device *phydev)
 	if (c < 0)
 		return c;
 
-	/* INTR pin used: speed/link/duplex will cause an interrupt */
-	c = phy_write(phydev, IP101A_G_IRQ_CONF_STATUS, IP101A_G_IRQ_DEFAULT);
-	if (c < 0)
-		return c;
-
 	/* Enable Auto Power Saving mode */
 	c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS);
 	c |= IP101A_G_APS_ON;
@@ -201,6 +196,19 @@ static int ip175c_config_aneg(struct phy_device *phydev)
 	return 0;
 }
 
+static int ip101a_g_config_intr(struct phy_device *phydev)
+{
+	u16 val;
+
+	if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
+		/* INTR pin used: Speed/link/duplex will cause an interrupt */
+		val = IP101A_G_IRQ_PIN_USED;
+	else
+		val = IP101A_G_NO_IRQ;
+
+	return phy_write(phydev, IP101A_G_IRQ_CONF_STATUS, val);
+}
+
 static int ip101a_g_ack_interrupt(struct phy_device *phydev)
 {
 	int err = phy_read(phydev, IP101A_G_IRQ_CONF_STATUS);
@@ -234,6 +242,7 @@ static struct phy_driver icplus_driver[] = {
 	.name		= "ICPlus IP101A/G",
 	.phy_id_mask	= 0x0ffffff0,
 	.features	= PHY_BASIC_FEATURES,
+	.config_intr	= ip101a_g_config_intr,
 	.ack_interrupt	= ip101a_g_ack_interrupt,
 	.config_init	= &ip101a_g_config_init,
 	.suspend	= genphy_suspend,
-- 
2.19.1

^ permalink raw reply related


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