Changes in 4.9.225 igb: use igb_adapter->io_addr instead of e1000_hw->hw_addr padata: Remove unused but set variables padata: get_next is never NULL padata: ensure the reorder timer callback runs on the correct CPU padata: ensure padata_do_serial() runs on the correct CPU evm: Check also if *tfm is an error pointer in init_desc() ima: Fix return value of ima_write_policy() fix multiplication overflow in copy_fdtable() iommu/amd: Fix over-read of ACPI UID from IVRS table i2c: mux: demux-pinctrl: Fix an error handling path in 'i2c_demux_pinctrl_probe()' gcc-common.h: Update for GCC 10 HID: multitouch: add eGalaxTouch P80H84 support configfs: fix config_item refcnt leak in configfs_rmdir() component: Silence bind error on -EPROBE_DEFER gtp: set NLM_F_MULTI flag in gtp_genl_dump_pdp() ceph: fix double unlock in handle_cap_export() USB: core: Fix misleading driver bug report platform/x86: asus-nb-wmi: Do not load on Asus T100TA and T200TA ARM: futex: Address build warning i2c: dev: Fix the race between the release of i2c_dev and cdev padata: set cpu_index of unused CPUs to -1 padata: Replace delayed timer with immediate workqueue in padata_reorder padata: initialize pd->cpu with effective cpumask padata: purge get_cpu and reorder_via_wq from padata_do_serial arm64: fix the flush_icache_range arguments in machine_kexec watchdog: Fix the race between the release of watchdog_core_data and cdev net: l2tp: export debug flags to UAPI net: l2tp: deprecate PPPOL2TP_MSG_* in favour of L2TP_MSG_* net: l2tp: ppp: change PPPOL2TP_MSG_* => L2TP_MSG_* New kernel function to get IP overhead on a socket. L2TP:Adjust intf MTU, add underlay L3, L2 hdrs. l2tp: remove useless duplicate session detection in l2tp_netlink l2tp: remove l2tp_session_find() l2tp: define parameters of l2tp_session_get*() as "const" l2tp: define parameters of l2tp_tunnel_find*() as "const" l2tp: initialise session's refcount before making it reachable l2tp: hold tunnel while looking up sessions in l2tp_netlink l2tp: hold tunnel while processing genl delete command l2tp: hold tunnel while handling genl tunnel updates l2tp: hold tunnel while handling genl TUNNEL_GET commands l2tp: hold tunnel used while creating sessions with netlink l2tp: prevent creation of sessions on terminated tunnels l2tp: pass tunnel pointer to ->session_create() l2tp: fix l2tp_eth module loading l2tp: don't register sessions in l2tp_session_create() l2tp: initialise l2tp_eth sessions before registering them l2tp: protect sock pointer of struct pppol2tp_session with RCU l2tp: initialise PPP sessions before registering them ALSA: pcm: fix incorrect hw_base increase dmaengine: tegra210-adma: Fix an error handling path in 'tegra_adma_probe()' l2tp: device MTU setup, tunnel socket needs a lock x86/uaccess, ubsan: Fix UBSAN vs. SMAP ubsan: build ubsan.c more conservatively platform/x86: alienware-wmi: fix kfree on potentially uninitialized pointer libnvdimm/btt: Remove unnecessary code in btt_freelist_init cxgb4: free mac_hlist properly cxgb4/cxgb4vf: Fix mac_hlist initialization and free Revert "gfs2: Don't demote a glock until its revokes are written" staging: iio: ad2s1210: Fix SPI reading staging: greybus: Fix uninitialized scalar variable iio: dac: vf610: Fix an error handling path in 'vf610_dac_probe()' mei: release me_cl object reference rapidio: fix an error in get_user_pages_fast() error handling iio: sca3000: Remove an erroneous 'get_device()' Linux 4.9.225 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: I5183590d1e0ef7ea6623cf70c753ea169d0fd8a1
184 lines
6.0 KiB
C
184 lines
6.0 KiB
C
/*
|
|
* padata.h - header for the padata parallelization interface
|
|
*
|
|
* Copyright (C) 2008, 2009 secunet Security Networks AG
|
|
* Copyright (C) 2008, 2009 Steffen Klassert <steffen.klassert@secunet.com>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms and conditions of the GNU General Public License,
|
|
* version 2, as published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
* more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along with
|
|
* this program; if not, write to the Free Software Foundation, Inc.,
|
|
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
|
*/
|
|
|
|
#ifndef PADATA_H
|
|
#define PADATA_H
|
|
|
|
#include <linux/workqueue.h>
|
|
#include <linux/spinlock.h>
|
|
#include <linux/list.h>
|
|
#include <linux/notifier.h>
|
|
#include <linux/kobject.h>
|
|
|
|
#define PADATA_CPU_SERIAL 0x01
|
|
#define PADATA_CPU_PARALLEL 0x02
|
|
|
|
/**
|
|
* struct padata_priv - Embedded to the users data structure.
|
|
*
|
|
* @list: List entry, to attach to the padata lists.
|
|
* @pd: Pointer to the internal control structure.
|
|
* @cb_cpu: Callback cpu for serializatioon.
|
|
* @cpu: Cpu for parallelization.
|
|
* @seq_nr: Sequence number of the parallelized data object.
|
|
* @info: Used to pass information from the parallel to the serial function.
|
|
* @parallel: Parallel execution function.
|
|
* @serial: Serial complete function.
|
|
*/
|
|
struct padata_priv {
|
|
struct list_head list;
|
|
struct parallel_data *pd;
|
|
int cb_cpu;
|
|
int cpu;
|
|
int info;
|
|
void (*parallel)(struct padata_priv *padata);
|
|
void (*serial)(struct padata_priv *padata);
|
|
};
|
|
|
|
/**
|
|
* struct padata_list
|
|
*
|
|
* @list: List head.
|
|
* @lock: List lock.
|
|
*/
|
|
struct padata_list {
|
|
struct list_head list;
|
|
spinlock_t lock;
|
|
};
|
|
|
|
/**
|
|
* struct padata_serial_queue - The percpu padata serial queue
|
|
*
|
|
* @serial: List to wait for serialization after reordering.
|
|
* @work: work struct for serialization.
|
|
* @pd: Backpointer to the internal control structure.
|
|
*/
|
|
struct padata_serial_queue {
|
|
struct padata_list serial;
|
|
struct work_struct work;
|
|
struct parallel_data *pd;
|
|
};
|
|
|
|
/**
|
|
* struct padata_parallel_queue - The percpu padata parallel queue
|
|
*
|
|
* @parallel: List to wait for parallelization.
|
|
* @reorder: List to wait for reordering after parallel processing.
|
|
* @serial: List to wait for serialization after reordering.
|
|
* @pwork: work struct for parallelization.
|
|
* @swork: work struct for serialization.
|
|
* @work: work struct for parallelization.
|
|
* @num_obj: Number of objects that are processed by this cpu.
|
|
* @cpu_index: Index of the cpu.
|
|
*/
|
|
struct padata_parallel_queue {
|
|
struct padata_list parallel;
|
|
struct padata_list reorder;
|
|
struct work_struct work;
|
|
atomic_t num_obj;
|
|
int cpu_index;
|
|
};
|
|
|
|
/**
|
|
* struct padata_cpumask - The cpumasks for the parallel/serial workers
|
|
*
|
|
* @pcpu: cpumask for the parallel workers.
|
|
* @cbcpu: cpumask for the serial (callback) workers.
|
|
*/
|
|
struct padata_cpumask {
|
|
cpumask_var_t pcpu;
|
|
cpumask_var_t cbcpu;
|
|
};
|
|
|
|
/**
|
|
* struct parallel_data - Internal control structure, covers everything
|
|
* that depends on the cpumask in use.
|
|
*
|
|
* @pinst: padata instance.
|
|
* @pqueue: percpu padata queues used for parallelization.
|
|
* @squeue: percpu padata queues used for serialuzation.
|
|
* @reorder_objects: Number of objects waiting in the reorder queues.
|
|
* @refcnt: Number of objects holding a reference on this parallel_data.
|
|
* @max_seq_nr: Maximal used sequence number.
|
|
* @cpu: Next CPU to be processed.
|
|
* @cpumask: The cpumasks in use for parallel and serial workers.
|
|
* @reorder_work: work struct for reordering.
|
|
* @lock: Reorder lock.
|
|
*/
|
|
struct parallel_data {
|
|
struct padata_instance *pinst;
|
|
struct padata_parallel_queue __percpu *pqueue;
|
|
struct padata_serial_queue __percpu *squeue;
|
|
atomic_t reorder_objects;
|
|
atomic_t refcnt;
|
|
atomic_t seq_nr;
|
|
int cpu;
|
|
struct padata_cpumask cpumask;
|
|
struct work_struct reorder_work;
|
|
spinlock_t lock ____cacheline_aligned;
|
|
};
|
|
|
|
/**
|
|
* struct padata_instance - The overall control structure.
|
|
*
|
|
* @cpu_notifier: cpu hotplug notifier.
|
|
* @wq: The workqueue in use.
|
|
* @pd: The internal control structure.
|
|
* @cpumask: User supplied cpumasks for parallel and serial works.
|
|
* @cpumask_change_notifier: Notifiers chain for user-defined notify
|
|
* callbacks that will be called when either @pcpu or @cbcpu
|
|
* or both cpumasks change.
|
|
* @kobj: padata instance kernel object.
|
|
* @lock: padata instance lock.
|
|
* @flags: padata flags.
|
|
*/
|
|
struct padata_instance {
|
|
struct hlist_node node;
|
|
struct workqueue_struct *wq;
|
|
struct parallel_data *pd;
|
|
struct padata_cpumask cpumask;
|
|
struct blocking_notifier_head cpumask_change_notifier;
|
|
struct kobject kobj;
|
|
struct mutex lock;
|
|
u8 flags;
|
|
#define PADATA_INIT 1
|
|
#define PADATA_RESET 2
|
|
#define PADATA_INVALID 4
|
|
};
|
|
|
|
extern struct padata_instance *padata_alloc_possible(
|
|
struct workqueue_struct *wq);
|
|
extern struct padata_instance *padata_alloc(struct workqueue_struct *wq,
|
|
const struct cpumask *pcpumask,
|
|
const struct cpumask *cbcpumask);
|
|
extern void padata_free(struct padata_instance *pinst);
|
|
extern int padata_do_parallel(struct padata_instance *pinst,
|
|
struct padata_priv *padata, int cb_cpu);
|
|
extern void padata_do_serial(struct padata_priv *padata);
|
|
extern int padata_set_cpumask(struct padata_instance *pinst, int cpumask_type,
|
|
cpumask_var_t cpumask);
|
|
extern int padata_start(struct padata_instance *pinst);
|
|
extern void padata_stop(struct padata_instance *pinst);
|
|
extern int padata_register_cpumask_notifier(struct padata_instance *pinst,
|
|
struct notifier_block *nblock);
|
|
extern int padata_unregister_cpumask_notifier(struct padata_instance *pinst,
|
|
struct notifier_block *nblock);
|
|
#endif
|