Re: [RFC PATCH] x86, hyperv: fix kernel panic when kexec on HyperV VM
On Tue, Feb 26, 2019 at 11:56:15PM +0800, Kairui Song wrote: > arch/x86/hyperv/hv_init.c | 4 > 1 file changed, 4 insertions(+) > > diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c > index 7abb09e2eeb8..92291c18d716 100644 > --- a/arch/x86/hyperv/hv_init.c > +++ b/arch/x86/hyperv/hv_init.c > @@ -406,6 +406,10 @@ void hyperv_cleanup(void) > /* Reset our OS id */ > wrmsrl(HV_X64_MSR_GUEST_OS_ID, 0); > > + /* Cleanup page reference before reset the page */ > + hv_hypercall_pg = NULL; > + wmb(); What do we need that SFENCE for? Any why does it lack a comment? > + > /* Reset the hypercall page */ > hypercall_msr.as_uint64 = 0; > wrmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64); > -- > 2.20.1 > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH net-next v2 4/8] mlxsw: spectrum_switchdev: Handle SWITCHDEV_PORT_ATTR_SET
On Tue, Feb 26, 2019 at 05:14:23PM -0800, Florian Fainelli wrote: > Following patches will change the way we communicate setting a port's > attribute and use a notifier to perform those tasks. > > Prepare mlxsw to support receiving notifier events targeting > SWITCHDEV_PORT_ATTR_SET and utilize the switchdev_handle_port_attr_set() > to handle stacking of devices. > > Signed-off-by: Florian Fainelli Reviewed-by: Ido Schimmel ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH net-next v2 8/8] net: Remove switchdev_ops
On Tue, Feb 26, 2019 at 05:14:27PM -0800, Florian Fainelli wrote: > Now that we have converted all possible callers to using a switchdev > notifier for attributes we do not have a need for implementing > switchdev_ops anymore, and this can be removed from all drivers the > net_device structure. > > Signed-off-by: Florian Fainelli Reviewed-by: Ido Schimmel ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v3 2/2] PCI: hv: Refactor hv_irq_unmask() to use cpumask_to_vpset()
Maya Nakamura writes: > Remove the duplicate implementation of cpumask_to_vpset() and use the > shared implementation. Export hv_max_vp_index, which is required by > cpumask_to_vpset(). > > Apply changes to hv_irq_unmask() based on feedback. > I just noticed an issue with this patch, sorry I've missed it before. I don't see the commit in Linus' tree, not sure if we should amend this one or a follow-up patch is needed. > Signed-off-by: Maya Nakamura > --- > Changes in v3: > - Modify to catch all failures from cpumask_to_vpset(). > - Correct the v2 change log about the commit message. > > Changes in v2: > - Remove unnecessary nr_bank initialization. > - Delete two unnecessary dev_err()'s. > - Unlock before returning. > - Update the commit message. > > arch/x86/hyperv/hv_init.c | 1 + > drivers/pci/controller/pci-hyperv.c | 38 + > 2 files changed, 18 insertions(+), 21 deletions(-) > > diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c > index 7abb09e2eeb8..7f2eed1fc81b 100644 > --- a/arch/x86/hyperv/hv_init.c > +++ b/arch/x86/hyperv/hv_init.c > @@ -96,6 +96,7 @@ void __percpu **hyperv_pcpu_input_arg; > EXPORT_SYMBOL_GPL(hyperv_pcpu_input_arg); > > u32 hv_max_vp_index; > +EXPORT_SYMBOL_GPL(hv_max_vp_index); > > static int hv_cpu_init(unsigned int cpu) > { > diff --git a/drivers/pci/controller/pci-hyperv.c > b/drivers/pci/controller/pci-hyperv.c > index da8b58d8630d..a78def332bbc 100644 > --- a/drivers/pci/controller/pci-hyperv.c > +++ b/drivers/pci/controller/pci-hyperv.c > @@ -391,8 +391,6 @@ struct hv_interrupt_entry { > u32 data; > }; > > -#define HV_VP_SET_BANK_COUNT_MAX 5 /* current implementation limit */ > - > /* > * flags for hv_device_interrupt_target.flags > */ > @@ -908,12 +906,12 @@ static void hv_irq_unmask(struct irq_data *data) > struct retarget_msi_interrupt *params; > struct hv_pcibus_device *hbus; > struct cpumask *dest; > + cpumask_var_t tmp; > struct pci_bus *pbus; > struct pci_dev *pdev; > unsigned long flags; > u32 var_size = 0; > - int cpu_vmbus; > - int cpu; > + int cpu, nr_bank; > u64 res; > > dest = irq_data_get_effective_affinity_mask(data); > @@ -953,29 +951,27 @@ static void hv_irq_unmask(struct irq_data *data) >*/ > params->int_target.flags |= > HV_DEVICE_INTERRUPT_TARGET_PROCESSOR_SET; > - params->int_target.vp_set.valid_bank_mask = > - (1ull << HV_VP_SET_BANK_COUNT_MAX) - 1; > + > + if (!alloc_cpumask_var(&tmp, GFP_KERNEL)) { We can't use GFP_KERNEL here: this is happening under hbus->retarget_msi_interrupt_lock spinlock, we should use GFP_ATOMIC instead. It may, however, make sense to add the cpumask to a pre-allocated structure (e.g. struct hv_pcibus_device) to make sure the allocation never fails. > + res = 1; > + goto exit_unlock; > + } > + > + cpumask_and(tmp, dest, cpu_online_mask); > + nr_bank = cpumask_to_vpset(¶ms->int_target.vp_set, tmp); > + free_cpumask_var(tmp); > + > + if (nr_bank <= 0) { > + res = 1; > + goto exit_unlock; > + } > > /* >* var-sized hypercall, var-size starts after vp_mask (thus >* vp_set.format does not count, but vp_set.valid_bank_mask >* does). >*/ > - var_size = 1 + HV_VP_SET_BANK_COUNT_MAX; > - > - for_each_cpu_and(cpu, dest, cpu_online_mask) { > - cpu_vmbus = hv_cpu_number_to_vp_number(cpu); > - > - if (cpu_vmbus >= HV_VP_SET_BANK_COUNT_MAX * 64) { > - dev_err(&hbus->hdev->device, > - "too high CPU %d", cpu_vmbus); > - res = 1; > - goto exit_unlock; > - } > - > - params->int_target.vp_set.bank_contents[cpu_vmbus / 64] > |= > - (1ULL << (cpu_vmbus & 63)); > - } > + var_size = 1 + nr_bank; > } else { > for_each_cpu_and(cpu, dest, cpu_online_mask) { > params->int_target.vp_mask |= -- Vitaly ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 3/3] staging: erofs: fix mis-acted TAIL merging behavior
On 2019/2/27 13:33, Gao Xiang wrote: > EROFS has an optimized path called TAIL merging, which is designed > to merge multiple reads and the corresponding decompressions into > one if these requests read continuous pages almost at the same time. > > In general, it behaves as follows: > > ... | TAIL . HEAD | PAGE | PAGE | TAIL. HEAD | ... > _|_combined page A_|||_combined page B_| > 1 ] -> [ 2 ] -> [ 3 > If the above three reads are requested in the order 1-2-3, it will > generate a large work chain rather than 3 individual work chains > to reduce scheduling overhead and boost up sequential read. > > However, if Read 2 is processed slightly earlier than Read 1, > currently it still generates 2 individual work chains (chain 1, 2) > but it does in-place decompression for combined page A, moreover, > if chain 2 decompresses ahead of chain 1, it will be a race and > lead to corrupted decompressed page. This patch fixes it. > > Fixes: 3883a79abd02 ("staging: erofs: introduce VLE decompression support") > Cc: # 4.19+ > Signed-off-by: Gao Xiang Reviewed-by: Chao Yu Thanks, ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH net-next v2 7/8] net: switchdev: Replace port attr set SDO with a notification
On Tue, Feb 26, 2019 at 05:14:26PM -0800, Florian Fainelli wrote: > diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c > index af57c4a2b78a..b7988d49d708 100644 > --- a/net/bridge/br_switchdev.c > +++ b/net/bridge/br_switchdev.c > @@ -67,12 +67,17 @@ int br_switchdev_set_port_flag(struct net_bridge_port *p, > .id = SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS, > .u.brport_flags = mask, > }; > + struct switchdev_notifier_port_attr_info info = { > + .attr = &attr, > + }; > int err; > > if (mask & ~BR_PORT_FLAGS_HW_OFFLOAD) > return 0; > > - err = switchdev_port_attr_set(p->dev, &attr); > + /* We run from atomic context here */ > + err = call_switchdev_notifiers(SWITCHDEV_PORT_ATTR_SET, p->dev, > +&info.info, NULL); > if (err == -EOPNOTSUPP) Florian, this needs to use notifier_to_errno() and check for any error. With the ops, `-EOPNOTSUPP` was returned for devices that did not implement `switchdev_ops`. Now they will simply not listen / reply to the notification. > return 0; ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/3] staging: erofs: fix illegal address access under memory pressure
On 2019/2/27 13:33, Gao Xiang wrote: > Considering a read request with two decompressed file pages, > If a decompression work cannot be started on the previous page > due to memory pressure but in-memory LTP map lookup is done, > builder->work should be still NULL. > > Moreover, if the current page also belongs to the same map, > it won't try to start the decompression work again and then > run into trouble. > > This patch aims to solve the above issue only with little changes > as much as possible in order to make the fix backport easier. > > kernel message is: > <4>[1051408.015930s]SLUB: Unable to allocate memory on node -1, > gfp=0x2408040(GFP_NOFS|__GFP_ZERO) > <4>[1051408.015930s] cache: erofs_compress, object size: 144, buffer size: > 144, default order: 0, min order: 0 > <4>[1051408.015930s] node 0: slabs: 98, objs: 2744, free: 0 > * Cannot allocate the decompression work > > <3>[1051408.015960s]erofs: z_erofs_vle_normalaccess_readpages, readahead > error at page 1008 of nid 5391488 > * Note that the previous page was failed to read > > <0>[1051408.015960s]Internal error: Accessing user space memory outside > uaccess.h routines: 9605 [#1] PREEMPT SMP > ... > <4>[1051408.015991s]Hardware name: kirin710 (DT) > ... > <4>[1051408.016021s]PC is at z_erofs_vle_work_add_page+0xa0/0x17c > <4>[1051408.016021s]LR is at z_erofs_do_read_page+0x12c/0xcf0 > ... > <4>[1051408.018096s][] z_erofs_vle_work_add_page+0xa0/0x17c > <4>[1051408.018096s][] > z_erofs_vle_normalaccess_readpages+0x1a0/0x37c > <4>[1051408.018096s][] read_pages+0x70/0x190 > <4>[1051408.018127s][] __do_page_cache_readahead+0x194/0x1a8 > <4>[1051408.018127s][] filemap_fault+0x398/0x684 > <4>[1051408.018127s][] __do_fault+0x8c/0x138 > <4>[1051408.018127s][] handle_pte_fault+0x730/0xb7c > <4>[1051408.018127s][] __handle_mm_fault+0xac/0xf4 > <4>[1051408.018157s][] handle_mm_fault+0x7c/0x118 > <4>[1051408.018157s][] do_page_fault+0x354/0x474 > <4>[1051408.018157s][] do_translation_fault+0x40/0x48 > <4>[1051408.018157s][] do_mem_abort+0x80/0x100 > <4>[1051408.018310s]---[ end trace 9f4009a3283bd78b ]--- > > Fixes: 3883a79abd02 ("staging: erofs: introduce VLE decompression support") > Cc: # 4.19+ > Signed-off-by: Gao Xiang Reviewed-by: Chao Yu Thanks, ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/3] staging: erofs: compressed_pages should not be accessed again after freed
On 2019/2/27 13:33, Gao Xiang wrote: > This patch resolves the following page use-after-free issue, > z_erofs_vle_unzip: > ... > for (i = 0; i < nr_pages; ++i) { > ... > z_erofs_onlinepage_endio(page); (1) > } > > for (i = 0; i < clusterpages; ++i) { > page = compressed_pages[i]; > > if (page->mapping == mngda) (2) > continue; > /* recycle all individual staging pages */ > (void)z_erofs_gather_if_stagingpage(page_pool, page); (3) > WRITE_ONCE(compressed_pages[i], NULL); > } > ... > > After (1) is executed, page is freed and could be then reused, if > compressed_pages is scanned after that, it could fall info (2) or > (3) by mistake and that could finally be in a mess. > > This patch aims to solve the above issue only with little changes > as much as possible in order to make the fix backport easier. > > Fixes: 3883a79abd02 ("staging: erofs: introduce VLE decompression support") > Cc: # 4.19+ > Signed-off-by: Gao Xiang Reviewed-by: Chao Yu Thanks, ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH net-next 7/8] net: switchdev: Replace port attr set SDO with a notification
On Mon, Feb 25, 2019 at 11:47:12AM -0800, Florian Fainelli wrote: > On 2/25/19 1:49 AM, Ido Schimmel wrote: > > On Sun, Feb 24, 2019 at 08:47:27AM -0800, Florian Fainelli wrote: > >> Le 2/23/19 à 2:32 AM, Ido Schimmel a écrit : > >>> On Fri, Feb 22, 2019 at 03:59:25PM -0800, Florian Fainelli wrote: > -if (attr->flags & SWITCHDEV_F_NO_RECURSE) > +if (attr & SWITCHDEV_F_DEFER) > +rc = call_switchdev_blocking_notifiers(nt, dev, > + &attr_info.info, > NULL); > +else > +rc = call_switchdev_notifiers(nt, dev, &attr_info.info, > NULL); > >>> > >>> I don't believe this is needed. You're calling this function from > >>> switchdev_port_attr_set_now() which is always called from process > >>> context. switchdev_port_attr_set() takes care of that. Similar to > >>> switchdev_port_obj_add(). > >> > >> Except for net/bridge/br_switchdev.c when we check the bridge port's > >> flags support with PRE_BRIDGE_FLAGS. In that case we are executing from > >> the caller (atomic) context and we can't defer otherwise that trumps the > >> whole idea of being able to do a quick check and return that to the > >> caller that we cannot support specific flags. How would you recommend > >> approaching that? > > > > In this case you can invoke call_switchdev_notifiers() directly from > > br_switchdev_set_port_flag(). Eventually switchdev_port_attr_set() will > > be gone and bridge code will invoke the notifiers directly. > > That can be done, but it still requires the target driver (mlxsw, > ocelot, dsa, etc.) to support attribute notification from blocking and > non-blocking context. Are you fine with that? Yes. Sorry for the latency. I was away yesterday. Reviewed your v2 and only found one problem. Will run some tests now. Thanks! ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH net-next v2 1/8] switchdev: Add SWITCHDEV_PORT_ATTR_SET
On Tue, Feb 26, 2019 at 05:14:20PM -0800, Florian Fainelli wrote: > In preparation for allowing switchdev enabled drivers to veto specific > attribute settings from within the context of the caller, introduce a > new switchdev notifier type for port attributes. > > Suggested-by: Ido Schimmel > Signed-off-by: Florian Fainelli Reviewed-by: Ido Schimmel ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH net-next v2 8/8] net: Remove switchdev_ops
On Tue, Feb 26, 2019 at 05:14:27PM -0800, Florian Fainelli wrote: > diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c > b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c > index b00f6f74f91a..995426ea9a43 100644 > --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c > +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c > @@ -3660,7 +3660,6 @@ static int mlxsw_sp_port_create(struct mlxsw_sp > *mlxsw_sp, u8 local_port, > } > mlxsw_sp_port->default_vlan = mlxsw_sp_port_vlan; > > - mlxsw_sp_port_switchdev_init(mlxsw_sp_port); > mlxsw_sp->ports[local_port] = mlxsw_sp_port; > err = register_netdev(dev); > if (err) { > @@ -3677,7 +3676,6 @@ static int mlxsw_sp_port_create(struct mlxsw_sp > *mlxsw_sp, u8 local_port, > > err_register_netdev: > mlxsw_sp->ports[local_port] = NULL; > - mlxsw_sp_port_switchdev_fini(mlxsw_sp_port); > mlxsw_sp_port_vlan_destroy(mlxsw_sp_port_vlan); > err_port_vlan_create: > err_port_pvid_set: > @@ -3720,7 +3718,6 @@ static void mlxsw_sp_port_remove(struct mlxsw_sp > *mlxsw_sp, u8 local_port) > mlxsw_core_port_clear(mlxsw_sp->core, local_port, mlxsw_sp); > unregister_netdev(mlxsw_sp_port->dev); /* This calls ndo_stop */ > mlxsw_sp->ports[local_port] = NULL; > - mlxsw_sp_port_switchdev_fini(mlxsw_sp_port); > mlxsw_sp_port_vlan_flush(mlxsw_sp_port, true); > mlxsw_sp_port_nve_fini(mlxsw_sp_port); > mlxsw_sp_tc_qdisc_fini(mlxsw_sp_port); > @@ -4441,12 +4438,6 @@ static int mlxsw_sp_init(struct mlxsw_core *mlxsw_core, > goto err_span_init; > } > > - err = mlxsw_sp_switchdev_init(mlxsw_sp); I missed that and got a trace as soon as I tried to enslave a port. You should only remove mlxsw_sp_port_switchdev_init() and not mlxsw_sp_switchdev_init() > - if (err) { > - dev_err(mlxsw_sp->bus_info->dev, "Failed to initialize > switchdev\n"); > - goto err_switchdev_init; > - } > - > err = mlxsw_sp_counter_pool_init(mlxsw_sp); > if (err) { > dev_err(mlxsw_sp->bus_info->dev, "Failed to init counter > pool\n"); > @@ -4517,8 +4508,6 @@ static int mlxsw_sp_init(struct mlxsw_core *mlxsw_core, > err_afa_init: > mlxsw_sp_counter_pool_fini(mlxsw_sp); > err_counter_pool_init: > - mlxsw_sp_switchdev_fini(mlxsw_sp); > -err_switchdev_init: > mlxsw_sp_span_fini(mlxsw_sp); > err_span_init: > mlxsw_sp_lag_fini(mlxsw_sp); > @@ -4585,7 +4574,6 @@ static void mlxsw_sp_fini(struct mlxsw_core *mlxsw_core) > mlxsw_sp_nve_fini(mlxsw_sp); > mlxsw_sp_afa_fini(mlxsw_sp); > mlxsw_sp_counter_pool_fini(mlxsw_sp); > - mlxsw_sp_switchdev_fini(mlxsw_sp); > mlxsw_sp_span_fini(mlxsw_sp); > mlxsw_sp_lag_fini(mlxsw_sp); > mlxsw_sp_buffers_fini(mlxsw_sp); > diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h > b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h > index a61c1130d9e3..da6278b0caa4 100644 > --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h > +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h > @@ -407,8 +407,6 @@ extern const struct mlxsw_sp_sb_vals mlxsw_sp2_sb_vals; > /* spectrum_switchdev.c */ > int mlxsw_sp_switchdev_init(struct mlxsw_sp *mlxsw_sp); > void mlxsw_sp_switchdev_fini(struct mlxsw_sp *mlxsw_sp); > -void mlxsw_sp_port_switchdev_init(struct mlxsw_sp_port *mlxsw_sp_port); > -void mlxsw_sp_port_switchdev_fini(struct mlxsw_sp_port *mlxsw_sp_port); > int mlxsw_sp_rif_fdb_op(struct mlxsw_sp *mlxsw_sp, const char *mac, u16 fid, > bool adding); > void > diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c > b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c > index c1aedfea3a31..f6ce386c3036 100644 > --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c > +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c > @@ -1938,10 +1938,6 @@ static struct mlxsw_sp_port > *mlxsw_sp_lag_rep_port(struct mlxsw_sp *mlxsw_sp, > return NULL; > } > > -static const struct switchdev_ops mlxsw_sp_port_switchdev_ops = { > - .switchdev_port_attr_set= mlxsw_sp_port_attr_set, > -}; > - > static int > mlxsw_sp_bridge_8021q_port_join(struct mlxsw_sp_bridge_device *bridge_device, > struct mlxsw_sp_bridge_port *bridge_port, > @@ -3545,11 +3541,3 @@ void mlxsw_sp_switchdev_fini(struct mlxsw_sp *mlxsw_sp) > kfree(mlxsw_sp->bridge); > } > > -void mlxsw_sp_port_switchdev_init(struct mlxsw_sp_port *mlxsw_sp_port) > -{ > - mlxsw_sp_port->dev->switchdev_ops = &mlxsw_sp_port_switchdev_ops; > -} > - > -void mlxsw_sp_port_switchdev_fini(struct mlxsw_sp_port *mlxsw_sp_port) > -{ > -} ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v3 2/2] PCI: hv: Refactor hv_irq_unmask() to use cpumask_to_vpset()
On Wed, Feb 27, 2019 at 01:34:44PM +0100, Vitaly Kuznetsov wrote: > Maya Nakamura writes: > > > Remove the duplicate implementation of cpumask_to_vpset() and use the > > shared implementation. Export hv_max_vp_index, which is required by > > cpumask_to_vpset(). > > > > Apply changes to hv_irq_unmask() based on feedback. > > > > I just noticed an issue with this patch, sorry I've missed it before. I > don't see the commit in Linus' tree, not sure if we should amend this > one or a follow-up patch is needed. I will drop this patch from the PCI queue, it does not make sense to merge a patch adding a bug and fix it up later with a subsequent one given that it is not upstream yet. Lorenzo > > Signed-off-by: Maya Nakamura > > --- > > Changes in v3: > > - Modify to catch all failures from cpumask_to_vpset(). > > - Correct the v2 change log about the commit message. > > > > Changes in v2: > > - Remove unnecessary nr_bank initialization. > > - Delete two unnecessary dev_err()'s. > > - Unlock before returning. > > - Update the commit message. > > > > arch/x86/hyperv/hv_init.c | 1 + > > drivers/pci/controller/pci-hyperv.c | 38 + > > 2 files changed, 18 insertions(+), 21 deletions(-) > > > > diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c > > index 7abb09e2eeb8..7f2eed1fc81b 100644 > > --- a/arch/x86/hyperv/hv_init.c > > +++ b/arch/x86/hyperv/hv_init.c > > @@ -96,6 +96,7 @@ void __percpu **hyperv_pcpu_input_arg; > > EXPORT_SYMBOL_GPL(hyperv_pcpu_input_arg); > > > > u32 hv_max_vp_index; > > +EXPORT_SYMBOL_GPL(hv_max_vp_index); > > > > static int hv_cpu_init(unsigned int cpu) > > { > > diff --git a/drivers/pci/controller/pci-hyperv.c > > b/drivers/pci/controller/pci-hyperv.c > > index da8b58d8630d..a78def332bbc 100644 > > --- a/drivers/pci/controller/pci-hyperv.c > > +++ b/drivers/pci/controller/pci-hyperv.c > > @@ -391,8 +391,6 @@ struct hv_interrupt_entry { > > u32 data; > > }; > > > > -#define HV_VP_SET_BANK_COUNT_MAX 5 /* current implementation limit */ > > - > > /* > > * flags for hv_device_interrupt_target.flags > > */ > > @@ -908,12 +906,12 @@ static void hv_irq_unmask(struct irq_data *data) > > struct retarget_msi_interrupt *params; > > struct hv_pcibus_device *hbus; > > struct cpumask *dest; > > + cpumask_var_t tmp; > > struct pci_bus *pbus; > > struct pci_dev *pdev; > > unsigned long flags; > > u32 var_size = 0; > > - int cpu_vmbus; > > - int cpu; > > + int cpu, nr_bank; > > u64 res; > > > > dest = irq_data_get_effective_affinity_mask(data); > > @@ -953,29 +951,27 @@ static void hv_irq_unmask(struct irq_data *data) > > */ > > params->int_target.flags |= > > HV_DEVICE_INTERRUPT_TARGET_PROCESSOR_SET; > > - params->int_target.vp_set.valid_bank_mask = > > - (1ull << HV_VP_SET_BANK_COUNT_MAX) - 1; > > + > > + if (!alloc_cpumask_var(&tmp, GFP_KERNEL)) { > > We can't use GFP_KERNEL here: this is happening under > hbus->retarget_msi_interrupt_lock spinlock, we should use GFP_ATOMIC > instead. It may, however, make sense to add the cpumask to a > pre-allocated structure (e.g. struct hv_pcibus_device) to make sure the > allocation never fails. > > > + res = 1; > > + goto exit_unlock; > > + } > > + > > + cpumask_and(tmp, dest, cpu_online_mask); > > + nr_bank = cpumask_to_vpset(¶ms->int_target.vp_set, tmp); > > + free_cpumask_var(tmp); > > + > > + if (nr_bank <= 0) { > > + res = 1; > > + goto exit_unlock; > > + } > > > > /* > > * var-sized hypercall, var-size starts after vp_mask (thus > > * vp_set.format does not count, but vp_set.valid_bank_mask > > * does). > > */ > > - var_size = 1 + HV_VP_SET_BANK_COUNT_MAX; > > - > > - for_each_cpu_and(cpu, dest, cpu_online_mask) { > > - cpu_vmbus = hv_cpu_number_to_vp_number(cpu); > > - > > - if (cpu_vmbus >= HV_VP_SET_BANK_COUNT_MAX * 64) { > > - dev_err(&hbus->hdev->device, > > - "too high CPU %d", cpu_vmbus); > > - res = 1; > > - goto exit_unlock; > > - } > > - > > - params->int_target.vp_set.bank_contents[cpu_vmbus / 64] > > |= > > - (1ULL << (cpu_vmbus & 63)); > > - } > > + var_size = 1 + nr_bank; > > } else { > > for_each_cpu_and(cpu, dest, cpu_online_mask) { > > params->int_target.vp_mask |= > > -- > Vitaly ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-d
[PATCH V2] staging: wilc1000: fix incorrent type in initializer
Fix sparse warning: drivers/staging/wilc1000//host_interface.c:444:49: warning: incorrect type in initializer (different address spaces) drivers/staging/wilc1000//host_interface.c:444:49:expected struct cfg80211_bss_ies const *ies drivers/staging/wilc1000//host_interface.c:444:49:got struct cfg80211_bss_ies const [noderef] *ies Signed-off-by: Bo YU --- V2: Adding cc wireless-list --- drivers/staging/wilc1000/host_interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 20349af2ed30..4dd9a20f6a0b 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -441,7 +441,7 @@ void *wilc_parse_join_bss_param(struct cfg80211_bss *bss, const u8 *tim_elm, *ssid_elm, *rates_ie, *supp_rates_ie; const u8 *ht_ie, *wpa_ie, *wmm_ie, *rsn_ie; int ret; - const struct cfg80211_bss_ies *ies = bss->ies; + const struct cfg80211_bss_ies *ies = rcu_dereference(bss->ies); param = kzalloc(sizeof(*param), GFP_KERNEL); if (!param) -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V6 1/3] x86/Hyper-V: Set x2apic destination mode to physical when x2apic is available
From: Lan Tianyu Hyper-V doesn't provide irq remapping for IO-APIC. To enable x2apic, set x2apic destination mode to physcial mode when x2apic is available and Hyper-V IOMMU driver makes sure cpus assigned with IO-APIC irqs have 8-bit APIC id. Reviewed-by: Thomas Gleixner Reviewed-by: Michael Kelley Signed-off-by: Lan Tianyu --- Change since v5: - Fix comile error due to x2apic_phys Change since v2: - Fix compile error due to x2apic_phys - Fix comment indent Change since v1: - Remove redundant extern for x2apic_phys --- arch/x86/kernel/cpu/mshyperv.c | 12 1 file changed, 12 insertions(+) diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c index e81a2db..3fa238a 100644 --- a/arch/x86/kernel/cpu/mshyperv.c +++ b/arch/x86/kernel/cpu/mshyperv.c @@ -328,6 +328,18 @@ static void __init ms_hyperv_init_platform(void) # ifdef CONFIG_SMP smp_ops.smp_prepare_boot_cpu = hv_smp_prepare_boot_cpu; # endif + + /* +* Hyper-V doesn't provide irq remapping for IO-APIC. To enable x2apic, +* set x2apic destination mode to physcial mode when x2apic is available +* and Hyper-V IOMMU driver makes sure cpus assigned with IO-APIC irqs +* have 8-bit APIC id. +*/ +# ifdef CONFIG_X86_X2APIC + if (x2apic_supported()) + x2apic_phys = 1; +# endif + #endif } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [RFC PATCH] x86, hyperv: fix kernel panic when kexec on HyperV VM
On Wed, Feb 27, 2019 at 8:02 PM Peter Zijlstra wrote: > > On Tue, Feb 26, 2019 at 11:56:15PM +0800, Kairui Song wrote: > > arch/x86/hyperv/hv_init.c | 4 > > 1 file changed, 4 insertions(+) > > > > diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c > > index 7abb09e2eeb8..92291c18d716 100644 > > --- a/arch/x86/hyperv/hv_init.c > > +++ b/arch/x86/hyperv/hv_init.c > > @@ -406,6 +406,10 @@ void hyperv_cleanup(void) > > /* Reset our OS id */ > > wrmsrl(HV_X64_MSR_GUEST_OS_ID, 0); > > > > + /* Cleanup page reference before reset the page */ > > + hv_hypercall_pg = NULL; > > + wmb(); > > What do we need that SFENCE for? Any why does it lack a comment? Hi, that's for ensuring the hv_hypercall_pg is reset to NULL before the following wrmsr call. The wrmsr call will make the pointer address invalid. I can add some comment in V2 if this is OK. -- Best Regards, Kairui Song ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8712: fix indentation issues
Fix indentation warnings reported by checkpatch Signed-off-by: Prashanth Kumar KR --- drivers/staging/rtl8712/ieee80211.c| 3 ++- drivers/staging/rtl8712/rtl871x_recv.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8712/ieee80211.c b/drivers/staging/rtl8712/ieee80211.c index 2eae11dd6b42..4cca7390c8ef 100644 --- a/drivers/staging/rtl8712/ieee80211.c +++ b/drivers/staging/rtl8712/ieee80211.c @@ -238,7 +238,8 @@ unsigned char *r8712_get_wpa_ie(unsigned char *pie, uint *wpa_ie_len, int limit) return NULL; } -unsigned char *r8712_get_wpa2_ie(unsigned char *pie, uint *rsn_ie_len, int limit) +unsigned char *r8712_get_wpa2_ie(unsigned char *pie, uint *rsn_ie_len, +int limit) { return r8712_get_ie(pie, _WPA2_IE_ID_, rsn_ie_len, limit); } diff --git a/drivers/staging/rtl8712/rtl871x_recv.c b/drivers/staging/rtl8712/rtl871x_recv.c index 0271ccf25f25..28f736913292 100644 --- a/drivers/staging/rtl8712/rtl871x_recv.c +++ b/drivers/staging/rtl8712/rtl871x_recv.c @@ -404,7 +404,7 @@ static sint ap2sta_data_frame(struct _adapter *adapter, if (bmcast) *psta = r8712_get_bcmc_stainfo(adapter); else - *psta = r8712_get_stainfo(pstapriv, pattrib->bssid); + *psta = r8712_get_stainfo(pstapriv, pattrib->bssid); if (*psta == NULL) return _FAIL; } else if (check_fwstate(pmlmepriv, WIFI_MP_STATE) && -- 2.20.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: rtl8712: fix indentation issues
On Wed, Feb 27, 2019 at 08:37:51PM +0530, Prashanth Kumar KR wrote: > Fix indentation warnings reported by checkpatch > > Signed-off-by: Prashanth Kumar KR > --- > drivers/staging/rtl8712/ieee80211.c| 3 ++- > drivers/staging/rtl8712/rtl871x_recv.c | 2 +- > 2 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/rtl8712/ieee80211.c > b/drivers/staging/rtl8712/ieee80211.c > index 2eae11dd6b42..4cca7390c8ef 100644 > --- a/drivers/staging/rtl8712/ieee80211.c > +++ b/drivers/staging/rtl8712/ieee80211.c > @@ -238,7 +238,8 @@ unsigned char *r8712_get_wpa_ie(unsigned char *pie, uint > *wpa_ie_len, int limit) > return NULL; > } > > -unsigned char *r8712_get_wpa2_ie(unsigned char *pie, uint *rsn_ie_len, int > limit) > +unsigned char *r8712_get_wpa2_ie(unsigned char *pie, uint *rsn_ie_len, > + int limit) That is not an "indendation issue" :( ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] media: imx7_mipi_csis: remove internal ops
Remove code that is not called anywhere, just remove the internal ops. Signed-off-by: Rui Miguel Silva --- drivers/staging/media/imx/imx7-mipi-csis.c | 27 -- 1 file changed, 27 deletions(-) diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c b/drivers/staging/media/imx/imx7-mipi-csis.c index f4674de09e83..75b904d36621 100644 --- a/drivers/staging/media/imx/imx7-mipi-csis.c +++ b/drivers/staging/media/imx/imx7-mipi-csis.c @@ -783,29 +783,6 @@ static irqreturn_t mipi_csis_irq_handler(int irq, void *dev_id) return IRQ_HANDLED; } -static int mipi_csi_registered(struct v4l2_subdev *mipi_sd) -{ - struct csi_state *state = mipi_sd_to_csis_state(mipi_sd); - unsigned int i; - int ret; - - for (i = 0; i < CSIS_PADS_NUM; i++) { - state->pads[i].flags = (i == CSIS_PAD_SINK) ? - MEDIA_PAD_FL_SINK : MEDIA_PAD_FL_SOURCE; - } - - /* set a default mbus format */ - ret = imx_media_init_mbus_fmt(&state->format_mbus, - MIPI_CSIS_DEF_PIX_HEIGHT, - MIPI_CSIS_DEF_PIX_WIDTH, 0, - V4L2_FIELD_NONE, NULL); - if (ret) - return ret; - - return media_entity_pads_init(&mipi_sd->entity, CSIS_PADS_NUM, - state->pads); -} - static const struct v4l2_subdev_core_ops mipi_csis_core_ops = { .log_status = mipi_csis_log_status, }; @@ -831,10 +808,6 @@ static const struct v4l2_subdev_ops mipi_csis_subdev_ops = { .pad= &mipi_csis_pad_ops, }; -static const struct v4l2_subdev_internal_ops mipi_csis_internal_ops = { - .registered = mipi_csi_registered, -}; - static int mipi_csis_parse_dt(struct platform_device *pdev, struct csi_state *state) { -- 2.20.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v3 1/2] PCI: hv: Replace hv_vp_set with hv_vpset
Maya Nakamura writes: > Remove a duplicate definition of VP set (hv_vp_set) and use the common > definition (hv_vpset) that is used in other places. > > Change the order of the members in struct hv_pcibus_device so that the > declaration of retarget_msi_interrupt_params is the last member. Struct > hv_vpset, which contains a flexible array, is nested two levels deep in > struct hv_pcibus_device via retarget_msi_interrupt_params. > > Add a comment that retarget_msi_interrupt_params should be the last member > of struct hv_pcibus_device. > > Signed-off-by: Maya Nakamura > --- > Change in v3: > - Correct the v2 change log. > > Change in v2: > - Update the commit message. > > drivers/pci/controller/pci-hyperv.c | 25 - > 1 file changed, 12 insertions(+), 13 deletions(-) > > diff --git a/drivers/pci/controller/pci-hyperv.c > b/drivers/pci/controller/pci-hyperv.c > index 9ba4d12c179c..da8b58d8630d 100644 > --- a/drivers/pci/controller/pci-hyperv.c > +++ b/drivers/pci/controller/pci-hyperv.c > @@ -393,12 +393,6 @@ struct hv_interrupt_entry { > > #define HV_VP_SET_BANK_COUNT_MAX 5 /* current implementation limit */ > > -struct hv_vp_set { > - u64 format; /* 0 (HvGenericSetSparse4k) */ > - u64 valid_banks; > - u64 masks[HV_VP_SET_BANK_COUNT_MAX]; > -}; > - > /* > * flags for hv_device_interrupt_target.flags > */ > @@ -410,7 +404,7 @@ struct hv_device_interrupt_target { > u32 flags; > union { > u64 vp_mask; > - struct hv_vp_set vp_set; > + struct hv_vpset vp_set; > }; > }; > > @@ -460,12 +454,16 @@ struct hv_pcibus_device { > struct msi_controller msi_chip; > struct irq_domain *irq_domain; > > - /* hypercall arg, must not cross page boundary */ > - struct retarget_msi_interrupt retarget_msi_interrupt_params; > - > spinlock_t retarget_msi_interrupt_lock; > > struct workqueue_struct *wq; > + > + /* hypercall arg, must not cross page boundary */ > + struct retarget_msi_interrupt retarget_msi_interrupt_params; > + One more thing here (and again sorry for being late): this structure is being used as Hyper-V hypercall argument and these have special requirements on alignment (8 bytes). struct retarget_msi_interrupt is packed and depending on your environment/compiler you may or may not see the issue but I has able to get HVCALL_RETARGET_INTERRUPT failing with the return value of 4 (HV_STATUS_INVALID_ALIGNMENT). I suggest we add __aligned(8) to 'struct retarget_msi_interrupt' definition (I haven't tested this but should work). This is not a new issue, it existed before your patch, but the code movement you do may change the exposure. > + /* > + * Don't put anything here: retarget_msi_interrupt_params must be last > + */ > }; > > /* > @@ -955,12 +953,13 @@ static void hv_irq_unmask(struct irq_data *data) >*/ > params->int_target.flags |= > HV_DEVICE_INTERRUPT_TARGET_PROCESSOR_SET; > - params->int_target.vp_set.valid_banks = > + params->int_target.vp_set.valid_bank_mask = > (1ull << HV_VP_SET_BANK_COUNT_MAX) - 1; > > /* >* var-sized hypercall, var-size starts after vp_mask (thus > - * vp_set.format does not count, but vp_set.valid_banks does). > + * vp_set.format does not count, but vp_set.valid_bank_mask > + * does). >*/ > var_size = 1 + HV_VP_SET_BANK_COUNT_MAX; > > @@ -974,7 +973,7 @@ static void hv_irq_unmask(struct irq_data *data) > goto exit_unlock; > } > > - params->int_target.vp_set.masks[cpu_vmbus / 64] |= > + params->int_target.vp_set.bank_contents[cpu_vmbus / 64] > |= > (1ULL << (cpu_vmbus & 63)); > } > } else { -- Vitaly ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8712: Fix indentation issue
Fix indentation warning reported by checkpatch Signed-off-by: Prashanth Kumar KR --- drivers/staging/rtl8712/rtl871x_recv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8712/rtl871x_recv.c b/drivers/staging/rtl8712/rtl871x_recv.c index 0271ccf25f25..28f736913292 100644 --- a/drivers/staging/rtl8712/rtl871x_recv.c +++ b/drivers/staging/rtl8712/rtl871x_recv.c @@ -404,7 +404,7 @@ static sint ap2sta_data_frame(struct _adapter *adapter, if (bmcast) *psta = r8712_get_bcmc_stainfo(adapter); else - *psta = r8712_get_stainfo(pstapriv, pattrib->bssid); + *psta = r8712_get_stainfo(pstapriv, pattrib->bssid); if (*psta == NULL) return _FAIL; } else if (check_fwstate(pmlmepriv, WIFI_MP_STATE) && -- 2.20.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v3 1/2] PCI: hv: Replace hv_vp_set with hv_vpset
On Wed, Feb 27, 2019 at 04:53:37PM +0100, Vitaly Kuznetsov wrote: > Maya Nakamura writes: > > > Remove a duplicate definition of VP set (hv_vp_set) and use the common > > definition (hv_vpset) that is used in other places. > > > > Change the order of the members in struct hv_pcibus_device so that the > > declaration of retarget_msi_interrupt_params is the last member. Struct > > hv_vpset, which contains a flexible array, is nested two levels deep in > > struct hv_pcibus_device via retarget_msi_interrupt_params. > > > > Add a comment that retarget_msi_interrupt_params should be the last member > > of struct hv_pcibus_device. > > > > Signed-off-by: Maya Nakamura > > --- > > Change in v3: > > - Correct the v2 change log. > > > > Change in v2: > > - Update the commit message. > > > > drivers/pci/controller/pci-hyperv.c | 25 - > > 1 file changed, 12 insertions(+), 13 deletions(-) > > > > diff --git a/drivers/pci/controller/pci-hyperv.c > > b/drivers/pci/controller/pci-hyperv.c > > index 9ba4d12c179c..da8b58d8630d 100644 > > --- a/drivers/pci/controller/pci-hyperv.c > > +++ b/drivers/pci/controller/pci-hyperv.c > > @@ -393,12 +393,6 @@ struct hv_interrupt_entry { > > > > #define HV_VP_SET_BANK_COUNT_MAX 5 /* current implementation limit */ > > > > -struct hv_vp_set { > > - u64 format; /* 0 (HvGenericSetSparse4k) */ > > - u64 valid_banks; > > - u64 masks[HV_VP_SET_BANK_COUNT_MAX]; > > -}; > > - > > /* > > * flags for hv_device_interrupt_target.flags > > */ > > @@ -410,7 +404,7 @@ struct hv_device_interrupt_target { > > u32 flags; > > union { > > u64 vp_mask; > > - struct hv_vp_set vp_set; > > + struct hv_vpset vp_set; > > }; > > }; > > > > @@ -460,12 +454,16 @@ struct hv_pcibus_device { > > struct msi_controller msi_chip; > > struct irq_domain *irq_domain; > > > > - /* hypercall arg, must not cross page boundary */ > > - struct retarget_msi_interrupt retarget_msi_interrupt_params; > > - > > spinlock_t retarget_msi_interrupt_lock; > > > > struct workqueue_struct *wq; > > + > > + /* hypercall arg, must not cross page boundary */ > > + struct retarget_msi_interrupt retarget_msi_interrupt_params; > > + > > One more thing here (and again sorry for being late): this structure is > being used as Hyper-V hypercall argument and these have special > requirements on alignment (8 bytes). struct retarget_msi_interrupt is > packed and depending on your environment/compiler you may or may not see > the issue but I has able to get HVCALL_RETARGET_INTERRUPT failing with > the return value of 4 (HV_STATUS_INVALID_ALIGNMENT). > > I suggest we add __aligned(8) to 'struct retarget_msi_interrupt' > definition (I haven't tested this but should work). This is not a new > issue, it existed before your patch, but the code movement you do may > change the exposure. I am happy to apply this small fix _before_ this patch but if you want me to merge them for v5.1 this must be put together and tested quite quickly. For the time being I am not dropping this patch from the PCI queue, waiting for an update from you guys. Thanks, Lorenzo > > > > + /* > > +* Don't put anything here: retarget_msi_interrupt_params must be last > > +*/ > > }; > > > > /* > > @@ -955,12 +953,13 @@ static void hv_irq_unmask(struct irq_data *data) > > */ > > params->int_target.flags |= > > HV_DEVICE_INTERRUPT_TARGET_PROCESSOR_SET; > > - params->int_target.vp_set.valid_banks = > > + params->int_target.vp_set.valid_bank_mask = > > (1ull << HV_VP_SET_BANK_COUNT_MAX) - 1; > > > > /* > > * var-sized hypercall, var-size starts after vp_mask (thus > > -* vp_set.format does not count, but vp_set.valid_banks does). > > +* vp_set.format does not count, but vp_set.valid_bank_mask > > +* does). > > */ > > var_size = 1 + HV_VP_SET_BANK_COUNT_MAX; > > > > @@ -974,7 +973,7 @@ static void hv_irq_unmask(struct irq_data *data) > > goto exit_unlock; > > } > > > > - params->int_target.vp_set.masks[cpu_vmbus / 64] |= > > + params->int_target.vp_set.bank_contents[cpu_vmbus / 64] > > |= > > (1ULL << (cpu_vmbus & 63)); > > } > > } else { > > -- > Vitaly ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH V6 1/3] x86/Hyper-V: Set x2apic destination mode to physical when x2apic is available
From: Tianyu Lan Sent: Wednesday, February 27, 2019 6:54 AM > > Hyper-V doesn't provide irq remapping for IO-APIC. To enable x2apic, > set x2apic destination mode to physcial mode when x2apic is available > and Hyper-V IOMMU driver makes sure cpus assigned with IO-APIC irqs have > 8-bit APIC id. > > Reviewed-by: Thomas Gleixner > Reviewed-by: Michael Kelley > Signed-off-by: Lan Tianyu > --- > Change since v5: >- Fix comile error due to x2apic_phys > > Change since v2: >- Fix compile error due to x2apic_phys >- Fix comment indent > Change since v1: >- Remove redundant extern for x2apic_phys > --- > arch/x86/kernel/cpu/mshyperv.c | 12 > 1 file changed, 12 insertions(+) Reconfirming my reviewed-by after the change to fix the compile error detected by the kbuild test robot. Reviewed-by: Michael Kelley ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [RESEND PATCH 0/7] Add FOLL_LONGTERM to GUP fast and use it
On Tue, Feb 19, 2019 at 09:30:33PM -0800, 'Ira Weiny' wrote: > From: Ira Weiny > > Resending these as I had only 1 minor comment which I believe we have covered > in this series. I was anticipating these going through the mm tree as they > depend on a cleanup patch there and the IB changes are very minor. But they > could just as well go through the IB tree. > > NOTE: This series depends on my clean up patch to remove the write parameter > from gup_fast_permitted()[1] > > HFI1, qib, and mthca, use get_user_pages_fast() due to it performance > advantages. These pages can be held for a significant time. But > get_user_pages_fast() does not protect against mapping of FS DAX pages. > > Introduce FOLL_LONGTERM and use this flag in get_user_pages_fast() which > retains the performance while also adding the FS DAX checks. XDP has also > shown interest in using this functionality.[2] > > In addition we change get_user_pages() to use the new FOLL_LONGTERM flag and > remove the specialized get_user_pages_longterm call. > > [1] https://lkml.org/lkml/2019/2/11/237 > [2] https://lkml.org/lkml/2019/2/11/1789 Is there anything I need to do on this series or does anyone have any objections to it going into 5.1? And if so who's tree is it going to go through? Thanks, Ira > > Ira Weiny (7): > mm/gup: Replace get_user_pages_longterm() with FOLL_LONGTERM > mm/gup: Change write parameter to flags in fast walk > mm/gup: Change GUP fast to use flags rather than a write 'bool' > mm/gup: Add FOLL_LONGTERM capability to GUP fast > IB/hfi1: Use the new FOLL_LONGTERM flag to get_user_pages_fast() > IB/qib: Use the new FOLL_LONGTERM flag to get_user_pages_fast() > IB/mthca: Use the new FOLL_LONGTERM flag to get_user_pages_fast() > > arch/mips/mm/gup.c | 11 +- > arch/powerpc/kvm/book3s_64_mmu_hv.c | 4 +- > arch/powerpc/kvm/e500_mmu.c | 2 +- > arch/powerpc/mm/mmu_context_iommu.c | 4 +- > arch/s390/kvm/interrupt.c | 2 +- > arch/s390/mm/gup.c | 12 +- > arch/sh/mm/gup.c| 11 +- > arch/sparc/mm/gup.c | 9 +- > arch/x86/kvm/paging_tmpl.h | 2 +- > arch/x86/kvm/svm.c | 2 +- > drivers/fpga/dfl-afu-dma-region.c | 2 +- > drivers/gpu/drm/via/via_dmablit.c | 3 +- > drivers/infiniband/core/umem.c | 5 +- > drivers/infiniband/hw/hfi1/user_pages.c | 5 +- > drivers/infiniband/hw/mthca/mthca_memfree.c | 3 +- > drivers/infiniband/hw/qib/qib_user_pages.c | 8 +- > drivers/infiniband/hw/qib/qib_user_sdma.c | 2 +- > drivers/infiniband/hw/usnic/usnic_uiom.c| 9 +- > drivers/media/v4l2-core/videobuf-dma-sg.c | 6 +- > drivers/misc/genwqe/card_utils.c| 2 +- > drivers/misc/vmw_vmci/vmci_host.c | 2 +- > drivers/misc/vmw_vmci/vmci_queue_pair.c | 6 +- > drivers/platform/goldfish/goldfish_pipe.c | 3 +- > drivers/rapidio/devices/rio_mport_cdev.c| 4 +- > drivers/sbus/char/oradax.c | 2 +- > drivers/scsi/st.c | 3 +- > drivers/staging/gasket/gasket_page_table.c | 4 +- > drivers/tee/tee_shm.c | 2 +- > drivers/vfio/vfio_iommu_spapr_tce.c | 3 +- > drivers/vfio/vfio_iommu_type1.c | 3 +- > drivers/vhost/vhost.c | 2 +- > drivers/video/fbdev/pvr2fb.c| 2 +- > drivers/virt/fsl_hypervisor.c | 2 +- > drivers/xen/gntdev.c| 2 +- > fs/orangefs/orangefs-bufmap.c | 2 +- > include/linux/mm.h | 17 +- > kernel/futex.c | 2 +- > lib/iov_iter.c | 7 +- > mm/gup.c| 220 > mm/gup_benchmark.c | 5 +- > mm/util.c | 8 +- > net/ceph/pagevec.c | 2 +- > net/rds/info.c | 2 +- > net/rds/rdma.c | 3 +- > 44 files changed, 232 insertions(+), 180 deletions(-) > > -- > 2.20.1 > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next v3 3/8] net: dsa: Handle SWITCHDEV_PORT_ATTR_SET
Following patches will change the way we communicate setting a port's attribute and use notifiers towards that goal. Prepare DSA to support receiving notifier events targeting SWITCHDEV_PORT_ATTR_SET from both atomic and process context and use a small helper to translate the event notifier into something that dsa_slave_port_attr_set() can process. Signed-off-by: Florian Fainelli --- net/dsa/slave.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 7274499293c9..b089b43120e1 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -1524,6 +1524,19 @@ static int dsa_slave_netdevice_event(struct notifier_block *nb, return NOTIFY_DONE; } +static int +dsa_slave_switchdev_port_attr_set_event(struct net_device *netdev, + struct switchdev_notifier_port_attr_info *port_attr_info) +{ + int err; + + err = dsa_slave_port_attr_set(netdev, port_attr_info->attr, + port_attr_info->trans); + + port_attr_info->handled = true; + return notifier_from_errno(err); +} + struct dsa_switchdev_event_work { struct work_struct work; struct switchdev_notifier_fdb_info fdb_info; @@ -1602,6 +1615,9 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused, if (!dsa_slave_dev_check(dev)) return NOTIFY_DONE; + if (event == SWITCHDEV_PORT_ATTR_SET) + return dsa_slave_switchdev_port_attr_set_event(dev, ptr); + switchdev_work = kzalloc(sizeof(*switchdev_work), GFP_ATOMIC); if (!switchdev_work) return NOTIFY_BAD; @@ -1664,6 +1680,8 @@ static int dsa_slave_switchdev_blocking_event(struct notifier_block *unused, case SWITCHDEV_PORT_OBJ_ADD: /* fall through */ case SWITCHDEV_PORT_OBJ_DEL: return dsa_slave_switchdev_port_obj_event(event, dev, ptr); + case SWITCHDEV_PORT_ATTR_SET: + return dsa_slave_switchdev_port_attr_set_event(dev, ptr); } return NOTIFY_DONE; -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next v3 8/8] net: Remove switchdev_ops
Now that we have converted all possible callers to using a switchdev notifier for attributes we do not have a need for implementing switchdev_ops anymore, and this can be removed from all drivers the net_device structure. Signed-off-by: Florian Fainelli --- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 3 --- drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 2 -- .../mellanox/mlxsw/spectrum_switchdev.c | 12 drivers/net/ethernet/mscc/ocelot.c | 5 - drivers/net/ethernet/rocker/rocker_main.c | 5 - drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 5 - include/linux/netdevice.h | 3 --- include/net/switchdev.h | 17 - net/dsa/slave.c | 5 - 9 files changed, 57 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index b00f6f74f91a..6c797e322be8 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -3660,7 +3660,6 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port, } mlxsw_sp_port->default_vlan = mlxsw_sp_port_vlan; - mlxsw_sp_port_switchdev_init(mlxsw_sp_port); mlxsw_sp->ports[local_port] = mlxsw_sp_port; err = register_netdev(dev); if (err) { @@ -3677,7 +3676,6 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port, err_register_netdev: mlxsw_sp->ports[local_port] = NULL; - mlxsw_sp_port_switchdev_fini(mlxsw_sp_port); mlxsw_sp_port_vlan_destroy(mlxsw_sp_port_vlan); err_port_vlan_create: err_port_pvid_set: @@ -3720,7 +3718,6 @@ static void mlxsw_sp_port_remove(struct mlxsw_sp *mlxsw_sp, u8 local_port) mlxsw_core_port_clear(mlxsw_sp->core, local_port, mlxsw_sp); unregister_netdev(mlxsw_sp_port->dev); /* This calls ndo_stop */ mlxsw_sp->ports[local_port] = NULL; - mlxsw_sp_port_switchdev_fini(mlxsw_sp_port); mlxsw_sp_port_vlan_flush(mlxsw_sp_port, true); mlxsw_sp_port_nve_fini(mlxsw_sp_port); mlxsw_sp_tc_qdisc_fini(mlxsw_sp_port); diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h index a61c1130d9e3..da6278b0caa4 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h @@ -407,8 +407,6 @@ extern const struct mlxsw_sp_sb_vals mlxsw_sp2_sb_vals; /* spectrum_switchdev.c */ int mlxsw_sp_switchdev_init(struct mlxsw_sp *mlxsw_sp); void mlxsw_sp_switchdev_fini(struct mlxsw_sp *mlxsw_sp); -void mlxsw_sp_port_switchdev_init(struct mlxsw_sp_port *mlxsw_sp_port); -void mlxsw_sp_port_switchdev_fini(struct mlxsw_sp_port *mlxsw_sp_port); int mlxsw_sp_rif_fdb_op(struct mlxsw_sp *mlxsw_sp, const char *mac, u16 fid, bool adding); void diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c index c1aedfea3a31..f6ce386c3036 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c @@ -1938,10 +1938,6 @@ static struct mlxsw_sp_port *mlxsw_sp_lag_rep_port(struct mlxsw_sp *mlxsw_sp, return NULL; } -static const struct switchdev_ops mlxsw_sp_port_switchdev_ops = { - .switchdev_port_attr_set= mlxsw_sp_port_attr_set, -}; - static int mlxsw_sp_bridge_8021q_port_join(struct mlxsw_sp_bridge_device *bridge_device, struct mlxsw_sp_bridge_port *bridge_port, @@ -3545,11 +3541,3 @@ void mlxsw_sp_switchdev_fini(struct mlxsw_sp *mlxsw_sp) kfree(mlxsw_sp->bridge); } -void mlxsw_sp_port_switchdev_init(struct mlxsw_sp_port *mlxsw_sp_port) -{ - mlxsw_sp_port->dev->switchdev_ops = &mlxsw_sp_port_switchdev_ops; -} - -void mlxsw_sp_port_switchdev_fini(struct mlxsw_sp_port *mlxsw_sp_port) -{ -} diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c index 83a678b11757..a1d0d6e42533 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -1324,10 +1324,6 @@ static int ocelot_port_obj_del(struct net_device *dev, return ret; } -static const struct switchdev_ops ocelot_port_switchdev_ops = { - .switchdev_port_attr_set= ocelot_port_attr_set, -}; - static int ocelot_port_bridge_join(struct ocelot_port *ocelot_port, struct net_device *bridge) { @@ -1660,7 +1656,6 @@ int ocelot_probe_port(struct ocelot *ocelot, u8 port, dev->netdev_ops = &ocelot_port_netdev_ops; dev->ethtool_ops = &ocelot_ethtool_ops; - dev->switchdev_ops = &ocelot_port_switchdev_ops; dev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_RXFCS; dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; di
[PATCH net-next v3 6/8] staging: fsl-dpaa2: ethsw: Handle SWITCHDEV_PORT_ATTR_SET
Following patches will change the way we communicate setting a port's attribute and use a blocking notifier to perform those tasks. Prepare ethsw to support receiving notifier events targeting SWITCHDEV_PORT_ATTR_SET and simply translate that into the existing swdev_port_attr_set() call. Signed-off-by: Florian Fainelli --- drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 21 + 1 file changed, 21 insertions(+) diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c index 018399ee8731..b0d2d9bf2532 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c @@ -929,6 +929,19 @@ static const struct switchdev_ops ethsw_port_switchdev_ops = { .switchdev_port_attr_set= swdev_port_attr_set, }; +static int +ethsw_switchdev_port_attr_set_event(struct net_device *netdev, + struct switchdev_notifier_port_attr_info *port_attr_info) +{ + int err; + + err = swdev_port_attr_set(netdev, port_attr_info->attr, + port_attr_info->trans); + + port_attr_info->handled = true; + return notifier_from_errno(err); +} + /* For the moment, only flood setting needs to be updated */ static int port_bridge_join(struct net_device *netdev, struct net_device *upper_dev) @@ -1047,6 +1060,12 @@ static int port_switchdev_event(struct notifier_block *unused, struct ethsw_switchdev_event_work *switchdev_work; struct switchdev_notifier_fdb_info *fdb_info = ptr; + if (!ethsw_port_dev_check(dev)) + return NOTIFY_DONE; + + if (event == SWITCHDEV_PORT_ATTR_SET) + return ethsw_switchdev_port_attr_set_event(dev, ptr); + switchdev_work = kzalloc(sizeof(*switchdev_work), GFP_ATOMIC); if (!switchdev_work) return NOTIFY_BAD; @@ -1115,6 +1134,8 @@ static int port_switchdev_blocking_event(struct notifier_block *unused, case SWITCHDEV_PORT_OBJ_ADD: /* fall through */ case SWITCHDEV_PORT_OBJ_DEL: return ethsw_switchdev_port_obj_event(event, dev, ptr); + case SWITCHDEV_PORT_ATTR_SET: + return ethsw_switchdev_port_attr_set_event(dev, ptr); } return NOTIFY_DONE; -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next v3 7/8] net: switchdev: Replace port attr set SDO with a notification
Drop switchdev_ops.switchdev_port_attr_set. Drop the uses of this field from all clients, which were migrated to use switchdev notification in the previous patches. Add a new function switchdev_port_attr_notify() that sends the switchdev notifications SWITCHDEV_PORT_ATTR_SET and calls the blocking (process) notifier chain. We have one odd case within net/bridge/br_switchdev.c with the SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS attribute identifier that requires executing from atomic context, we deal with that one specifically. Drop __switchdev_port_attr_set() and update switchdev_port_attr_set() likewise. Signed-off-by: Florian Fainelli --- net/bridge/br_switchdev.c | 8 +- net/switchdev/switchdev.c | 53 ++- 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c index af57c4a2b78a..921310d3cbae 100644 --- a/net/bridge/br_switchdev.c +++ b/net/bridge/br_switchdev.c @@ -67,12 +67,18 @@ int br_switchdev_set_port_flag(struct net_bridge_port *p, .id = SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS, .u.brport_flags = mask, }; + struct switchdev_notifier_port_attr_info info = { + .attr = &attr, + }; int err; if (mask & ~BR_PORT_FLAGS_HW_OFFLOAD) return 0; - err = switchdev_port_attr_set(p->dev, &attr); + /* We run from atomic context here */ + err = call_switchdev_notifiers(SWITCHDEV_PORT_ATTR_SET, p->dev, + &info.info, NULL); + err = notifier_to_errno(err); if (err == -EOPNOTSUPP) return 0; diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c index 3560c19aa7e2..d81cfcee9ad9 100644 --- a/net/switchdev/switchdev.c +++ b/net/switchdev/switchdev.c @@ -174,39 +174,32 @@ static int switchdev_deferred_enqueue(struct net_device *dev, return 0; } -static int __switchdev_port_attr_set(struct net_device *dev, -const struct switchdev_attr *attr, -struct switchdev_trans *trans) +static int switchdev_port_attr_notify(enum switchdev_notifier_type nt, + struct net_device *dev, + const struct switchdev_attr *attr, + struct switchdev_trans *trans) { - const struct switchdev_ops *ops = dev->switchdev_ops; - struct net_device *lower_dev; - struct list_head *iter; - int err = -EOPNOTSUPP; - - if (ops && ops->switchdev_port_attr_set) { - err = ops->switchdev_port_attr_set(dev, attr, trans); - goto done; - } - - if (attr->flags & SWITCHDEV_F_NO_RECURSE) - goto done; + int err; + int rc; - /* Switch device port(s) may be stacked under -* bond/team/vlan dev, so recurse down to set attr on -* each port. -*/ + struct switchdev_notifier_port_attr_info attr_info = { + .attr = attr, + .trans = trans, + .handled = false, + }; - netdev_for_each_lower_dev(dev, lower_dev, iter) { - err = __switchdev_port_attr_set(lower_dev, attr, trans); - if (err) - break; + rc = call_switchdev_blocking_notifiers(nt, dev, + &attr_info.info, NULL); + err = notifier_to_errno(rc); + if (err) { + WARN_ON(!attr_info.handled); + return err; } -done: - if (err == -EOPNOTSUPP && attr->flags & SWITCHDEV_F_SKIP_EOPNOTSUPP) - err = 0; + if (!attr_info.handled) + return -EOPNOTSUPP; - return err; + return 0; } static int switchdev_port_attr_set_now(struct net_device *dev, @@ -225,7 +218,8 @@ static int switchdev_port_attr_set_now(struct net_device *dev, */ trans.ph_prepare = true; - err = __switchdev_port_attr_set(dev, attr, &trans); + err = switchdev_port_attr_notify(SWITCHDEV_PORT_ATTR_SET, dev, attr, +&trans); if (err) { /* Prepare phase failed: abort the transaction. Any * resources reserved in the prepare phase are @@ -244,7 +238,8 @@ static int switchdev_port_attr_set_now(struct net_device *dev, */ trans.ph_prepare = false; - err = __switchdev_port_attr_set(dev, attr, &trans); + err = switchdev_port_attr_notify(SWITCHDEV_PORT_ATTR_SET, dev, attr, +&trans); WARN(err, "%s: Commit of attribute (id=%d) failed.\n", dev->name, attr->id); switchdev_trans_items_warn_destroy(dev, &trans); -- 2.17.1 ___ devel mailing list de...@linuxdriverp
[PATCH net-next v3 5/8] net: mscc: ocelot: Handle SWITCHDEV_PORT_ATTR_SET
Following patches will change the way we communicate setting a port's attribute and use notifiers to perform those tasks. Ocelot does not currently have an atomic notifier registered for switchdev events, so we need to register one in order to deal with atomic context SWITCHDEV_PORT_ATTR_SET events. Signed-off-by: Florian Fainelli --- drivers/net/ethernet/mscc/ocelot.c | 27 drivers/net/ethernet/mscc/ocelot.h | 1 + drivers/net/ethernet/mscc/ocelot_board.c | 2 ++ 3 files changed, 30 insertions(+) diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c index 195306d05bcd..83a678b11757 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -1582,6 +1582,28 @@ struct notifier_block ocelot_netdevice_nb __read_mostly = { }; EXPORT_SYMBOL(ocelot_netdevice_nb); +static int ocelot_switchdev_event(struct notifier_block *unused, + unsigned long event, void *ptr) +{ + struct net_device *dev = switchdev_notifier_info_to_dev(ptr); + int err; + + switch (event) { + case SWITCHDEV_PORT_ATTR_SET: + err = switchdev_handle_port_attr_set(dev, ptr, +ocelot_netdevice_dev_check, +ocelot_port_attr_set); + return notifier_from_errno(err); + } + + return NOTIFY_DONE; +} + +struct notifier_block ocelot_switchdev_nb __read_mostly = { + .notifier_call = ocelot_switchdev_event, +}; +EXPORT_SYMBOL(ocelot_switchdev_nb); + static int ocelot_switchdev_blocking_event(struct notifier_block *unused, unsigned long event, void *ptr) { @@ -1600,6 +1622,11 @@ static int ocelot_switchdev_blocking_event(struct notifier_block *unused, ocelot_netdevice_dev_check, ocelot_port_obj_del); return notifier_from_errno(err); + case SWITCHDEV_PORT_ATTR_SET: + err = switchdev_handle_port_attr_set(dev, ptr, +ocelot_netdevice_dev_check, +ocelot_port_attr_set); + return notifier_from_errno(err); } return NOTIFY_DONE; diff --git a/drivers/net/ethernet/mscc/ocelot.h b/drivers/net/ethernet/mscc/ocelot.h index 086775f7b52f..ba3b3380b4d0 100644 --- a/drivers/net/ethernet/mscc/ocelot.h +++ b/drivers/net/ethernet/mscc/ocelot.h @@ -499,6 +499,7 @@ int ocelot_probe_port(struct ocelot *ocelot, u8 port, struct phy_device *phy); extern struct notifier_block ocelot_netdevice_nb; +extern struct notifier_block ocelot_switchdev_nb; extern struct notifier_block ocelot_switchdev_blocking_nb; #endif diff --git a/drivers/net/ethernet/mscc/ocelot_board.c b/drivers/net/ethernet/mscc/ocelot_board.c index ca3ea2fbfcd0..2c1121d86edf 100644 --- a/drivers/net/ethernet/mscc/ocelot_board.c +++ b/drivers/net/ethernet/mscc/ocelot_board.c @@ -329,6 +329,7 @@ static int mscc_ocelot_probe(struct platform_device *pdev) } register_netdevice_notifier(&ocelot_netdevice_nb); + register_switchdev_notifier(&ocelot_switchdev_nb); register_switchdev_blocking_notifier(&ocelot_switchdev_blocking_nb); dev_info(&pdev->dev, "Ocelot switch probed\n"); @@ -345,6 +346,7 @@ static int mscc_ocelot_remove(struct platform_device *pdev) ocelot_deinit(ocelot); unregister_switchdev_blocking_notifier(&ocelot_switchdev_blocking_nb); + unregister_switchdev_notifier(&ocelot_switchdev_nb); unregister_netdevice_notifier(&ocelot_netdevice_nb); return 0; -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next v3 4/8] mlxsw: spectrum_switchdev: Handle SWITCHDEV_PORT_ATTR_SET
Following patches will change the way we communicate setting a port's attribute and use a notifier to perform those tasks. Prepare mlxsw to support receiving notifier events targeting SWITCHDEV_PORT_ATTR_SET and utilize the switchdev_handle_port_attr_set() to handle stacking of devices. Reviewed-by: Ido Schimmel Signed-off-by: Florian Fainelli --- .../net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c index 766f5b5f1cf5..c1aedfea3a31 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c @@ -3123,6 +3123,13 @@ static int mlxsw_sp_switchdev_event(struct notifier_block *unused, struct net_device *br_dev; int err; + if (event == SWITCHDEV_PORT_ATTR_SET) { + err = switchdev_handle_port_attr_set(dev, ptr, +mlxsw_sp_port_dev_check, +mlxsw_sp_port_attr_set); + return notifier_from_errno(err); + } + /* Tunnel devices are not our uppers, so check their master instead */ br_dev = netdev_master_upper_dev_get_rcu(dev); if (!br_dev) @@ -3446,6 +3453,11 @@ static int mlxsw_sp_switchdev_blocking_event(struct notifier_block *unused, mlxsw_sp_port_dev_check, mlxsw_sp_port_obj_del); return notifier_from_errno(err); + case SWITCHDEV_PORT_ATTR_SET: + err = switchdev_handle_port_attr_set(dev, ptr, +mlxsw_sp_port_dev_check, +mlxsw_sp_port_attr_set); + return notifier_from_errno(err); } return NOTIFY_DONE; -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next v3 0/8] net: Remove switchdev_ops
Hi all, This patch series completes the removal of the switchdev_ops by converting switchdev_port_attr_set() to use either the blocking (process) or non-blocking (atomic) notifier since we typically need to deal with both depending on where in the bridge code we get called from. This was tested with the forwarding selftests and DSA hardware. Ido, hopefully this captures your comments done on v1, if not, can you illustrate with some pseudo-code what you had in mind if that's okay? Changes in v3: - added Reviewed-by tags from Ido where relevant - added missing notifier_to_errno() in net/bridge/br_switchdev.c when calling the atomic notifier for PRE_BRIDGE_FLAGS - kept mlxsw_sp_switchdev_init() in mlxsw/ Changes in v2: - do not check for SWITCHDEV_F_DEFER when calling the blocking notifier and instead directly call the atomic notifier from the single location where this is required Florian Fainelli (8): switchdev: Add SWITCHDEV_PORT_ATTR_SET rocker: Handle SWITCHDEV_PORT_ATTR_SET net: dsa: Handle SWITCHDEV_PORT_ATTR_SET mlxsw: spectrum_switchdev: Handle SWITCHDEV_PORT_ATTR_SET net: mscc: ocelot: Handle SWITCHDEV_PORT_ATTR_SET staging: fsl-dpaa2: ethsw: Handle SWITCHDEV_PORT_ATTR_SET net: switchdev: Replace port attr set SDO with a notification net: Remove switchdev_ops .../net/ethernet/mellanox/mlxsw/spectrum.c| 3 - .../net/ethernet/mellanox/mlxsw/spectrum.h| 2 - .../mellanox/mlxsw/spectrum_switchdev.c | 24 ++-- drivers/net/ethernet/mscc/ocelot.c| 32 +- drivers/net/ethernet/mscc/ocelot.h| 1 + drivers/net/ethernet/mscc/ocelot_board.c | 2 + drivers/net/ethernet/rocker/rocker_main.c | 23 +++- drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 24 +++- include/linux/netdevice.h | 3 - include/net/switchdev.h | 38 --- net/bridge/br_switchdev.c | 8 +- net/dsa/slave.c | 23 +++- net/switchdev/switchdev.c | 104 +- 13 files changed, 204 insertions(+), 83 deletions(-) -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next v3 2/8] rocker: Handle SWITCHDEV_PORT_ATTR_SET
Following patches will change the way we communicate setting a port's attribute and use notifiers towards that goal. Prepare rocker to support receiving notifier events targeting SWITCHDEV_PORT_ATTR_SET from both atomic and process context and use a small helper to translate the event notifier into something that rocker_port_attr_set() can process. Signed-off-by: Florian Fainelli --- drivers/net/ethernet/rocker/rocker_main.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/drivers/net/ethernet/rocker/rocker_main.c b/drivers/net/ethernet/rocker/rocker_main.c index 309a6bf9130c..fc772cf079cc 100644 --- a/drivers/net/ethernet/rocker/rocker_main.c +++ b/drivers/net/ethernet/rocker/rocker_main.c @@ -2710,6 +2710,19 @@ static bool rocker_port_dev_check(const struct net_device *dev) return dev->netdev_ops == &rocker_port_netdev_ops; } +static int +rocker_switchdev_port_attr_set_event(struct net_device *netdev, + struct switchdev_notifier_port_attr_info *port_attr_info) +{ + int err; + + err = rocker_port_attr_set(netdev, port_attr_info->attr, + port_attr_info->trans); + + port_attr_info->handled = true; + return notifier_from_errno(err); +} + struct rocker_switchdev_event_work { struct work_struct work; struct switchdev_notifier_fdb_info fdb_info; @@ -2779,6 +2792,9 @@ static int rocker_switchdev_event(struct notifier_block *unused, if (!rocker_port_dev_check(dev)) return NOTIFY_DONE; + if (event == SWITCHDEV_PORT_ATTR_SET) + return rocker_switchdev_port_attr_set_event(dev, ptr); + rocker_port = netdev_priv(dev); switchdev_work = kzalloc(sizeof(*switchdev_work), GFP_ATOMIC); if (WARN_ON(!switchdev_work)) @@ -2841,6 +2857,8 @@ static int rocker_switchdev_blocking_event(struct notifier_block *unused, case SWITCHDEV_PORT_OBJ_ADD: case SWITCHDEV_PORT_OBJ_DEL: return rocker_switchdev_port_obj_event(event, dev, ptr); + case SWITCHDEV_PORT_ATTR_SET: + return rocker_switchdev_port_attr_set_event(dev, ptr); } return NOTIFY_DONE; -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next v3 1/8] switchdev: Add SWITCHDEV_PORT_ATTR_SET
In preparation for allowing switchdev enabled drivers to veto specific attribute settings from within the context of the caller, introduce a new switchdev notifier type for port attributes. Suggested-by: Ido Schimmel Reviewed-by: Ido Schimmel Signed-off-by: Florian Fainelli --- include/net/switchdev.h | 27 + net/switchdev/switchdev.c | 51 +++ 2 files changed, 78 insertions(+) diff --git a/include/net/switchdev.h b/include/net/switchdev.h index be4b13e8..5087c06ceb4b 100644 --- a/include/net/switchdev.h +++ b/include/net/switchdev.h @@ -132,6 +132,7 @@ enum switchdev_notifier_type { SWITCHDEV_PORT_OBJ_ADD, /* Blocking. */ SWITCHDEV_PORT_OBJ_DEL, /* Blocking. */ + SWITCHDEV_PORT_ATTR_SET, /* May be blocking . */ SWITCHDEV_VXLAN_FDB_ADD_TO_BRIDGE, SWITCHDEV_VXLAN_FDB_DEL_TO_BRIDGE, @@ -160,6 +161,13 @@ struct switchdev_notifier_port_obj_info { bool handled; }; +struct switchdev_notifier_port_attr_info { + struct switchdev_notifier_info info; /* must be first */ + const struct switchdev_attr *attr; + struct switchdev_trans *trans; + bool handled; +}; + static inline struct net_device * switchdev_notifier_info_to_dev(const struct switchdev_notifier_info *info) { @@ -212,7 +220,15 @@ int switchdev_handle_port_obj_del(struct net_device *dev, int (*del_cb)(struct net_device *dev, const struct switchdev_obj *obj)); +int switchdev_handle_port_attr_set(struct net_device *dev, + struct switchdev_notifier_port_attr_info *port_attr_info, + bool (*check_cb)(const struct net_device *dev), + int (*set_cb)(struct net_device *dev, + const struct switchdev_attr *attr, + struct switchdev_trans *trans)); + #define SWITCHDEV_SET_OPS(netdev, ops) ((netdev)->switchdev_ops = (ops)) + #else static inline void switchdev_deferred_process(void) @@ -299,6 +315,17 @@ switchdev_handle_port_obj_del(struct net_device *dev, return 0; } +static inline int +switchdev_handle_port_attr_set(struct net_device *dev, + struct switchdev_notifier_port_attr_info *port_attr_info, + bool (*check_cb)(const struct net_device *dev), + int (*set_cb)(struct net_device *dev, + const struct switchdev_attr *attr, + struct switchdev_trans *trans)) +{ + return 0; +} + #define SWITCHDEV_SET_OPS(netdev, ops) do {} while (0) #endif diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c index 362413c9b389..3560c19aa7e2 100644 --- a/net/switchdev/switchdev.c +++ b/net/switchdev/switchdev.c @@ -655,3 +655,54 @@ int switchdev_handle_port_obj_del(struct net_device *dev, return err; } EXPORT_SYMBOL_GPL(switchdev_handle_port_obj_del); + +static int __switchdev_handle_port_attr_set(struct net_device *dev, + struct switchdev_notifier_port_attr_info *port_attr_info, + bool (*check_cb)(const struct net_device *dev), + int (*set_cb)(struct net_device *dev, + const struct switchdev_attr *attr, + struct switchdev_trans *trans)) +{ + struct net_device *lower_dev; + struct list_head *iter; + int err = -EOPNOTSUPP; + + if (check_cb(dev)) { + port_attr_info->handled = true; + return set_cb(dev, port_attr_info->attr, + port_attr_info->trans); + } + + /* Switch ports might be stacked under e.g. a LAG. Ignore the +* unsupported devices, another driver might be able to handle them. But +* propagate to the callers any hard errors. +* +* If the driver does its own bookkeeping of stacked ports, it's not +* necessary to go through this helper. +*/ + netdev_for_each_lower_dev(dev, lower_dev, iter) { + err = __switchdev_handle_port_attr_set(lower_dev, port_attr_info, + check_cb, set_cb); + if (err && err != -EOPNOTSUPP) + return err; + } + + return err; +} + +int switchdev_handle_port_attr_set(struct net_device *dev, + struct switchdev_notifier_port_attr_info *port_attr_info, + bool (*check_cb)(const struct net_device *dev), + int (*set_cb)(struct net_device *dev, + const struct switchdev_attr *attr, + struct switchdev_trans *trans)) +{ + int err; + + err = __switchdev_handle_port_attr_set(dev, port_attr_info, check_cb, +
[PATCH] staging: mt7621-pci: Tidy whitespace
Fix missing whitespace around punctuation and beginning-of-line spaces in pci-mt7621.c. Signed-off-by: Mikhail Gusarov --- drivers/staging/mt7621-pci/pci-mt7621.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging/mt7621-pci/pci-mt7621.c index 31310b6fb7db..3acad44a921e 100644 --- a/drivers/staging/mt7621-pci/pci-mt7621.c +++ b/drivers/staging/mt7621-pci/pci-mt7621.c @@ -90,7 +90,7 @@ #define PCIE_CLK_GEN_ENBIT(31) #define PCIE_CLK_GEN_DIS 0 -#define PCIE_CLK_GEN1_DIS GENMASK(30,24) +#define PCIE_CLK_GEN1_DIS GENMASK(30, 24) #define PCIE_CLK_GEN1_EN (BIT(27) | BIT(25)) #define RALINK_PCI_IO_MAP_BASE 0x1e16 #define MEMORY_BASE0x0 @@ -714,7 +714,7 @@ static void mt7621_pcie_enable_ports(struct mt7621_pcie *pcie) static int mt7621_pcie_init_virtual_bridges(struct mt7621_pcie *pcie) { u32 pcie_link_status = 0; - u32 val= 0; + u32 val = 0; struct mt7621_pcie_port *port; list_for_each_entry(port, &pcie->ports, list) { @@ -734,7 +734,7 @@ static int mt7621_pcie_init_virtual_bridges(struct mt7621_pcie *pcie) * 3'b010 x0 x * 3'b011 x1 0 * 3'b100 0x x -* 3'b101 1x 0 +* 3'b101 1x 0 * 3'b110 10 x * 3'b111 21 0 */ -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: mt7621-pci: Tidy whitespace
Hi Mikhail, On Wed, Feb 27, 2019 at 8:54 PM Mikhail Gusarov wrote: > > Fix missing whitespace around punctuation and beginning-of-line spaces > in pci-mt7621.c. > > Signed-off-by: Mikhail Gusarov > --- > drivers/staging/mt7621-pci/pci-mt7621.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c > b/drivers/staging/mt7621-pci/pci-mt7621.c > index 31310b6fb7db..3acad44a921e 100644 > --- a/drivers/staging/mt7621-pci/pci-mt7621.c > +++ b/drivers/staging/mt7621-pci/pci-mt7621.c > @@ -90,7 +90,7 @@ > > #define PCIE_CLK_GEN_ENBIT(31) > #define PCIE_CLK_GEN_DIS 0 > -#define PCIE_CLK_GEN1_DIS GENMASK(30,24) > +#define PCIE_CLK_GEN1_DIS GENMASK(30, 24) > #define PCIE_CLK_GEN1_EN (BIT(27) | BIT(25)) > #define RALINK_PCI_IO_MAP_BASE 0x1e16 > #define MEMORY_BASE0x0 > @@ -714,7 +714,7 @@ static void mt7621_pcie_enable_ports(struct mt7621_pcie > *pcie) > static int mt7621_pcie_init_virtual_bridges(struct mt7621_pcie *pcie) > { > u32 pcie_link_status = 0; > - u32 val= 0; > + u32 val = 0; > struct mt7621_pcie_port *port; > > list_for_each_entry(port, &pcie->ports, list) { > @@ -734,7 +734,7 @@ static int mt7621_pcie_init_virtual_bridges(struct > mt7621_pcie *pcie) > * 3'b010 x0 x > * 3'b011 x1 0 > * 3'b100 0x x > -* 3'b101 1x 0 > +* 3'b101 1x 0 > * 3'b110 10 x > * 3'b111 21 0 > */ > -- > 2.11.0 > This changes are currently in staging tree :(. Please, use this kernel tree for staging drivers to get access to the latest changes. Thanks, Sergio Paracuellos ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH net-next v3 7/8] net: switchdev: Replace port attr set SDO with a notification
On Wed, Feb 27, 2019 at 11:44:31AM -0800, Florian Fainelli wrote: > Drop switchdev_ops.switchdev_port_attr_set. Drop the uses of this field > from all clients, which were migrated to use switchdev notification in > the previous patches. > > Add a new function switchdev_port_attr_notify() that sends the switchdev > notifications SWITCHDEV_PORT_ATTR_SET and calls the blocking (process) > notifier chain. > > We have one odd case within net/bridge/br_switchdev.c with the > SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS attribute identifier that > requires executing from atomic context, we deal with that one > specifically. > > Drop __switchdev_port_attr_set() and update switchdev_port_attr_set() > likewise. > > Signed-off-by: Florian Fainelli Reviewed-by: Ido Schimmel One small nit that you can address in a follow-up: > @@ -67,12 +67,18 @@ int br_switchdev_set_port_flag(struct net_bridge_port *p, > .id = SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS, > .u.brport_flags = mask, > }; > + struct switchdev_notifier_port_attr_info info = { > + .attr = &attr, > + }; > int err; > > if (mask & ~BR_PORT_FLAGS_HW_OFFLOAD) > return 0; > > - err = switchdev_port_attr_set(p->dev, &attr); > + /* We run from atomic context here */ > + err = call_switchdev_notifiers(SWITCHDEV_PORT_ATTR_SET, p->dev, > +&info.info, NULL); > + err = notifier_to_errno(err); > if (err == -EOPNOTSUPP) > return 0; This check can be removed. The code below checks `err` and fails the operation in case of error. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH net-next v3 8/8] net: Remove switchdev_ops
On Wed, Feb 27, 2019 at 11:44:32AM -0800, Florian Fainelli wrote: > Now that we have converted all possible callers to using a switchdev > notifier for attributes we do not have a need for implementing > switchdev_ops anymore, and this can be removed from all drivers the > net_device structure. > > Signed-off-by: Florian Fainelli Reviewed-by: Ido Schimmel ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH net-next v3 0/8] net: Remove switchdev_ops
On Wed, Feb 27, 2019 at 11:44:24AM -0800, Florian Fainelli wrote: > Hi all, > > This patch series completes the removal of the switchdev_ops by > converting switchdev_port_attr_set() to use either the blocking > (process) or non-blocking (atomic) notifier since we typically need to > deal with both depending on where in the bridge code we get called from. > > This was tested with the forwarding selftests and DSA hardware. I ran some basic tests and nothing exploded :) Thanks, Florian! ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/2] staging: rtl8188eu: remove unused P2P_PRIVATE_IOCTL_SET_LEN
Defined P2P_PRIVATE_IOCTL_SET_LEN is not used in the driver code, so remove it from wifi.h. Signed-off-by: Michael Straube --- drivers/staging/rtl8188eu/include/wifi.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/rtl8188eu/include/wifi.h b/drivers/staging/rtl8188eu/include/wifi.h index 873aea9cf83a..5e91b9428c16 100644 --- a/drivers/staging/rtl8188eu/include/wifi.h +++ b/drivers/staging/rtl8188eu/include/wifi.h @@ -791,8 +791,6 @@ enum ht_cap_ampdu_factor { #defineWPS_CM_SW_DISPLAY_P 0x2008 #defineWPS_CM_LCD_DISPLAY_P0x4008 -#defineP2P_PRIVATE_IOCTL_SET_LEN 64 - /* =WFD Section= */ /* For Wi-Fi Display */ #defineWFD_ATTR_DEVICE_INFO0x00 -- 2.21.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/2] staging: rtl8188eu: remove unused enum P2P_PROTO_WK_ID
Enumeration P2P_PROTO_WK_ID is not used in the driver code, so remove it from wifi.h. Signed-off-by: Michael Straube --- drivers/staging/rtl8188eu/include/wifi.h | 10 -- 1 file changed, 10 deletions(-) diff --git a/drivers/staging/rtl8188eu/include/wifi.h b/drivers/staging/rtl8188eu/include/wifi.h index 0664d5f30a96..873aea9cf83a 100644 --- a/drivers/staging/rtl8188eu/include/wifi.h +++ b/drivers/staging/rtl8188eu/include/wifi.h @@ -793,16 +793,6 @@ enum ht_cap_ampdu_factor { #defineP2P_PRIVATE_IOCTL_SET_LEN 64 -enum P2P_PROTO_WK_ID { - P2P_FIND_PHASE_WK = 0, - P2P_RESTORE_STATE_WK = 1, - P2P_PRE_TX_PROVDISC_PROCESS_WK = 2, - P2P_PRE_TX_NEGOREQ_PROCESS_WK = 3, - P2P_PRE_TX_INVITEREQ_PROCESS_WK = 4, - P2P_AP_P2P_CH_SWITCH_PROCESS_WK = 5, - P2P_RO_CH_WK = 6, -}; - /* =WFD Section= */ /* For Wi-Fi Display */ #defineWFD_ATTR_DEVICE_INFO0x00 -- 2.21.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH net-next v3 0/8] net: Remove switchdev_ops
From: Florian Fainelli Date: Wed, 27 Feb 2019 11:44:24 -0800 > This patch series completes the removal of the switchdev_ops by > converting switchdev_port_attr_set() to use either the blocking > (process) or non-blocking (atomic) notifier since we typically need to > deal with both depending on where in the bridge code we get called from. > > This was tested with the forwarding selftests and DSA hardware. > > Ido, hopefully this captures your comments done on v1, if not, can you > illustrate with some pseudo-code what you had in mind if that's okay? > > Changes in v3: > > - added Reviewed-by tags from Ido where relevant > - added missing notifier_to_errno() in net/bridge/br_switchdev.c when > calling the atomic notifier for PRE_BRIDGE_FLAGS > - kept mlxsw_sp_switchdev_init() in mlxsw/ > > Changes in v2: > > - do not check for SWITCHDEV_F_DEFER when calling the blocking notifier > and instead directly call the atomic notifier from the single location > where this is required Series applied, thanks Florian. I'll push this out after my build tests complete. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next] switchdev: Remove unused transaction item queue
There are no more in tree users of the switchdev_trans_item_{dequeue,enqueue} or switchdev_trans_item structure in the kernel since commit 00fc0c51e35b ("rocker: Change world_ops API and implementation to be switchdev independant"). Remove this unused code and update the documentation accordingly since. Signed-off-by: Florian Fainelli --- Documentation/networking/switchdev.txt | 19 - include/net/switchdev.h| 12 --- net/switchdev/switchdev.c | 100 + 3 files changed, 2 insertions(+), 129 deletions(-) diff --git a/Documentation/networking/switchdev.txt b/Documentation/networking/switchdev.txt index 633dd1fd81b7..86174ce8cd13 100644 --- a/Documentation/networking/switchdev.txt +++ b/Documentation/networking/switchdev.txt @@ -371,22 +371,3 @@ The driver can monitor for updates to arp_tbl using the netevent notifier NETEVENT_NEIGH_UPDATE. The device can be programmed with resolved nexthops for the routes as arp_tbl updates. The driver implements ndo_neigh_destroy to know when arp_tbl neighbor entries are purged from the port. - -Transaction item queue -^^ - -For switchdev ops attr_set and obj_add, there is a 2 phase transaction model -used. First phase is to "prepare" anything needed, including various checks, -memory allocation, etc. The goal is to handle the stuff that is not unlikely -to fail here. The second phase is to "commit" the actual changes. - -Switchdev provides an infrastructure for sharing items (for example memory -allocations) between the two phases. - -The object created by a driver in "prepare" phase and it is queued up by: -switchdev_trans_item_enqueue() -During the "commit" phase, the driver gets the object by: -switchdev_trans_item_dequeue() - -If a transaction is aborted during "prepare" phase, switchdev code will handle -cleanup of the queued-up objects. diff --git a/include/net/switchdev.h b/include/net/switchdev.h index e4f751e19ecf..0ebd67ae7012 100644 --- a/include/net/switchdev.h +++ b/include/net/switchdev.h @@ -20,14 +20,7 @@ #define SWITCHDEV_F_SKIP_EOPNOTSUPPBIT(1) #define SWITCHDEV_F_DEFER BIT(2) -struct switchdev_trans_item { - struct list_head list; - void *data; - void (*destructor)(const void *data); -}; - struct switchdev_trans { - struct list_head item_list; bool ph_prepare; }; @@ -105,11 +98,6 @@ struct switchdev_obj_port_mdb { #define SWITCHDEV_OBJ_PORT_MDB(OBJ) \ container_of((OBJ), struct switchdev_obj_port_mdb, obj) -void switchdev_trans_item_enqueue(struct switchdev_trans *trans, - void *data, void (*destructor)(void const *), - struct switchdev_trans_item *tritem); -void *switchdev_trans_item_dequeue(struct switchdev_trans *trans); - typedef int switchdev_obj_dump_cb_t(struct switchdev_obj *obj); enum switchdev_notifier_type { diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c index d81cfcee9ad9..90ba4a1f0a6d 100644 --- a/net/switchdev/switchdev.c +++ b/net/switchdev/switchdev.c @@ -23,78 +23,6 @@ #include #include -/** - * switchdev_trans_item_enqueue - Enqueue data item to transaction queue - * - * @trans: transaction - * @data: pointer to data being queued - * @destructor: data destructor - * @tritem: transaction item being queued - * - * Enqeueue data item to transaction queue. tritem is typically placed in - * cointainter pointed at by data pointer. Destructor is called on - * transaction abort and after successful commit phase in case - * the caller did not dequeue the item before. - */ -void switchdev_trans_item_enqueue(struct switchdev_trans *trans, - void *data, void (*destructor)(void const *), - struct switchdev_trans_item *tritem) -{ - tritem->data = data; - tritem->destructor = destructor; - list_add_tail(&tritem->list, &trans->item_list); -} -EXPORT_SYMBOL_GPL(switchdev_trans_item_enqueue); - -static struct switchdev_trans_item * -__switchdev_trans_item_dequeue(struct switchdev_trans *trans) -{ - struct switchdev_trans_item *tritem; - - if (list_empty(&trans->item_list)) - return NULL; - tritem = list_first_entry(&trans->item_list, - struct switchdev_trans_item, list); - list_del(&tritem->list); - return tritem; -} - -/** - * switchdev_trans_item_dequeue - Dequeue data item from transaction queue - * - * @trans: transaction - */ -void *switchdev_trans_item_dequeue(struct switchdev_trans *trans) -{ - struct switchdev_trans_item *tritem; - - tritem = __switchdev_trans_item_dequeue(trans); - BUG_ON(!tritem); - return tritem->data; -} -EXPORT_SYMBOL_GPL(switchdev_trans_item_dequeue); - -static void switchdev_trans_init(struct switchdev_trans *trans) -{ - INIT_LIST_HEAD(&trans->item_
Re: [PATCH net-next] switchdev: Remove unused transaction item queue
Thu, Feb 28, 2019 at 01:29:16AM CET, f.faine...@gmail.com wrote: >There are no more in tree users of the >switchdev_trans_item_{dequeue,enqueue} or switchdev_trans_item structure >in the kernel since commit 00fc0c51e35b ("rocker: Change world_ops API >and implementation to be switchdev independant"). > >Remove this unused code and update the documentation accordingly since. > >Signed-off-by: Florian Fainelli Acked-by: Jiri Pirko ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel