This is the 4.9.186 stable release
-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAl00DuEACgkQONu9yGCS aT5SfA/8Cb+dy+hYcmzuWvhuifNMXgyMVFCoyRbgpM8XC0+kRz713NoJ6qeuCzVy DeHYL87OaPCdQiLM/G+wXnGeGpr/ZmhKwCJbseayFXlMDX4qrN3PxyYmDdBLIgIz 4entWkXY2ZlwpOMPdLHAKZUUzSeMLmY9yhIjli6myu2cA7AKVqbPmvKf0g8dSOcL lSTVPWZvA29sCA4yQ3MbdQWK92f9Dhfu/egFC41jHFhp5l8a2r0cIPKJykWI9STn CQb81SsYaQD/mjsw8hsw9VGDDzKzSsO1xPkAEa3WNRkIOp4ANeiz0cDDA9bW/vKZ 2gbu/VXezjK4EuuCSeWtKf+Wev6RTTVV7SFez7ppE361zYt3EPIudp0WuXSrvXqm IUlyR30Q/dAov5Y6ZsDYiV5q35IuXxFVeMJto1SDA/5s+u+IxHZbsFREDIDATAMJ V70slGD9tkavsb+XgppSXhhBYPxCCqlXw8FunJc4xVR9/LEmStcGUFnP9/UUlQog O+Uvolckn/ljzxYzYZ5bbSRga1CCfAxaCNv8zx6GLPrgE7civ9IaJIFBbjeGR1Yn zq9k3klDhACmWFxRCr2y/cGSkaR3+QNXH43T7aagj5himYiIdoJMr2+Fx2lPOGwD fPK/wrSIIXPgQFtqJolGOw5uZQQDv9HKWOdy9P/SVlo4bPsRQH0= =We9z -----END PGP SIGNATURE----- Merge 4.9.186 into android-4.9 Changes in 4.9.186 crypto: talitos - rename alternative AEAD algos. Input: elantech - enable middle button support on 2 ThinkPads samples, bpf: fix to change the buffer size for read() staging:iio:ad7150: fix threshold mode config bit mac80211: mesh: fix RCU warning mac80211: free peer keys before vif down in mesh mwifiex: Fix possible buffer overflows at parsing bss descriptor netfilter: ipv6: nf_defrag: fix leakage of unqueued fragments netfilter: ipv6: nf_defrag: accept duplicate fragments again dt-bindings: can: mcp251x: add mcp25625 support can: mcp251x: add support for mcp25625 Input: imx_keypad - make sure keyboard can always wake up system KVM: arm/arm64: vgic: Fix kvm_device leak in vgic_its_destroy mlxsw: spectrum: Disallow prio-tagged packets when PVID is removed ARM: davinci: da850-evm: call regulator_has_full_constraints() ARM: davinci: da8xx: specify dma_coherent_mask for lcdc mac80211: only warn once on chanctx_conf being NULL md: fix for divide error in status_resync bnx2x: Check if transceiver implements DDM before access ip6_tunnel: allow not to count pkts on tstats by passing dev as NULL net :sunrpc :clnt :Fix xps refcount imbalance on the error path udf: Fix incorrect final NOT_ALLOCATED (hole) extent length x86/ptrace: Fix possible spectre-v1 in ptrace_get_debugreg() x86/tls: Fix possible spectre-v1 in do_get_thread_area() mwifiex: Abort at too short BSS descriptor element mwifiex: Fix heap overflow in mwifiex_uap_parse_tail_ies() fscrypt: don't set policy for a dead directory mwifiex: Don't abort on small, spec-compliant vendor IEs USB: serial: ftdi_sio: add ID for isodebug v1 USB: serial: option: add support for GosunCn ME3630 RNDIS mode Revert "serial: 8250: Don't service RX FIFO if interrupts are disabled" p54usb: Fix race between disconnect and firmware loading usb: gadget: ether: Fix race between gether_disconnect and rx_submit usb: renesas_usbhs: add a workaround for a race condition of workqueue staging: comedi: dt282x: fix a null pointer deref on interrupt staging: comedi: amplc_pci230: fix null pointer deref on interrupt carl9170: fix misuse of device driver API VMCI: Fix integer overflow in VMCI handle arrays MIPS: Remove superfluous check for __linux__ Revert "e1000e: fix cyclic resets at link up with active tx" e1000e: start network tx queue only when link is up nilfs2: do not use unexported cpu_to_le32()/le32_to_cpu() in uapi header arm64: crypto: remove accidentally backported files perf/core: Fix perf_sample_regs_user() mm check ARM: omap2: remove incorrect __init annotation be2net: fix link failure after ethtool offline test ppp: mppe: Add softdep to arc4 sis900: fix TX completion ARM: dts: imx6ul: fix PWM[1-4] interrupts dm verity: use message limit for data block corruption message ARC: hide unused function unw_hdr_alloc s390: fix stfle zero padding s390/qdio: (re-)initialize tiqdio list entries s390/qdio: don't touch the dsci in tiqdio_add_input_queues() Linux 4.9.186 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
commit
cd46375d4f
60 changed files with 517 additions and 3460 deletions
|
|
@ -4,6 +4,7 @@ Required properties:
|
|||
- compatible: Should be one of the following:
|
||||
- "microchip,mcp2510" for MCP2510.
|
||||
- "microchip,mcp2515" for MCP2515.
|
||||
- "microchip,mcp25625" for MCP25625.
|
||||
- reg: SPI chip select.
|
||||
- clocks: The clock feeding the CAN controller.
|
||||
- interrupt-parent: The parent interrupt controller.
|
||||
|
|
|
|||
2
Makefile
2
Makefile
|
|
@ -1,6 +1,6 @@
|
|||
VERSION = 4
|
||||
PATCHLEVEL = 9
|
||||
SUBLEVEL = 185
|
||||
SUBLEVEL = 186
|
||||
EXTRAVERSION =
|
||||
NAME = Roaring Lionus
|
||||
|
||||
|
|
|
|||
|
|
@ -185,11 +185,6 @@ static void *__init unw_hdr_alloc_early(unsigned long sz)
|
|||
MAX_DMA_ADDRESS);
|
||||
}
|
||||
|
||||
static void *unw_hdr_alloc(unsigned long sz)
|
||||
{
|
||||
return kmalloc(sz, GFP_KERNEL);
|
||||
}
|
||||
|
||||
static void init_unwind_table(struct unwind_table *table, const char *name,
|
||||
const void *core_start, unsigned long core_size,
|
||||
const void *init_start, unsigned long init_size,
|
||||
|
|
@ -370,6 +365,10 @@ ret_err:
|
|||
}
|
||||
|
||||
#ifdef CONFIG_MODULES
|
||||
static void *unw_hdr_alloc(unsigned long sz)
|
||||
{
|
||||
return kmalloc(sz, GFP_KERNEL);
|
||||
}
|
||||
|
||||
static struct unwind_table *last_table;
|
||||
|
||||
|
|
|
|||
|
|
@ -332,7 +332,7 @@
|
|||
pwm1: pwm@02080000 {
|
||||
compatible = "fsl,imx6ul-pwm", "fsl,imx27-pwm";
|
||||
reg = <0x02080000 0x4000>;
|
||||
interrupts = <GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH>;
|
||||
interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&clks IMX6UL_CLK_PWM1>,
|
||||
<&clks IMX6UL_CLK_PWM1>;
|
||||
clock-names = "ipg", "per";
|
||||
|
|
@ -343,7 +343,7 @@
|
|||
pwm2: pwm@02084000 {
|
||||
compatible = "fsl,imx6ul-pwm", "fsl,imx27-pwm";
|
||||
reg = <0x02084000 0x4000>;
|
||||
interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>;
|
||||
interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&clks IMX6UL_CLK_PWM2>,
|
||||
<&clks IMX6UL_CLK_PWM2>;
|
||||
clock-names = "ipg", "per";
|
||||
|
|
@ -354,7 +354,7 @@
|
|||
pwm3: pwm@02088000 {
|
||||
compatible = "fsl,imx6ul-pwm", "fsl,imx27-pwm";
|
||||
reg = <0x02088000 0x4000>;
|
||||
interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>;
|
||||
interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&clks IMX6UL_CLK_PWM3>,
|
||||
<&clks IMX6UL_CLK_PWM3>;
|
||||
clock-names = "ipg", "per";
|
||||
|
|
@ -365,7 +365,7 @@
|
|||
pwm4: pwm@0208c000 {
|
||||
compatible = "fsl,imx6ul-pwm", "fsl,imx27-pwm";
|
||||
reg = <0x0208c000 0x4000>;
|
||||
interrupts = <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>;
|
||||
interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&clks IMX6UL_CLK_PWM4>,
|
||||
<&clks IMX6UL_CLK_PWM4>;
|
||||
clock-names = "ipg", "per";
|
||||
|
|
|
|||
|
|
@ -1479,6 +1479,8 @@ static __init void da850_evm_init(void)
|
|||
if (ret)
|
||||
pr_warn("%s: dsp/rproc registration failed: %d\n",
|
||||
__func__, ret);
|
||||
|
||||
regulator_has_full_constraints();
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SERIAL_8250_CONSOLE
|
||||
|
|
|
|||
|
|
@ -706,6 +706,9 @@ static struct platform_device da8xx_lcdc_device = {
|
|||
.id = 0,
|
||||
.num_resources = ARRAY_SIZE(da8xx_lcdc_resources),
|
||||
.resource = da8xx_lcdc_resources,
|
||||
.dev = {
|
||||
.coherent_dma_mask = DMA_BIT_MASK(32),
|
||||
}
|
||||
};
|
||||
|
||||
int __init da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata)
|
||||
|
|
|
|||
|
|
@ -433,7 +433,7 @@ static void omap3_prm_reconfigure_io_chain(void)
|
|||
* registers, and omap3xxx_prm_reconfigure_io_chain() must be called.
|
||||
* No return value.
|
||||
*/
|
||||
static void __init omap3xxx_prm_enable_io_wakeup(void)
|
||||
static void omap3xxx_prm_enable_io_wakeup(void)
|
||||
{
|
||||
if (prm_features & PRM_HAS_IO_WAKEUP)
|
||||
omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD,
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -10,14 +10,6 @@
|
|||
#ifndef __ASM_SGIDEFS_H
|
||||
#define __ASM_SGIDEFS_H
|
||||
|
||||
/*
|
||||
* Using a Linux compiler for building Linux seems logic but not to
|
||||
* everybody.
|
||||
*/
|
||||
#ifndef __linux__
|
||||
#error Use a Linux compiler or give up.
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Definitions for the ISA levels
|
||||
*
|
||||
|
|
|
|||
|
|
@ -61,6 +61,18 @@ static inline int test_facility(unsigned long nr)
|
|||
return __test_facility(nr, &S390_lowcore.stfle_fac_list);
|
||||
}
|
||||
|
||||
static inline unsigned long __stfle_asm(u64 *stfle_fac_list, int size)
|
||||
{
|
||||
register unsigned long reg0 asm("0") = size - 1;
|
||||
|
||||
asm volatile(
|
||||
".insn s,0xb2b00000,0(%1)" /* stfle */
|
||||
: "+d" (reg0)
|
||||
: "a" (stfle_fac_list)
|
||||
: "memory", "cc");
|
||||
return reg0;
|
||||
}
|
||||
|
||||
/**
|
||||
* stfle - Store facility list extended
|
||||
* @stfle_fac_list: array where facility list can be stored
|
||||
|
|
@ -78,13 +90,8 @@ static inline void stfle(u64 *stfle_fac_list, int size)
|
|||
memcpy(stfle_fac_list, &S390_lowcore.stfl_fac_list, 4);
|
||||
if (S390_lowcore.stfl_fac_list & 0x01000000) {
|
||||
/* More facility bits available with stfle */
|
||||
register unsigned long reg0 asm("0") = size - 1;
|
||||
|
||||
asm volatile(".insn s,0xb2b00000,0(%1)" /* stfle */
|
||||
: "+d" (reg0)
|
||||
: "a" (stfle_fac_list)
|
||||
: "memory", "cc");
|
||||
nr = (reg0 + 1) * 8; /* # bytes stored by stfle */
|
||||
nr = __stfle_asm(stfle_fac_list, size);
|
||||
nr = min_t(unsigned long, (nr + 1) * 8, size * 8);
|
||||
}
|
||||
memset((char *) stfle_fac_list + nr, 0, size * 8 - nr);
|
||||
preempt_enable();
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include <linux/rcupdate.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/context_tracking.h>
|
||||
#include <linux/nospec.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/pgtable.h>
|
||||
|
|
@ -650,9 +651,11 @@ static unsigned long ptrace_get_debugreg(struct task_struct *tsk, int n)
|
|||
{
|
||||
struct thread_struct *thread = &tsk->thread;
|
||||
unsigned long val = 0;
|
||||
int index = n;
|
||||
|
||||
if (n < HBP_NUM) {
|
||||
struct perf_event *bp = thread->ptrace_bps[n];
|
||||
struct perf_event *bp = thread->ptrace_bps[index];
|
||||
index = array_index_nospec(index, HBP_NUM);
|
||||
|
||||
if (bp)
|
||||
val = bp->hw.info.address;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <linux/user.h>
|
||||
#include <linux/regset.h>
|
||||
#include <linux/syscalls.h>
|
||||
#include <linux/nospec.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/desc.h>
|
||||
|
|
@ -219,6 +220,7 @@ int do_get_thread_area(struct task_struct *p, int idx,
|
|||
struct user_desc __user *u_info)
|
||||
{
|
||||
struct user_desc info;
|
||||
int index;
|
||||
|
||||
if (idx == -1 && get_user(idx, &u_info->entry_number))
|
||||
return -EFAULT;
|
||||
|
|
@ -226,8 +228,11 @@ int do_get_thread_area(struct task_struct *p, int idx,
|
|||
if (idx < GDT_ENTRY_TLS_MIN || idx > GDT_ENTRY_TLS_MAX)
|
||||
return -EINVAL;
|
||||
|
||||
fill_user_desc(&info, idx,
|
||||
&p->thread.tls_array[idx - GDT_ENTRY_TLS_MIN]);
|
||||
index = idx - GDT_ENTRY_TLS_MIN;
|
||||
index = array_index_nospec(index,
|
||||
GDT_ENTRY_TLS_MAX - GDT_ENTRY_TLS_MIN + 1);
|
||||
|
||||
fill_user_desc(&info, idx, &p->thread.tls_array[index]);
|
||||
|
||||
if (copy_to_user(u_info, &info, sizeof(info)))
|
||||
return -EFAULT;
|
||||
|
|
|
|||
|
|
@ -2185,7 +2185,7 @@ static struct talitos_alg_template driver_algs[] = {
|
|||
.base = {
|
||||
.cra_name = "authenc(hmac(sha1),cbc(aes))",
|
||||
.cra_driver_name = "authenc-hmac-sha1-"
|
||||
"cbc-aes-talitos",
|
||||
"cbc-aes-talitos-hsna",
|
||||
.cra_blocksize = AES_BLOCK_SIZE,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC,
|
||||
},
|
||||
|
|
@ -2229,7 +2229,7 @@ static struct talitos_alg_template driver_algs[] = {
|
|||
.cra_name = "authenc(hmac(sha1),"
|
||||
"cbc(des3_ede))",
|
||||
.cra_driver_name = "authenc-hmac-sha1-"
|
||||
"cbc-3des-talitos",
|
||||
"cbc-3des-talitos-hsna",
|
||||
.cra_blocksize = DES3_EDE_BLOCK_SIZE,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC,
|
||||
},
|
||||
|
|
@ -2271,7 +2271,7 @@ static struct talitos_alg_template driver_algs[] = {
|
|||
.base = {
|
||||
.cra_name = "authenc(hmac(sha224),cbc(aes))",
|
||||
.cra_driver_name = "authenc-hmac-sha224-"
|
||||
"cbc-aes-talitos",
|
||||
"cbc-aes-talitos-hsna",
|
||||
.cra_blocksize = AES_BLOCK_SIZE,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC,
|
||||
},
|
||||
|
|
@ -2315,7 +2315,7 @@ static struct talitos_alg_template driver_algs[] = {
|
|||
.cra_name = "authenc(hmac(sha224),"
|
||||
"cbc(des3_ede))",
|
||||
.cra_driver_name = "authenc-hmac-sha224-"
|
||||
"cbc-3des-talitos",
|
||||
"cbc-3des-talitos-hsna",
|
||||
.cra_blocksize = DES3_EDE_BLOCK_SIZE,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC,
|
||||
},
|
||||
|
|
@ -2357,7 +2357,7 @@ static struct talitos_alg_template driver_algs[] = {
|
|||
.base = {
|
||||
.cra_name = "authenc(hmac(sha256),cbc(aes))",
|
||||
.cra_driver_name = "authenc-hmac-sha256-"
|
||||
"cbc-aes-talitos",
|
||||
"cbc-aes-talitos-hsna",
|
||||
.cra_blocksize = AES_BLOCK_SIZE,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC,
|
||||
},
|
||||
|
|
@ -2401,7 +2401,7 @@ static struct talitos_alg_template driver_algs[] = {
|
|||
.cra_name = "authenc(hmac(sha256),"
|
||||
"cbc(des3_ede))",
|
||||
.cra_driver_name = "authenc-hmac-sha256-"
|
||||
"cbc-3des-talitos",
|
||||
"cbc-3des-talitos-hsna",
|
||||
.cra_blocksize = DES3_EDE_BLOCK_SIZE,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC,
|
||||
},
|
||||
|
|
@ -2527,7 +2527,7 @@ static struct talitos_alg_template driver_algs[] = {
|
|||
.base = {
|
||||
.cra_name = "authenc(hmac(md5),cbc(aes))",
|
||||
.cra_driver_name = "authenc-hmac-md5-"
|
||||
"cbc-aes-talitos",
|
||||
"cbc-aes-talitos-hsna",
|
||||
.cra_blocksize = AES_BLOCK_SIZE,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC,
|
||||
},
|
||||
|
|
@ -2569,7 +2569,7 @@ static struct talitos_alg_template driver_algs[] = {
|
|||
.base = {
|
||||
.cra_name = "authenc(hmac(md5),cbc(des3_ede))",
|
||||
.cra_driver_name = "authenc-hmac-md5-"
|
||||
"cbc-3des-talitos",
|
||||
"cbc-3des-talitos-hsna",
|
||||
.cra_blocksize = DES3_EDE_BLOCK_SIZE,
|
||||
.cra_flags = CRYPTO_ALG_ASYNC,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -530,11 +530,12 @@ static int imx_keypad_probe(struct platform_device *pdev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused imx_kbd_suspend(struct device *dev)
|
||||
static int __maybe_unused imx_kbd_noirq_suspend(struct device *dev)
|
||||
{
|
||||
struct platform_device *pdev = to_platform_device(dev);
|
||||
struct imx_keypad *kbd = platform_get_drvdata(pdev);
|
||||
struct input_dev *input_dev = kbd->input_dev;
|
||||
unsigned short reg_val = readw(kbd->mmio_base + KPSR);
|
||||
|
||||
/* imx kbd can wake up system even clock is disabled */
|
||||
mutex_lock(&input_dev->mutex);
|
||||
|
|
@ -544,13 +545,20 @@ static int __maybe_unused imx_kbd_suspend(struct device *dev)
|
|||
|
||||
mutex_unlock(&input_dev->mutex);
|
||||
|
||||
if (device_may_wakeup(&pdev->dev))
|
||||
if (device_may_wakeup(&pdev->dev)) {
|
||||
if (reg_val & KBD_STAT_KPKD)
|
||||
reg_val |= KBD_STAT_KRIE;
|
||||
if (reg_val & KBD_STAT_KPKR)
|
||||
reg_val |= KBD_STAT_KDIE;
|
||||
writew(reg_val, kbd->mmio_base + KPSR);
|
||||
|
||||
enable_irq_wake(kbd->irq);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused imx_kbd_resume(struct device *dev)
|
||||
static int __maybe_unused imx_kbd_noirq_resume(struct device *dev)
|
||||
{
|
||||
struct platform_device *pdev = to_platform_device(dev);
|
||||
struct imx_keypad *kbd = platform_get_drvdata(pdev);
|
||||
|
|
@ -574,7 +582,9 @@ err_clk:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(imx_kbd_pm_ops, imx_kbd_suspend, imx_kbd_resume);
|
||||
static const struct dev_pm_ops imx_kbd_pm_ops = {
|
||||
SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(imx_kbd_noirq_suspend, imx_kbd_noirq_resume)
|
||||
};
|
||||
|
||||
static struct platform_driver imx_keypad_driver = {
|
||||
.driver = {
|
||||
|
|
|
|||
|
|
@ -1187,6 +1187,8 @@ static const char * const middle_button_pnp_ids[] = {
|
|||
"LEN2132", /* ThinkPad P52 */
|
||||
"LEN2133", /* ThinkPad P72 w/ NFC */
|
||||
"LEN2134", /* ThinkPad P72 */
|
||||
"LEN0407",
|
||||
"LEN0408",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -220,8 +220,8 @@ static int verity_handle_err(struct dm_verity *v, enum verity_block_type type,
|
|||
BUG();
|
||||
}
|
||||
|
||||
DMERR("%s: %s block %llu is corrupted", v->data_dev->name, type_str,
|
||||
block);
|
||||
DMERR_LIMIT("%s: %s block %llu is corrupted", v->data_dev->name,
|
||||
type_str, block);
|
||||
|
||||
if (v->corrupted_errs == DM_VERITY_MAX_CORRUPTED_ERRS)
|
||||
DMERR("%s: reached maximum errors", v->data_dev->name);
|
||||
|
|
|
|||
|
|
@ -7296,9 +7296,9 @@ static void status_unused(struct seq_file *seq)
|
|||
static int status_resync(struct seq_file *seq, struct mddev *mddev)
|
||||
{
|
||||
sector_t max_sectors, resync, res;
|
||||
unsigned long dt, db;
|
||||
sector_t rt;
|
||||
int scale;
|
||||
unsigned long dt, db = 0;
|
||||
sector_t rt, curr_mark_cnt, resync_mark_cnt;
|
||||
int scale, recovery_active;
|
||||
unsigned int per_milli;
|
||||
|
||||
if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery) ||
|
||||
|
|
@ -7368,22 +7368,30 @@ static int status_resync(struct seq_file *seq, struct mddev *mddev)
|
|||
* db: blocks written from mark until now
|
||||
* rt: remaining time
|
||||
*
|
||||
* rt is a sector_t, so could be 32bit or 64bit.
|
||||
* So we divide before multiply in case it is 32bit and close
|
||||
* to the limit.
|
||||
* We scale the divisor (db) by 32 to avoid losing precision
|
||||
* near the end of resync when the number of remaining sectors
|
||||
* is close to 'db'.
|
||||
* We then divide rt by 32 after multiplying by db to compensate.
|
||||
* The '+1' avoids division by zero if db is very small.
|
||||
* rt is a sector_t, which is always 64bit now. We are keeping
|
||||
* the original algorithm, but it is not really necessary.
|
||||
*
|
||||
* Original algorithm:
|
||||
* So we divide before multiply in case it is 32bit and close
|
||||
* to the limit.
|
||||
* We scale the divisor (db) by 32 to avoid losing precision
|
||||
* near the end of resync when the number of remaining sectors
|
||||
* is close to 'db'.
|
||||
* We then divide rt by 32 after multiplying by db to compensate.
|
||||
* The '+1' avoids division by zero if db is very small.
|
||||
*/
|
||||
dt = ((jiffies - mddev->resync_mark) / HZ);
|
||||
if (!dt) dt++;
|
||||
db = (mddev->curr_mark_cnt - atomic_read(&mddev->recovery_active))
|
||||
- mddev->resync_mark_cnt;
|
||||
|
||||
curr_mark_cnt = mddev->curr_mark_cnt;
|
||||
recovery_active = atomic_read(&mddev->recovery_active);
|
||||
resync_mark_cnt = mddev->resync_mark_cnt;
|
||||
|
||||
if (curr_mark_cnt >= (recovery_active + resync_mark_cnt))
|
||||
db = curr_mark_cnt - (recovery_active + resync_mark_cnt);
|
||||
|
||||
rt = max_sectors - resync; /* number of remaining sectors */
|
||||
sector_div(rt, db/32+1);
|
||||
rt = div64_u64(rt, db/32+1);
|
||||
rt *= dt;
|
||||
rt >>= 5;
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,9 @@
|
|||
#include "vmci_driver.h"
|
||||
#include "vmci_event.h"
|
||||
|
||||
/* Use a wide upper bound for the maximum contexts. */
|
||||
#define VMCI_MAX_CONTEXTS 2000
|
||||
|
||||
/*
|
||||
* List of current VMCI contexts. Contexts can be added by
|
||||
* vmci_ctx_create() and removed via vmci_ctx_destroy().
|
||||
|
|
@ -124,19 +127,22 @@ struct vmci_ctx *vmci_ctx_create(u32 cid, u32 priv_flags,
|
|||
/* Initialize host-specific VMCI context. */
|
||||
init_waitqueue_head(&context->host_context.wait_queue);
|
||||
|
||||
context->queue_pair_array = vmci_handle_arr_create(0);
|
||||
context->queue_pair_array =
|
||||
vmci_handle_arr_create(0, VMCI_MAX_GUEST_QP_COUNT);
|
||||
if (!context->queue_pair_array) {
|
||||
error = -ENOMEM;
|
||||
goto err_free_ctx;
|
||||
}
|
||||
|
||||
context->doorbell_array = vmci_handle_arr_create(0);
|
||||
context->doorbell_array =
|
||||
vmci_handle_arr_create(0, VMCI_MAX_GUEST_DOORBELL_COUNT);
|
||||
if (!context->doorbell_array) {
|
||||
error = -ENOMEM;
|
||||
goto err_free_qp_array;
|
||||
}
|
||||
|
||||
context->pending_doorbell_array = vmci_handle_arr_create(0);
|
||||
context->pending_doorbell_array =
|
||||
vmci_handle_arr_create(0, VMCI_MAX_GUEST_DOORBELL_COUNT);
|
||||
if (!context->pending_doorbell_array) {
|
||||
error = -ENOMEM;
|
||||
goto err_free_db_array;
|
||||
|
|
@ -211,7 +217,7 @@ static int ctx_fire_notification(u32 context_id, u32 priv_flags)
|
|||
* We create an array to hold the subscribers we find when
|
||||
* scanning through all contexts.
|
||||
*/
|
||||
subscriber_array = vmci_handle_arr_create(0);
|
||||
subscriber_array = vmci_handle_arr_create(0, VMCI_MAX_CONTEXTS);
|
||||
if (subscriber_array == NULL)
|
||||
return VMCI_ERROR_NO_MEM;
|
||||
|
||||
|
|
@ -630,20 +636,26 @@ int vmci_ctx_add_notification(u32 context_id, u32 remote_cid)
|
|||
|
||||
spin_lock(&context->lock);
|
||||
|
||||
list_for_each_entry(n, &context->notifier_list, node) {
|
||||
if (vmci_handle_is_equal(n->handle, notifier->handle)) {
|
||||
exists = true;
|
||||
break;
|
||||
if (context->n_notifiers < VMCI_MAX_CONTEXTS) {
|
||||
list_for_each_entry(n, &context->notifier_list, node) {
|
||||
if (vmci_handle_is_equal(n->handle, notifier->handle)) {
|
||||
exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (exists) {
|
||||
kfree(notifier);
|
||||
result = VMCI_ERROR_ALREADY_EXISTS;
|
||||
if (exists) {
|
||||
kfree(notifier);
|
||||
result = VMCI_ERROR_ALREADY_EXISTS;
|
||||
} else {
|
||||
list_add_tail_rcu(¬ifier->node,
|
||||
&context->notifier_list);
|
||||
context->n_notifiers++;
|
||||
result = VMCI_SUCCESS;
|
||||
}
|
||||
} else {
|
||||
list_add_tail_rcu(¬ifier->node, &context->notifier_list);
|
||||
context->n_notifiers++;
|
||||
result = VMCI_SUCCESS;
|
||||
kfree(notifier);
|
||||
result = VMCI_ERROR_NO_MEM;
|
||||
}
|
||||
|
||||
spin_unlock(&context->lock);
|
||||
|
|
@ -728,8 +740,7 @@ static int vmci_ctx_get_chkpt_doorbells(struct vmci_ctx *context,
|
|||
u32 *buf_size, void **pbuf)
|
||||
{
|
||||
struct dbell_cpt_state *dbells;
|
||||
size_t n_doorbells;
|
||||
int i;
|
||||
u32 i, n_doorbells;
|
||||
|
||||
n_doorbells = vmci_handle_arr_get_size(context->doorbell_array);
|
||||
if (n_doorbells > 0) {
|
||||
|
|
@ -867,7 +878,8 @@ int vmci_ctx_rcv_notifications_get(u32 context_id,
|
|||
spin_lock(&context->lock);
|
||||
|
||||
*db_handle_array = context->pending_doorbell_array;
|
||||
context->pending_doorbell_array = vmci_handle_arr_create(0);
|
||||
context->pending_doorbell_array =
|
||||
vmci_handle_arr_create(0, VMCI_MAX_GUEST_DOORBELL_COUNT);
|
||||
if (!context->pending_doorbell_array) {
|
||||
context->pending_doorbell_array = *db_handle_array;
|
||||
*db_handle_array = NULL;
|
||||
|
|
@ -949,12 +961,11 @@ int vmci_ctx_dbell_create(u32 context_id, struct vmci_handle handle)
|
|||
return VMCI_ERROR_NOT_FOUND;
|
||||
|
||||
spin_lock(&context->lock);
|
||||
if (!vmci_handle_arr_has_entry(context->doorbell_array, handle)) {
|
||||
vmci_handle_arr_append_entry(&context->doorbell_array, handle);
|
||||
result = VMCI_SUCCESS;
|
||||
} else {
|
||||
if (!vmci_handle_arr_has_entry(context->doorbell_array, handle))
|
||||
result = vmci_handle_arr_append_entry(&context->doorbell_array,
|
||||
handle);
|
||||
else
|
||||
result = VMCI_ERROR_DUPLICATE_ENTRY;
|
||||
}
|
||||
|
||||
spin_unlock(&context->lock);
|
||||
vmci_ctx_put(context);
|
||||
|
|
@ -1090,15 +1101,16 @@ int vmci_ctx_notify_dbell(u32 src_cid,
|
|||
if (!vmci_handle_arr_has_entry(
|
||||
dst_context->pending_doorbell_array,
|
||||
handle)) {
|
||||
vmci_handle_arr_append_entry(
|
||||
result = vmci_handle_arr_append_entry(
|
||||
&dst_context->pending_doorbell_array,
|
||||
handle);
|
||||
|
||||
ctx_signal_notify(dst_context);
|
||||
wake_up(&dst_context->host_context.wait_queue);
|
||||
|
||||
if (result == VMCI_SUCCESS) {
|
||||
ctx_signal_notify(dst_context);
|
||||
wake_up(&dst_context->host_context.wait_queue);
|
||||
}
|
||||
} else {
|
||||
result = VMCI_SUCCESS;
|
||||
}
|
||||
result = VMCI_SUCCESS;
|
||||
}
|
||||
spin_unlock(&dst_context->lock);
|
||||
}
|
||||
|
|
@ -1125,13 +1137,11 @@ int vmci_ctx_qp_create(struct vmci_ctx *context, struct vmci_handle handle)
|
|||
if (context == NULL || vmci_handle_is_invalid(handle))
|
||||
return VMCI_ERROR_INVALID_ARGS;
|
||||
|
||||
if (!vmci_handle_arr_has_entry(context->queue_pair_array, handle)) {
|
||||
vmci_handle_arr_append_entry(&context->queue_pair_array,
|
||||
handle);
|
||||
result = VMCI_SUCCESS;
|
||||
} else {
|
||||
if (!vmci_handle_arr_has_entry(context->queue_pair_array, handle))
|
||||
result = vmci_handle_arr_append_entry(
|
||||
&context->queue_pair_array, handle);
|
||||
else
|
||||
result = VMCI_ERROR_DUPLICATE_ENTRY;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,24 +16,29 @@
|
|||
#include <linux/slab.h>
|
||||
#include "vmci_handle_array.h"
|
||||
|
||||
static size_t handle_arr_calc_size(size_t capacity)
|
||||
static size_t handle_arr_calc_size(u32 capacity)
|
||||
{
|
||||
return sizeof(struct vmci_handle_arr) +
|
||||
return VMCI_HANDLE_ARRAY_HEADER_SIZE +
|
||||
capacity * sizeof(struct vmci_handle);
|
||||
}
|
||||
|
||||
struct vmci_handle_arr *vmci_handle_arr_create(size_t capacity)
|
||||
struct vmci_handle_arr *vmci_handle_arr_create(u32 capacity, u32 max_capacity)
|
||||
{
|
||||
struct vmci_handle_arr *array;
|
||||
|
||||
if (max_capacity == 0 || capacity > max_capacity)
|
||||
return NULL;
|
||||
|
||||
if (capacity == 0)
|
||||
capacity = VMCI_HANDLE_ARRAY_DEFAULT_SIZE;
|
||||
capacity = min((u32)VMCI_HANDLE_ARRAY_DEFAULT_CAPACITY,
|
||||
max_capacity);
|
||||
|
||||
array = kmalloc(handle_arr_calc_size(capacity), GFP_ATOMIC);
|
||||
if (!array)
|
||||
return NULL;
|
||||
|
||||
array->capacity = capacity;
|
||||
array->max_capacity = max_capacity;
|
||||
array->size = 0;
|
||||
|
||||
return array;
|
||||
|
|
@ -44,27 +49,34 @@ void vmci_handle_arr_destroy(struct vmci_handle_arr *array)
|
|||
kfree(array);
|
||||
}
|
||||
|
||||
void vmci_handle_arr_append_entry(struct vmci_handle_arr **array_ptr,
|
||||
struct vmci_handle handle)
|
||||
int vmci_handle_arr_append_entry(struct vmci_handle_arr **array_ptr,
|
||||
struct vmci_handle handle)
|
||||
{
|
||||
struct vmci_handle_arr *array = *array_ptr;
|
||||
|
||||
if (unlikely(array->size >= array->capacity)) {
|
||||
/* reallocate. */
|
||||
struct vmci_handle_arr *new_array;
|
||||
size_t new_capacity = array->capacity * VMCI_ARR_CAP_MULT;
|
||||
size_t new_size = handle_arr_calc_size(new_capacity);
|
||||
u32 capacity_bump = min(array->max_capacity - array->capacity,
|
||||
array->capacity);
|
||||
size_t new_size = handle_arr_calc_size(array->capacity +
|
||||
capacity_bump);
|
||||
|
||||
if (array->size >= array->max_capacity)
|
||||
return VMCI_ERROR_NO_MEM;
|
||||
|
||||
new_array = krealloc(array, new_size, GFP_ATOMIC);
|
||||
if (!new_array)
|
||||
return;
|
||||
return VMCI_ERROR_NO_MEM;
|
||||
|
||||
new_array->capacity = new_capacity;
|
||||
new_array->capacity += capacity_bump;
|
||||
*array_ptr = array = new_array;
|
||||
}
|
||||
|
||||
array->entries[array->size] = handle;
|
||||
array->size++;
|
||||
|
||||
return VMCI_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -74,7 +86,7 @@ struct vmci_handle vmci_handle_arr_remove_entry(struct vmci_handle_arr *array,
|
|||
struct vmci_handle entry_handle)
|
||||
{
|
||||
struct vmci_handle handle = VMCI_INVALID_HANDLE;
|
||||
size_t i;
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < array->size; i++) {
|
||||
if (vmci_handle_is_equal(array->entries[i], entry_handle)) {
|
||||
|
|
@ -109,7 +121,7 @@ struct vmci_handle vmci_handle_arr_remove_tail(struct vmci_handle_arr *array)
|
|||
* Handle at given index, VMCI_INVALID_HANDLE if invalid index.
|
||||
*/
|
||||
struct vmci_handle
|
||||
vmci_handle_arr_get_entry(const struct vmci_handle_arr *array, size_t index)
|
||||
vmci_handle_arr_get_entry(const struct vmci_handle_arr *array, u32 index)
|
||||
{
|
||||
if (unlikely(index >= array->size))
|
||||
return VMCI_INVALID_HANDLE;
|
||||
|
|
@ -120,7 +132,7 @@ vmci_handle_arr_get_entry(const struct vmci_handle_arr *array, size_t index)
|
|||
bool vmci_handle_arr_has_entry(const struct vmci_handle_arr *array,
|
||||
struct vmci_handle entry_handle)
|
||||
{
|
||||
size_t i;
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < array->size; i++)
|
||||
if (vmci_handle_is_equal(array->entries[i], entry_handle))
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue