mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-11 13:27:06 +09:00
Merge 4.19.125 into android-4.19-stable
Changes in 4.19.125 x86/uaccess, ubsan: Fix UBSAN vs. SMAP ubsan: build ubsan.c more conservatively i2c: dev: Fix the race between the release of i2c_dev and cdev KVM: SVM: Fix potential memory leak in svm_cpu_init() riscv: set max_pfn to the PFN of the last page ima: Set file->f_mode instead of file->f_flags in ima_calc_file_hash() evm: Check also if *tfm is an error pointer in init_desc() ima: Fix return value of ima_write_policy() mtd: spinand: Propagate ECC information to the MTD structure fix multiplication overflow in copy_fdtable() ubifs: remove broken lazytime support 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()' ubi: Fix seq_file usage in detailed_erase_block_info debugfs file gcc-common.h: Update for GCC 10 HID: multitouch: add eGalaxTouch P80H84 support HID: alps: Add AUI1657 device ID HID: alps: ALPS_1657 is too specific; use U1_UNICORN_LEGACY instead scsi: qla2xxx: Fix hang when issuing nvme disconnect-all in NPIV scsi: qla2xxx: Delete all sessions before unregister local nvme port configfs: fix config_item refcnt leak in configfs_rmdir() vhost/vsock: fix packet delivery order to monitoring devices aquantia: Fix the media type of AQC100 ethernet controller in the driver component: Silence bind error on -EPROBE_DEFER scsi: ibmvscsi: Fix WARN_ON during event pool release HID: i2c-hid: reset Synaptics SYNA2393 on resume x86/apic: Move TSC deadline timer debug printk gtp: set NLM_F_MULTI flag in gtp_genl_dump_pdp() HID: quirks: Add HID_QUIRK_NO_INIT_REPORTS quirk for Dell K12A keyboard-dock ceph: fix double unlock in handle_cap_export() stmmac: fix pointer check after utilization in stmmac_interrupt 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 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 ALSA: iec1712: Initialize STDSP24 properly when using the model=staudio option ALSA: pcm: fix incorrect hw_base increase ALSA: hda/realtek - Fix silent output on Gigabyte X570 Aorus Xtreme ALSA: hda/realtek - Add more fixup entries for Clevo machines drm/etnaviv: fix perfmon domain interation apparmor: Fix use-after-free in aa_audit_rule_init apparmor: fix potential label refcnt leak in aa_change_profile apparmor: Fix aa_label refcnt leak in policy_update dmaengine: tegra210-adma: Fix an error handling path in 'tegra_adma_probe()' dmaengine: owl: Use correct lock in owl_dma_get_pchan() drm/i915/gvt: Init DPLL/DDI vreg for virtual display instead of inheritance. powerpc: Remove STRICT_KERNEL_RWX incompatibility with RELOCATABLE powerpc/64s: Disable STRICT_KERNEL_RWX nfit: Add Hyper-V NVDIMM DSM command set to white list libnvdimm/btt: Remove unnecessary code in btt_freelist_init libnvdimm/btt: Fix LBA masking during 'free list' population staging: most: core: replace strcpy() by strscpy() thunderbolt: Drop duplicated get_switch_at_route() media: fdp1: Fix R-Car M3-N naming in debug message Revert "net/ibmvnic: Fix EOI when running in XIVE mode" net: bcmgenet: code movement net: bcmgenet: abort suspend on error cxgb4: free mac_hlist properly cxgb4/cxgb4vf: Fix mac_hlist initialization and free tty: serial: qcom_geni_serial: Fix wrap around of TX buffer brcmfmac: abort and release host after error 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: sca3000: Remove an erroneous 'get_device()' iio: dac: vf610: Fix an error handling path in 'vf610_dac_probe()' misc: rtsx: Add short delay after exit from ASPM mei: release me_cl object reference ipack: tpci200: fix error return code in tpci200_register() rapidio: fix an error in get_user_pages_fast() error handling rxrpc: Fix a memory leak in rxkad_verify_response() x86/unwind/orc: Fix unwind_get_return_address_ptr() for inactive tasks iio: adc: stm32-adc: Use dma_request_chan() instead dma_request_slave_channel() iio: adc: stm32-adc: fix device used to request dma iio: adc: stm32-dfsdm: Use dma_request_chan() instead dma_request_slave_channel() iio: adc: stm32-dfsdm: fix device used to request dma rxrpc: Trace discarded ACKs rxrpc: Fix ack discard Linux 4.19.125 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: I7ef4b874ed2ce4f234e2333c751b5dd401746358
This commit is contained in:
114
kernel/padata.c
114
kernel/padata.c
@@ -167,23 +167,12 @@ EXPORT_SYMBOL(padata_do_parallel);
|
||||
*/
|
||||
static struct padata_priv *padata_get_next(struct parallel_data *pd)
|
||||
{
|
||||
int cpu, num_cpus;
|
||||
unsigned int next_nr, next_index;
|
||||
struct padata_parallel_queue *next_queue;
|
||||
struct padata_priv *padata;
|
||||
struct padata_list *reorder;
|
||||
int cpu = pd->cpu;
|
||||
|
||||
num_cpus = cpumask_weight(pd->cpumask.pcpu);
|
||||
|
||||
/*
|
||||
* Calculate the percpu reorder queue and the sequence
|
||||
* number of the next object.
|
||||
*/
|
||||
next_nr = pd->processed;
|
||||
next_index = next_nr % num_cpus;
|
||||
cpu = padata_index_to_cpu(pd, next_index);
|
||||
next_queue = per_cpu_ptr(pd->pqueue, cpu);
|
||||
|
||||
reorder = &next_queue->reorder;
|
||||
|
||||
spin_lock(&reorder->lock);
|
||||
@@ -194,7 +183,8 @@ static struct padata_priv *padata_get_next(struct parallel_data *pd)
|
||||
list_del_init(&padata->list);
|
||||
atomic_dec(&pd->reorder_objects);
|
||||
|
||||
pd->processed++;
|
||||
pd->cpu = cpumask_next_wrap(cpu, pd->cpumask.pcpu, -1,
|
||||
false);
|
||||
|
||||
spin_unlock(&reorder->lock);
|
||||
goto out;
|
||||
@@ -217,6 +207,7 @@ static void padata_reorder(struct parallel_data *pd)
|
||||
struct padata_priv *padata;
|
||||
struct padata_serial_queue *squeue;
|
||||
struct padata_instance *pinst = pd->pinst;
|
||||
struct padata_parallel_queue *next_queue;
|
||||
|
||||
/*
|
||||
* We need to ensure that only one cpu can work on dequeueing of
|
||||
@@ -248,7 +239,6 @@ static void padata_reorder(struct parallel_data *pd)
|
||||
* so exit immediately.
|
||||
*/
|
||||
if (PTR_ERR(padata) == -ENODATA) {
|
||||
del_timer(&pd->timer);
|
||||
spin_unlock_bh(&pd->lock);
|
||||
return;
|
||||
}
|
||||
@@ -267,70 +257,29 @@ static void padata_reorder(struct parallel_data *pd)
|
||||
|
||||
/*
|
||||
* The next object that needs serialization might have arrived to
|
||||
* the reorder queues in the meantime, we will be called again
|
||||
* from the timer function if no one else cares for it.
|
||||
* the reorder queues in the meantime.
|
||||
*
|
||||
* Ensure reorder_objects is read after pd->lock is dropped so we see
|
||||
* an increment from another task in padata_do_serial. Pairs with
|
||||
* Ensure reorder queue is read after pd->lock is dropped so we see
|
||||
* new objects from another task in padata_do_serial. Pairs with
|
||||
* smp_mb__after_atomic in padata_do_serial.
|
||||
*/
|
||||
smp_mb();
|
||||
if (atomic_read(&pd->reorder_objects)
|
||||
&& !(pinst->flags & PADATA_RESET))
|
||||
mod_timer(&pd->timer, jiffies + HZ);
|
||||
else
|
||||
del_timer(&pd->timer);
|
||||
|
||||
return;
|
||||
next_queue = per_cpu_ptr(pd->pqueue, pd->cpu);
|
||||
if (!list_empty(&next_queue->reorder.list))
|
||||
queue_work(pinst->wq, &pd->reorder_work);
|
||||
}
|
||||
|
||||
static void invoke_padata_reorder(struct work_struct *work)
|
||||
{
|
||||
struct padata_parallel_queue *pqueue;
|
||||
struct parallel_data *pd;
|
||||
|
||||
local_bh_disable();
|
||||
pqueue = container_of(work, struct padata_parallel_queue, reorder_work);
|
||||
pd = pqueue->pd;
|
||||
pd = container_of(work, struct parallel_data, reorder_work);
|
||||
padata_reorder(pd);
|
||||
local_bh_enable();
|
||||
}
|
||||
|
||||
static void padata_reorder_timer(struct timer_list *t)
|
||||
{
|
||||
struct parallel_data *pd = from_timer(pd, t, timer);
|
||||
unsigned int weight;
|
||||
int target_cpu, cpu;
|
||||
|
||||
cpu = get_cpu();
|
||||
|
||||
/* We don't lock pd here to not interfere with parallel processing
|
||||
* padata_reorder() calls on other CPUs. We just need any CPU out of
|
||||
* the cpumask.pcpu set. It would be nice if it's the right one but
|
||||
* it doesn't matter if we're off to the next one by using an outdated
|
||||
* pd->processed value.
|
||||
*/
|
||||
weight = cpumask_weight(pd->cpumask.pcpu);
|
||||
target_cpu = padata_index_to_cpu(pd, pd->processed % weight);
|
||||
|
||||
/* ensure to call the reorder callback on the correct CPU */
|
||||
if (cpu != target_cpu) {
|
||||
struct padata_parallel_queue *pqueue;
|
||||
struct padata_instance *pinst;
|
||||
|
||||
/* The timer function is serialized wrt itself -- no locking
|
||||
* needed.
|
||||
*/
|
||||
pinst = pd->pinst;
|
||||
pqueue = per_cpu_ptr(pd->pqueue, target_cpu);
|
||||
queue_work_on(target_cpu, pinst->wq, &pqueue->reorder_work);
|
||||
} else {
|
||||
padata_reorder(pd);
|
||||
}
|
||||
|
||||
put_cpu();
|
||||
}
|
||||
|
||||
static void padata_serial_worker(struct work_struct *serial_work)
|
||||
{
|
||||
struct padata_serial_queue *squeue;
|
||||
@@ -375,47 +324,23 @@ static void padata_serial_worker(struct work_struct *serial_work)
|
||||
*/
|
||||
void padata_do_serial(struct padata_priv *padata)
|
||||
{
|
||||
int cpu;
|
||||
struct padata_parallel_queue *pqueue;
|
||||
struct parallel_data *pd;
|
||||
int reorder_via_wq = 0;
|
||||
|
||||
pd = padata->pd;
|
||||
|
||||
cpu = get_cpu();
|
||||
|
||||
/* We need to run on the same CPU padata_do_parallel(.., padata, ..)
|
||||
* was called on -- or, at least, enqueue the padata object into the
|
||||
* correct per-cpu queue.
|
||||
*/
|
||||
if (cpu != padata->cpu) {
|
||||
reorder_via_wq = 1;
|
||||
cpu = padata->cpu;
|
||||
}
|
||||
|
||||
pqueue = per_cpu_ptr(pd->pqueue, cpu);
|
||||
struct parallel_data *pd = padata->pd;
|
||||
struct padata_parallel_queue *pqueue = per_cpu_ptr(pd->pqueue,
|
||||
padata->cpu);
|
||||
|
||||
spin_lock(&pqueue->reorder.lock);
|
||||
atomic_inc(&pd->reorder_objects);
|
||||
list_add_tail(&padata->list, &pqueue->reorder.list);
|
||||
atomic_inc(&pd->reorder_objects);
|
||||
spin_unlock(&pqueue->reorder.lock);
|
||||
|
||||
/*
|
||||
* Ensure the atomic_inc of reorder_objects above is ordered correctly
|
||||
* Ensure the addition to the reorder list is ordered correctly
|
||||
* with the trylock of pd->lock in padata_reorder. Pairs with smp_mb
|
||||
* in padata_reorder.
|
||||
*/
|
||||
smp_mb__after_atomic();
|
||||
|
||||
put_cpu();
|
||||
|
||||
/* If we're running on the wrong CPU, call padata_reorder() via a
|
||||
* kernel worker.
|
||||
*/
|
||||
if (reorder_via_wq)
|
||||
queue_work_on(cpu, pd->pinst->wq, &pqueue->reorder_work);
|
||||
else
|
||||
padata_reorder(pd);
|
||||
padata_reorder(pd);
|
||||
}
|
||||
EXPORT_SYMBOL(padata_do_serial);
|
||||
|
||||
@@ -471,14 +396,12 @@ static void padata_init_pqueues(struct parallel_data *pd)
|
||||
continue;
|
||||
}
|
||||
|
||||
pqueue->pd = pd;
|
||||
pqueue->cpu_index = cpu_index;
|
||||
cpu_index++;
|
||||
|
||||
__padata_list_init(&pqueue->reorder);
|
||||
__padata_list_init(&pqueue->parallel);
|
||||
INIT_WORK(&pqueue->work, padata_parallel_worker);
|
||||
INIT_WORK(&pqueue->reorder_work, invoke_padata_reorder);
|
||||
atomic_set(&pqueue->num_obj, 0);
|
||||
}
|
||||
}
|
||||
@@ -506,12 +429,13 @@ static struct parallel_data *padata_alloc_pd(struct padata_instance *pinst,
|
||||
|
||||
padata_init_pqueues(pd);
|
||||
padata_init_squeues(pd);
|
||||
timer_setup(&pd->timer, padata_reorder_timer, 0);
|
||||
atomic_set(&pd->seq_nr, -1);
|
||||
atomic_set(&pd->reorder_objects, 0);
|
||||
atomic_set(&pd->refcnt, 1);
|
||||
pd->pinst = pinst;
|
||||
spin_lock_init(&pd->lock);
|
||||
pd->cpu = cpumask_first(pd->cpumask.pcpu);
|
||||
INIT_WORK(&pd->reorder_work, invoke_padata_reorder);
|
||||
|
||||
return pd;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user