firewire-ohci: work around oversized DMA reads on JMicron controllers
Subsystems (5)
PATCH 2/189 x86/tsc: Allow TSC calibration without PIT
In reply to Sasha LevinFrom: Peter Zijlstra <[email protected]>
[ Upstream commit 30c7e5b123673d5e570e238dbada2fb68a87212c ]
Zhang Rui reported that a Surface Pro 4 will fail to boot with lapic=notscdeadline. Part of the problem is that that machine doesn't have a PIT.
If, for some reason, the TSC init has to fall back to TSC calibration, it relies on the PIT to be present.
Allow TSC calibration to reliably fall back to HPET.
The below results in an accurate TSC measurement when forced on a IVB:
tsc: Unable to calibrate against PIT
tsc: No reference (HPET/PMTIMER) available
tsc: Unable to calibrate against PIT
tsc: using HPET reference calibration
tsc: Detected 2792.451 MHz processor
--- arch/x86/include/asm/i8259.h | 5 +++++ arch/x86/kernel/tsc.c | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+)
arch/x86/include/asm/i8259.h +5 -0
@@ -69,6 +69,11 @@ struct legacy_pic {extern struct legacy_pic *legacy_pic;extern struct legacy_pic null_legacy_pic; +static inline bool has_legacy_pic (void ) +{ +return legacy_pic != &null_legacy_pic; +} +static inline int nr_legacy_irqs (void ) {return legacy_pic->nr_legacy_irqs;
arch/x86/kernel/tsc.c +18 -0
@@ -25,6 +25,7 @@#include <asm/geode.h> #include <asm/apic.h> #include <asm/intel-family.h> +#include <asm/i8259.h> unsigned int __read_mostly cpu_khz;/* TSC clocks / usec, not used here */ EXPORT_SYMBOL (cpu_khz);
@@ -363,6 +364,20 @@ static unsigned long pit_calibrate_tsc(u32 latch, unsigned long ms, int loopmin)unsigned long tscmin, tscmax;int pitcnt; +if (!has_legacy_pic ()) { +/* +* Relies on tsc_early_delay_calibrate() to have given us semi +* usable udelay(), wait for the same 50ms we would have with +* the PIT loop below. +*/ +udelay (10 *USEC_PER_MSEC ); +udelay (10 *USEC_PER_MSEC ); +udelay (10 *USEC_PER_MSEC ); +udelay (10 *USEC_PER_MSEC ); +udelay (10 *USEC_PER_MSEC ); +return ULONG_MAX ; + } +/* Set the Gate high, disable speaker */ outb ((inb (0x61 ) & ~0x02 ) |0x01 ,0x61 );
@@ -487,6 +502,9 @@ static unsigned long quick_pit_calibrate(void)u64 tsc, delta;unsigned long d1, d2; +if (!has_legacy_pic ()) +return 0 ; +/* Set the Gate high, disable speaker */ outb ((inb (0x61 ) & ~0x02 ) |0x01 ,0x61 );
Signature · 1 line
2.15.1
PATCH 1/189 firewire-ohci: work around oversized DMA reads on JMicron controllers
From: Hector Martin <[email protected]>
[ Upstream commit 188775181bc05f29372b305ef96485840e351fde ]
At least some JMicron controllers issue buggy oversized DMA reads when fetching context descriptors, always fetching 0x20 bytes at once for descriptors which are only 0x10 bytes long. This is often harmless, but can cause page faults on modern systems with IOMMUs:
DMAR: [DMA Read] Request device [05:00.0] fault addr fff56000 [fault reason 06] PTE Read access is not set firewire_ohci 0000:05:00.0: DMA context IT0 has stopped, error code: evt_descriptor_read
This works around the problem by always leaving 0x10 padding bytes at the end of descriptor buffer pages, which should be harmless to do unconditionally for controllers in case others have the same behavior.
--- drivers/firewire/ohci.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/firewire/ohci.c +7 -1
@@ -1128,7 +1128,13 @@ static int context_add_buffer(struct context *ctx)return -ENOMEM ; offset = (void *)&desc->buffer - (void *)desc; - desc->buffer_size =PAGE_SIZE - offset; +/* +* Some controllers, like JMicron ones, always issue 0x20-byte DMA reads +* for descriptors, even 0x10-byte ones. This can cause page faults when +* an IOMMU is in use and the oversized read crosses a page boundary. +* Work around this by always leaving at least 0x10 bytes of padding. +*/ + desc->buffer_size =PAGE_SIZE - offset -0x10 ; desc->buffer_bus = bus_addr + offset; desc->used =0 ;
Signature · 1 line
2.15.1
PATCH 3/189 NFSv4: always set NFS_LOCK_LOST when a lock is lost.
From: NeilBrown <[email protected]>
[ Upstream commit dce2630c7da73b0634686bca557cc8945cc450c8 ]
There are 2 comments in the NFSv4 code which suggest that SIGLOST should possibly be sent to a process. In these cases a lock has been lost.
The current practice is to set NFS_LOCK_LOST so that read/write returns EIO when a lock is lost.
So change these comments to code when sets NFS_LOCK_LOST.
One case is when lock recovery after apparent server restart fails with NFS4ERR_DENIED, NFS4ERR_RECLAIM_BAD, or NFS4ERRO_RECLAIM_CONFLICT. The other case is when a lock attempt as part of lease recovery fails with NFS4ERR_DENIED.
In an ideal world, these should not happen. However I have a packet trace showing an NFSv4.1 session getting NFS4ERR_BADSESSION after an extended network parition. The NFSv4.1 client treats this like server reboot until/unless it get NFS4ERR_NO_GRACE, in which case it switches over to "nograce" recovery mode. In this network trace, the client attempts to recover a lock and the server (incorrectly) reports NFS4ERR_DENIED rather than NFS4ERR_NO_GRACE. This leads to the ineffective comment and the client then continues to write using the OPEN stateid.
--- fs/nfs/nfs4proc.c | 12 ++++++++---- fs/nfs/nfs4state.c | 5 ++++- 2 files changed, 12 insertions(+), 5 deletions(-)
fs/nfs/nfs4proc.c +8 -4
@@ -2019,7 +2019,7 @@ static int nfs4_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state *stareturn ret; } -static int nfs4_handle_delegation_recall_error (struct nfs_server *server,struct nfs4_state *state,const nfs4_stateid *stateid,int err) +static int nfs4_handle_delegation_recall_error (struct nfs_server *server,struct nfs4_state *state,const nfs4_stateid *stateid,struct file_lock *fl,int err) {switch (err) {default :
@@ -2066,7 +2066,11 @@ static int nfs4_handle_delegation_recall_error(struct nfs_server *server, structreturn -EAGAIN ;case -ENOMEM :case -NFS4ERR_DENIED : -/* kill_proc(fl->fl_pid, SIGLOST, 1); */ +if (fl) { +struct nfs4_lock_state *lsp = fl->fl_u.nfs4_fl.owner; +if (lsp) +set_bit (NFS_LOCK_LOST , &lsp->ls_flags); + }return 0 ; }return err;
@@ -2102,7 +2106,7 @@ int nfs4_open_delegation_recall(struct nfs_open_context *ctx, err =nfs4_open_recover_helper (opendata,FMODE_READ ); }nfs4_opendata_put (opendata); -return nfs4_handle_delegation_recall_error (server, state, stateid, err); +return nfs4_handle_delegation_recall_error (server, state, stateid,NULL , err); }static void nfs4_open_confirm_prepare (struct rpc_task *task,void *calldata)
@@ -6739,7 +6743,7 @@ int nfs4_lock_delegation_recall(struct file_lock *fl, struct nfs4_state *state,if (err !=0 )return err; err =_nfs4_do_setlk (state,F_SETLK , fl,NFS_LOCK_NEW ); -return nfs4_handle_delegation_recall_error (server, state, stateid, err); +return nfs4_handle_delegation_recall_error (server, state, stateid, fl, err); }struct nfs_release_lockowner_data {
fs/nfs/nfs4state.c +4 -1
@@ -1482,6 +1482,7 @@ static int nfs4_reclaim_locks(struct nfs4_state *state, const struct nfs4_state_struct inode *inode = state->inode;struct nfs_inode *nfsi =NFS_I (inode);struct file_lock *fl; +struct nfs4_lock_state *lsp;int status =0 ;struct file_lock_context *flctx = inode->i_flctx;struct list_head *list;
@@ -1522,7 +1523,9 @@ restart:case -NFS4ERR_DENIED :case -NFS4ERR_RECLAIM_BAD :case -NFS4ERR_RECLAIM_CONFLICT : -/* kill_proc(fl->fl_pid, SIGLOST, 1); */ + lsp = fl->fl_u.nfs4_fl.owner; +if (lsp) +set_bit (NFS_LOCK_LOST , &lsp->ls_flags); status =0 ; }spin_lock (&flctx->flc_lock);
Signature · 1 line
2.15.1
PATCH 6/189 ACPI / LPSS: Do not instiate platform_dev for devs without MMIO resources
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit e1681599345b8466786b6e54a2db2a00a068a3f3 ]
acpi_lpss_create_device() skips handling LPSS devices which do not have a mmio resources in their resource list (typically these devices are disabled by the firmware). But since the LPSS code does not bind to the device, acpi_bus_attach() ends up still creating a platform device for it and the regular platform_driver for the ACPI HID still tries to bind to it.
This happens e.g. on some boards which do not use the pwm-controller and have an empty or invalid resource-table for it. Currently this causes these error messages to get logged:
[ 3.281966] pwm-lpss 80862288:00: invalid resource [ 3.287098] pwm-lpss: probe of 80862288:00 failed with error -22
This commit stops the undesirable creation of a platform_device for disabled LPSS devices by setting pnp.type.platform_id to 0. Note that acpi_scan_attach_handler() also sets pnp.type.platform_id to 0 when there is a matching handler for the device and that handler has no attach callback, so we simply behave as a handler without an attach function in this case.
--- drivers/acpi/acpi_lpss.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/acpi/acpi_lpss.c +2 -0
@@ -465,6 +465,8 @@ static int acpi_lpss_create_device(struct acpi_device *adev,acpi_dev_free_resource_list (&resource_list);if (!pdata->mmio_base) { +/* Avoid acpi_bus_attach() instantiating a pdev for this dev. */ + adev->pnp.type.platform_id =0 ;/* Skip the device, but continue the namespace scan. */ ret =0 ; goto err_out;
Signature · 1 line
2.15.1
PATCH 4/189 nvme: host delete_work and reset_work on separate workqueues
In reply to Sasha LevinFrom: Roy Shterman <[email protected]>
[ Upstream commit b227c59b9b5b8ae52639c8980af853d2f654f90a ]
We need to ensure that delete_work will be hosted on a different workqueue than all the works we flush or cancel from it. Otherwise we may hit a circular dependency warning [1].
Also, given that delete_work flushes reset_work, host reset_work on nvme_reset_wq and delete_work on nvme_delete_wq. In addition, fix the flushing in the individual drivers to flush nvme_delete_wq when draining queued deletes.
[1]:
[ 178.491942] =============================================
[ 178.492718] [ INFO: possible recursive locking detected ]
[ 178.493495] 4.9.0-rc4-c844263313a8-lb #3 Tainted: G OE
[ 178.494382] ---------------------------------------------
[ 178.495160] kworker/5:1/135 is trying to acquire lock:
[ 178.495894] (
[ 178.496120] "nvme-wq"
[ 178.496471] ){++++.+}
[ 178.496599] , at:
[ 178.496921] [<ffffffffa70ac206>] flush_work+0x1a6/0x2d0
[ 178.497670]
but task is already holding lock:
[ 178.498499] (
[ 178.498724] "nvme-wq"
[ 178.499074] ){++++.+}
[ 178.499202] , at:
[ 178.499520] [<ffffffffa70ad6c2>] process_one_work+0x162/0x6a0
[ 178.500343]
other info that might help us debug this:
[ 178.501269] Possible unsafe locking scenario:[ 178.502113] CPU0
[ 178.502472] ----
[ 178.502829] lock(
[ 178.503115] "nvme-wq"
[ 178.503467] );
[ 178.503716] lock(
[ 178.504001] "nvme-wq"
[ 178.504353] );
[ 178.504601]
*** DEADLOCK ***[ 178.505441] May be due to missing lock nesting notation
[ 178.506453] 2 locks held by kworker/5:1/135:
[ 178.507068] #0:
[ 178.507330] (
[ 178.507598] "nvme-wq"
[ 178.507726] ){++++.+}
[ 178.508079] , at:
[ 178.508173] [<ffffffffa70ad6c2>] process_one_work+0x162/0x6a0
[ 178.509004] #1:
[ 178.509265] (
[ 178.509532] (&ctrl->delete_work)
[ 178.509795] ){+.+.+.}
[ 178.510145] , at:
[ 178.510239] [<ffffffffa70ad6c2>] process_one_work+0x162/0x6a0
[ 178.511070]
stack backtrace:
:
[ 178.511693] CPU: 5 PID: 135 Comm: kworker/5:1 Tainted: G OE 4.9.0-rc4-c844263313a8-lb #3
[ 178.512974] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.1-1ubuntu1 04/01/2014
[ 178.514247] Workqueue: nvme-wq nvme_del_ctrl_work [nvme_tcp]
[ 178.515071] ffffc2668175bae0 ffffffffa7450823 ffffffffa88abd80 ffffffffa88abd80
[ 178.516195] ffffc2668175bb98 ffffffffa70eb012 ffffffffa8d8d90d ffff9c472e9ea700
[ 178.517318] ffff9c472e9ea700 ffff9c4700000000 ffff9c4700007200 ab83be61bec0d50e
[ 178.518443] Call Trace:
[ 178.518807] [<ffffffffa7450823>] dump_stack+0x85/0xc2
[ 178.519542] [<ffffffffa70eb012>] __lock_acquire+0x17d2/0x18f0
[ 178.520377] [<ffffffffa75839a7>] ? serial8250_console_putchar+0x27/0x30
[ 178.521330] [<ffffffffa7583980>] ? wait_for_xmitr+0xa0/0xa0
[ 178.522174] [<ffffffffa70ac1eb>] ? flush_work+0x18b/0x2d0
[ 178.522975] [<ffffffffa70eb7cb>] lock_acquire+0x11b/0x220
[ 178.523753] [<ffffffffa70ac206>] ? flush_work+0x1a6/0x2d0
[ 178.524535] [<ffffffffa70ac229>] flush_work+0x1c9/0x2d0
[ 178.525291] [<ffffffffa70ac206>] ? flush_work+0x1a6/0x2d0
[ 178.526077] [<ffffffffa70a9cf0>] ? flush_workqueue_prep_pwqs+0x220/0x220
[ 178.527040] [<ffffffffa70ae7cf>] __cancel_work_timer+0x10f/0x1d0
[ 178.527907] [<ffffffffa70fecb9>] ? vprintk_default+0x29/0x40
[ 178.528726] [<ffffffffa71cb507>] ? printk+0x48/0x50
[ 178.529434] [<ffffffffa70ae8c3>] cancel_delayed_work_sync+0x13/0x20
[ 178.530381] [<ffffffffc042100b>] nvme_stop_ctrl+0x5b/0x70 [nvme_core]
[ 178.531314] [<ffffffffc0403dcc>] nvme_del_ctrl_work+0x2c/0x50 [nvme_tcp]
[ 178.532271] [<ffffffffa70ad741>] process_one_work+0x1e1/0x6a0
[ 178.533101] [<ffffffffa70ad6c2>] ? process_one_work+0x162/0x6a0
[ 178.533954] [<ffffffffa70adc4e>] worker_thread+0x4e/0x490
[ 178.534735] [<ffffffffa70adc00>] ? process_one_work+0x6a0/0x6a0
[ 178.535588] [<ffffffffa70adc00>] ? process_one_work+0x6a0/0x6a0
[ 178.536441] [<ffffffffa70b48cf>] kthread+0xff/0x120
[ 178.537149] [<ffffffffa70b47d0>] ? kthread_park+0x60/0x60
[ 178.538094] [<ffffffffa70b47d0>] ? kthread_park+0x60/0x60
[ 178.538900] [<ffffffffa78e332a>] ret_from_fork+0x2a/0x40--- drivers/nvme/host/core.c | 44 +++++++++++++++++++++++++++++++++++++++----- drivers/nvme/host/nvme.h | 2 ++ drivers/nvme/host/rdma.c | 2 +- drivers/nvme/target/loop.c | 2 +- 4 files changed, 43 insertions(+), 7 deletions(-)
drivers/nvme/host/core.c +39 -5
@@ -65,9 +65,26 @@ static bool streams;module_param (streams, bool,0644 );MODULE_PARM_DESC (streams,"turn on support for Streams write directives" ); +/* +* nvme_wq - hosts nvme related works that are not reset or delete +* nvme_reset_wq - hosts nvme reset works +* nvme_delete_wq - hosts nvme delete works +* +* nvme_wq will host works such are scan, aen handling, fw activation, +* keep-alive error recovery, periodic reconnects etc. nvme_reset_wq +* runs reset works which also flush works hosted on nvme_wq for +* serialization purposes. nvme_delete_wq host controller deletion +* works which flush reset works for serialization. +*/ struct workqueue_struct *nvme_wq;EXPORT_SYMBOL_GPL (nvme_wq); +struct workqueue_struct *nvme_reset_wq; +EXPORT_SYMBOL_GPL (nvme_reset_wq); + +struct workqueue_struct *nvme_delete_wq; +EXPORT_SYMBOL_GPL (nvme_delete_wq); +static DEFINE_IDA (nvme_subsystems_ida);static LIST_HEAD (nvme_subsystems);static DEFINE_MUTEX (nvme_subsystems_lock);
@@ -89,7 +106,7 @@ int nvme_reset_ctrl(struct nvme_ctrl *ctrl) {if (!nvme_change_ctrl_state (ctrl,NVME_CTRL_RESETTING ))return -EBUSY ; -if (!queue_work (nvme_wq, &ctrl->reset_work)) +if (!queue_work (nvme_reset_wq, &ctrl->reset_work))return -EBUSY ;return 0 ; }
@@ -122,7 +139,7 @@ int nvme_delete_ctrl(struct nvme_ctrl *ctrl) {if (!nvme_change_ctrl_state (ctrl,NVME_CTRL_DELETING ))return -EBUSY ; -if (!queue_work (nvme_wq, &ctrl->delete_work)) +if (!queue_work (nvme_delete_wq, &ctrl->delete_work))return -EBUSY ;return 0 ; }
@@ -3491,16 +3508,26 @@ EXPORT_SYMBOL_GPL(nvme_reinit_tagset);int __init nvme_core_init (void ) { -int result; +int result = -ENOMEM ; nvme_wq =alloc_workqueue ("nvme-wq" ,WQ_UNBOUND |WQ_MEM_RECLAIM |WQ_SYSFS ,0 );if (!nvme_wq) -return -ENOMEM ; + goto out; + + nvme_reset_wq =alloc_workqueue ("nvme-reset-wq" , +WQ_UNBOUND |WQ_MEM_RECLAIM |WQ_SYSFS ,0 ); +if (!nvme_reset_wq) + goto destroy_wq; + + nvme_delete_wq =alloc_workqueue ("nvme-delete-wq" , +WQ_UNBOUND |WQ_MEM_RECLAIM |WQ_SYSFS ,0 ); +if (!nvme_delete_wq) + goto destroy_reset_wq; result =alloc_chrdev_region (&nvme_chr_devt,0 ,NVME_MINORS ,"nvme" );if (result <0 ) - goto destroy_wq; + goto destroy_delete_wq; nvme_class =class_create (THIS_MODULE ,"nvme" );if (IS_ERR (nvme_class)) {
@@ -3519,8 +3546,13 @@ destroy_class:class_destroy (nvme_class); unregister_chrdev:unregister_chrdev_region (nvme_chr_devt,NVME_MINORS ); +destroy_delete_wq: +destroy_workqueue (nvme_delete_wq); +destroy_reset_wq: +destroy_workqueue (nvme_reset_wq); destroy_wq:destroy_workqueue (nvme_wq); +out:return result; }
@@ -3530,6 +3562,8 @@ void nvme_core_exit(void)class_destroy (nvme_subsys_class);class_destroy (nvme_class);unregister_chrdev_region (nvme_chr_devt,NVME_MINORS ); +destroy_workqueue (nvme_delete_wq); +destroy_workqueue (nvme_reset_wq);destroy_workqueue (nvme_wq); }
drivers/nvme/host/nvme.h +2 -0
@@ -32,6 +32,8 @@ extern unsigned int admin_timeout;#define NVME_KATO_GRACE 10extern struct workqueue_struct *nvme_wq; +extern struct workqueue_struct *nvme_reset_wq; +extern struct workqueue_struct *nvme_delete_wq;enum {NVME_NS_LBA =0 ,
drivers/nvme/host/rdma.c +1 -1
@@ -2040,7 +2040,7 @@ static void nvme_rdma_remove_one(struct ib_device *ib_device, void *client_data) }mutex_unlock (&nvme_rdma_ctrl_mutex); -flush_workqueue (nvme_wq); +flush_workqueue (nvme_delete_wq); }static struct ib_client nvme_rdma_ib_client = {
drivers/nvme/target/loop.c +1 -1
@@ -716,7 +716,7 @@ static void __exit nvme_loop_cleanup_module(void)nvme_delete_ctrl (&ctrl->ctrl);mutex_unlock (&nvme_loop_ctrl_mutex); -flush_workqueue (nvme_wq); +flush_workqueue (nvme_delete_wq); }module_init (nvme_loop_init_module);
Signature · 1 line
2.15.1
PATCH 5/189 hwmon: (ina2xx) Fix access to uninitialized mutex
In reply to Sasha LevinFrom: Marek Szyprowski <[email protected]>
[ Upstream commit 0c4c5860e9983eb3da7a3d73ca987643c3ed034b ]
Initialize data->config_lock mutex before it is used by the driver code.
This fixes following warning on Odroid XU3 boards:
INFO: trying to register non-static key.
the code is fine but needs lockdep annotation.
turning off the locking correctness validator.
CPU: 5 PID: 1 Comm: swapper/0 Not tainted 4.15.0-rc7-next-20180115-00001-gb75575dee3f2 #107 Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [<c0111504>] (unwind_backtrace) from [<c010dbec>] (show_stack+0x10/0x14) [<c010dbec>] (show_stack) from [<c09b3f74>] (dump_stack+0x90/0xc8) [<c09b3f74>] (dump_stack) from [<c0179528>] (register_lock_class+0x1c0/0x59c) [<c0179528>] (register_lock_class) from [<c017bd1c>] (__lock_acquire+0x78/0x1850) [<c017bd1c>] (__lock_acquire) from [<c017de30>] (lock_acquire+0xc8/0x2b8) [<c017de30>] (lock_acquire) from [<c09ca59c>] (__mutex_lock+0x60/0xa0c) [<c09ca59c>] (__mutex_lock) from [<c09cafd0>] (mutex_lock_nested+0x1c/0x24) [<c09cafd0>] (mutex_lock_nested) from [<c068b0d0>] (ina2xx_set_shunt+0x70/0xb0) [<c068b0d0>] (ina2xx_set_shunt) from [<c068b218>] (ina2xx_probe+0x88/0x1b0) [<c068b218>] (ina2xx_probe) from [<c0673d90>] (i2c_device_probe+0x1e0/0x2d0) [<c0673d90>] (i2c_device_probe) from [<c053a268>] (driver_probe_device+0x2b8/0x4a0) [<c053a268>] (driver_probe_device) from [<c053a54c>] (__driver_attach+0xfc/0x120) [<c053a54c>] (__driver_attach) from [<c05384cc>] (bus_for_each_dev+0x58/0x7c) [<c05384cc>] (bus_for_each_dev) from [<c0539590>] (bus_add_driver+0x174/0x250) [<c0539590>] (bus_add_driver) from [<c053b5e0>] (driver_register+0x78/0xf4) [<c053b5e0>] (driver_register) from [<c0675ef0>] (i2c_register_driver+0x38/0xa8) [<c0675ef0>] (i2c_register_driver) from [<c0102b40>] (do_one_initcall+0x48/0x18c) [<c0102b40>] (do_one_initcall) from [<c0e00df0>] (kernel_init_freeable+0x110/0x1d4) [<c0e00df0>] (kernel_init_freeable) from [<c09c8120>] (kernel_init+0x8/0x114) [<c09c8120>] (kernel_init) from [<c01010b4>] (ret_from_fork+0x14/0x20)
--- drivers/hwmon/ina2xx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/hwmon/ina2xx.c +1 -2
@@ -438,6 +438,7 @@ static int ina2xx_probe(struct i2c_client *client,/* set the device type */ data->config = &ina2xx_config[chip]; +mutex_init (&data->config_lock);if (of_property_read_u32 (dev->of_node,"shunt-resistor" , &val) <0 ) {struct ina2xx_platform_data *pdata =dev_get_platdata (dev);
@@ -467,8 +468,6 @@ static int ina2xx_probe(struct i2c_client *client,return -ENODEV ; } -mutex_init (&data->config_lock); - data->groups[group++] = &ina2xx_group;if (id->driver_data == ina226) data->groups[group++] = &ina226_group;
Signature · 1 line
2.15.1
PATCH 10/189 kvm: x86: fix KVM_XEN_HVM_CONFIG ioctl
In reply to Sasha LevinFrom: Paolo Bonzini <[email protected]>
[ Upstream commit 51776043afa415435c7e4636204fbe4f7edc4501 ]
This ioctl is obsolete (it was used by Xenner as far as I know) but still let's not break it gratuitously... Its handler is copying directly into struct kvm. Go through a bounce buffer instead, with the added benefit that we can actually do something useful with the flags argument---the previous code was exiting with -EINVAL but still doing the copy.
This technically is a userspace ABI breakage, but since no one should be using the ioctl, it's a good occasion to see if someone actually complains.
--- arch/x86/kvm/x86.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
arch/x86/kvm/x86.c +4 -3
@@ -4244,13 +4244,14 @@ set_identity_unlock:mutex_unlock (&kvm->lock);break ;case KVM_XEN_HVM_CONFIG : { +struct kvm_xen_hvm_config xhc; r = -EFAULT ; -if (copy_from_user (&kvm->arch.xen_hvm_config, argp, -sizeof (struct kvm_xen_hvm_config ))) +if (copy_from_user (&xhc, argp,sizeof (xhc))) goto out; r = -EINVAL ; -if (kvm->arch.xen_hvm_config.flags) +if (xhc.flags) goto out; +memcpy (&kvm->arch.xen_hvm_config, &xhc,sizeof (xhc)); r =0 ;break ; }
Signature · 1 line
2.15.1
PATCH 7/189 tipc: fix a potental access after delete in tipc_sk_join()
In reply to Sasha LevinFrom: Jon Maloy <[email protected]>
[ Upstream commit febafc8455fdbb0ba53d596075068a683b75f355 ]
In commit d12d2e12cec2 "tipc: send out join messages as soon as new member is discovered") we added a call to the function tipc_group_join() without considering the case that the preceding tipc_sk_publish() might have failed, and the group item already deleted.
We fix this by returning from tipc_sk_join() directly after the failed tipc_sk_publish.
--- net/tipc/socket.c | 1 + 1 file changed, 1 insertion(+)
net/tipc/socket.c +1 -0
@@ -2759,6 +2759,7 @@ static int tipc_sk_join(struct tipc_sock *tsk, struct tipc_group_req *mreq)if (rc) {tipc_group_delete (net, grp); tsk->group =NULL ; +return rc; }/* Eliminate any risk that a broadcast overtakes the sent JOIN */
Signature · 1 line
2.15.1
PATCH 8/189 ALSA: hda - Use IS_REACHABLE() for dependency on input
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit c469652bb5e8fb715db7d152f46d33b3740c9b87 ]
The commit ffcd28d88e4f ("ALSA: hda - Select INPUT for Realtek HD-audio codec") introduced the reverse-selection of CONFIG_INPUT for Realtek codec in order to avoid the mess with dependency between built-in and modules. Later on, we obtained IS_REACHABLE() macro exactly for this kind of problems, and now we can remove th INPUT selection in Kconfig and put IS_REACHABLE(INPUT) to the appropriate places in the code, so that the driver doesn't need to select other subsystem forcibly.
--- sound/pci/hda/Kconfig | 1 - sound/pci/hda/patch_realtek.c | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-)
sound/pci/hda/Kconfig +0 -1
@@ -88,7 +88,6 @@ config SND_HDA_PATCH_LOADER config SND_HDA_CODEC_REALTEK tristate "Build Realtek HD-audio codec support" select SND_HDA_GENERIC - select INPUT help Say Y or M here to include Realtek HD-audio codec support in snd-hda-intel driver, such as ALC880.
sound/pci/hda/patch_realtek.c +5 -0
@@ -3744,6 +3744,7 @@ static void alc280_fixup_hp_gpio4(struct hda_codec *codec, } } +#if IS_REACHABLE (INPUT )static void gpio2_mic_hotkey_event (struct hda_codec *codec,struct hda_jack_callback *event) {
@@ -3876,6 +3877,10 @@ static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec, spec->kb_dev = NULL; } } +#else /* INPUT */ +#define alc280_fixup_hp_gpio2_mic_hotkey NULL +#define alc233_fixup_lenovo_line2_mic_hotkey NULL +#endif /* INPUT */ static void alc269_fixup_hp_line1_mic1_led (struct hda_codec *codec,const struct hda_fixup *fix,int action)
Signature · 1 line
2.15.1
PATCH 9/189 ASoC: au1x: Fix timeout tests in au1xac97c_ac97_read()
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit 123af9043e93cb6f235207d260d50f832cdb5439 ]
The loop timeout doesn't work because it's a post op and ends with "tmo" set to -1. I changed it from a post-op to a pre-op and I changed the initial the starting value from 5 to 6 so we still iterate 5 times. I left the other as it was because it's a large number.
--- sound/soc/au1x/ac97c.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/au1x/ac97c.c +3 -3
@@ -91,8 +91,8 @@ static unsigned short au1xac97c_ac97_read(struct snd_ac97 *ac97, do { mutex_lock(&ctx->lock); - tmo = 5; - while ((RD(ctx, AC97_STATUS) & STAT_CP) && tmo--) + tmo = 6; + while ((RD(ctx, AC97_STATUS) & STAT_CP) && --tmo) udelay(21); /* wait an ac97 frame time */ if (!tmo) { pr_debug("ac97rd timeout #1\n");
@@ -105,7 +105,7 @@ static unsigned short au1xac97c_ac97_read(struct snd_ac97 *ac97,* poll, Forrest, poll... */ tmo =0x10000 ; -while ((RD (ctx,AC97_STATUS ) &STAT_CP ) && tmo--) +while ((RD (ctx,AC97_STATUS ) &STAT_CP ) && --tmo) asmvolatile ("nop" ); data =RD (ctx,AC97_CMDRESP );
Signature · 1 line
2.15.1
PATCH 11/189 RDMA/core: Clarify rdma_ah_find_type
In reply to Sasha LevinFrom: Parav Pandit <[email protected]>
[ Upstream commit a6532e7139660c103dda181aa5b2c734aa26ed6c ]
iWARP does not use rdma_ah_attr_type, and for this reason we do not have a RDMA_AH_ATTR_TYPE_IWARP. rdma_ah_find_type should not even be called on iwarp ports and for clarity it shouldn't have a special test for iWarp.
This changes the result from RDMA_AH_ATTR_TYPE_ROCE to RDMA_AH_ATTR_TYPE_IB when wrongly called on an iWarp port.
--- include/rdma/ib_verbs.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
include/rdma/ib_verbs.h +1 -2
@@ -3793,8 +3793,7 @@ static inline void rdma_ah_set_grh(struct rdma_ah_attr *attr,static inline enum rdma_ah_attr_type rdma_ah_find_type (struct ib_device *dev,u32 port_num) { -if ((rdma_protocol_roce (dev, port_num)) || - (rdma_protocol_iwarp (dev, port_num))) +if (rdma_protocol_roce (dev, port_num))return RDMA_AH_ATTR_TYPE_ROCE ;else if ((rdma_protocol_ib (dev, port_num)) && (rdma_cap_opa_ah (dev, port_num)))
Signature · 1 line
2.15.1
PATCH 12/189 KVM: PPC: Book3S HV: Enable migration of decrementer register
In reply to Sasha LevinFrom: Paul Mackerras <[email protected]>
[ Upstream commit 5855564c8ab2d9cefca7b2933bd19818eb795e40 ]
This adds a register identifier for use with the one_reg interface to allow the decrementer expiry time to be read and written by userspace. The decrementer expiry time is in guest timebase units and is equal to the sum of the decrementer and the guest timebase. (The expiry time is used rather than the decrementer value itself because the expiry time is not constantly changing, though the decrementer value is, while the guest vcpu is not running.)
Without this, a guest vcpu migrated to a new host will see its decrementer set to some random value. On POWER8 and earlier, the decrementer is 32 bits wide and counts down at 512MHz, so the guest vcpu will potentially see no decrementer interrupts for up to about 4 seconds, which will lead to a stall. With POWER9, the decrementer is now 56 bits side, so the stall can be much longer (up to 2.23 years) and more noticeable.
To help work around the problem in cases where userspace has not been updated to migrate the decrementer expiry time, we now set the default decrementer expiry at vcpu creation time to the current time rather than the maximum possible value. This should mean an immediate decrementer interrupt when a migrated vcpu starts running. In cases where the decrementer is 32 bits wide and more than 4 seconds elapse between the creation of the vcpu and when it first runs, the decrementer would have wrapped around to positive values and there may still be a stall - but this is no worse than the current situation. In the large-decrementer case, we are sure to get an immediate decrementer interrupt (assuming the time from vcpu creation to first run is less than 2.23 years) and we thus avoid a very long stall.
--- Documentation/virtual/kvm/api.txt | 1 + arch/powerpc/include/uapi/asm/kvm.h | 2 ++ arch/powerpc/kvm/book3s_hv.c | 8 ++++++++ arch/powerpc/kvm/powerpc.c | 2 +- 4 files changed, 12 insertions(+), 1 deletion(-)
Documentation/virtual/kvm/api.txt +1 -0
@@ -1841,6 +1841,7 @@ registers, find a list below: PPC | KVM_REG_PPC_DBSR | 32 PPC | KVM_REG_PPC_TIDR | 64 PPC | KVM_REG_PPC_PSSCR | 64 + PPC | KVM_REG_PPC_DEC_EXPIRY | 64 PPC | KVM_REG_PPC_TM_GPR0 | 64 ... PPC | KVM_REG_PPC_TM_GPR31 | 64
arch/powerpc/include/uapi/asm/kvm.h +2 -0
@@ -632,6 +632,8 @@ struct kvm_ppc_cpu_char {#define KVM_REG_PPC_TIDR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xbc)#define KVM_REG_PPC_PSSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xbd) +#define KVM_REG_PPC_DEC_EXPIRY (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xbe) +/* Transactional Memory checkpointed state: * This is all GPRs, all VSX regs and a subset of SPRs */
arch/powerpc/kvm/book3s_hv.c +8 -0
@@ -1504,6 +1504,10 @@ static int kvmppc_get_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,case KVM_REG_PPC_ARCH_COMPAT : *val =get_reg_val (id, vcpu->arch.vcore->arch_compat);break ; +case KVM_REG_PPC_DEC_EXPIRY : + *val =get_reg_val (id, vcpu->arch.dec_expires + + vcpu->arch.vcore->tb_offset); +break ;default : r = -EINVAL ;break ;
@@ -1731,6 +1735,10 @@ static int kvmppc_set_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,case KVM_REG_PPC_ARCH_COMPAT : r =kvmppc_set_arch_compat (vcpu,set_reg_val (id, *val));break ; +case KVM_REG_PPC_DEC_EXPIRY : + vcpu->arch.dec_expires =set_reg_val (id, *val) - + vcpu->arch.vcore->tb_offset; +break ;default : r = -EINVAL ;break ;
arch/powerpc/kvm/powerpc.c +1 -1
@@ -763,7 +763,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)hrtimer_init (&vcpu->arch.dec_timer,CLOCK_REALTIME ,HRTIMER_MODE_ABS ); vcpu->arch.dec_timer.function = kvmppc_decrementer_wakeup; - vcpu->arch.dec_expires = ~(u64 )0 ; + vcpu->arch.dec_expires =get_tb ();#ifdef CONFIG_KVM_EXIT_TIMING mutex_init (&vcpu->arch.exit_timing_lock);
Signature · 1 line
2.15.1
PATCH 19/189 printk: Add console owner and waiter logic to load balance console writes
In reply to Sasha LevinFrom: "Steven Rostedt (VMware)" <[email protected]>
[ Upstream commit dbdda842fe96f8932bae554f0adf463c27c42bc7 ]
This patch implements what I discussed in Kernel Summit. I added lockdep annotation (hopefully correctly), and it hasn't had any splats (since I fixed some bugs in the first iterations). It did catch problems when I had the owner covering too much. But now that the owner is only set when actively calling the consoles, lockdep has stayed quiet.
Here's the design again:
I added a "console_owner" which is set to a task that is actively writing to the consoles. It is *not* the same as the owner of the console_lock. It is only set when doing the calls to the console functions. It is protected by a console_owner_lock which is a raw spin lock.
There is a console_waiter. This is set when there is an active console owner that is not current, and waiter is not set. This too is protected by console_owner_lock.
In printk() when it tries to write to the consoles, we have:
if (console_trylock()) console_unlock();
Now I added an else, which will check if there is an active owner, and no current waiter. If that is the case, then console_waiter is set, and the task goes into a spin until it is no longer set.
When the active console owner finishes writing the current message to the consoles, it grabs the console_owner_lock and sees if there is a waiter, and clears console_owner.
If there is a waiter, then it breaks out of the loop, clears the waiter flag (because that will release the waiter from its spin), and exits. Note, it does *not* release the console semaphore. Because it is a semaphore, there is no owner. Another task may release it. This means that the waiter is guaranteed to be the new console owner! Which it becomes.
Then the waiter calls console_unlock() and continues to write to the consoles.
If another task comes along and does a printk() it too can become the new waiter, and we wash rinse and repeat!
By Petr Mladek about possible new deadlocks:
The thing is that we move console_sem only to printk() call that normally calls console_unlock() as well. It means that the transferred owner should not bring new type of dependencies. As Steven said somewhere: "If there is a deadlock, it was there even before."
We could look at it from this side. The possible deadlock would look like:
CPU0 CPU1
console_unlock()
console_owner = current;
spin_lockA()
printk()
spin = true;
while (...)
call_console_drivers()
spin_lockA()This would be a deadlock. CPU0 would wait for the lock A. While CPU1 would own the lockA and would wait for CPU0 to finish calling the console drivers and pass the console_sem owner.
But if the above is true than the following scenario was already possible before:
CPU0
spin_lockA()
printk()
console_unlock()
call_console_drivers()
spin_lockA()
By other words, this deadlock was there even before. Such deadlocks are prevented by using printk_deferred() in the sections guarded by the lock A.
By Steven Rostedt:
To demonstrate the issue, this module has been shown to lock up a system with 4 CPUs and a slow console (like a serial console). It is also able to lock up a 8 CPU system with only a fast (VGA) console, by passing in "loops=100". The changes in this commit prevent this module from locking up the system.
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/sched.h>
#include <linux/mutex.h>
#include <linux/workqueue.h>
#include <linux/hrtimer.h>
static bool stop_testing;
static unsigned int loops = 1;
static void preempt_printk_workfn(struct work_struct *work) {
int i;
while (!READ_ONCE(stop_testing)) {
for (i = 0; i < loops && !READ_ONCE(stop_testing); i++) {
preempt_disable(); pr_emerg("%5d%-75s\n", smp_processor_id(),
" XXX NOPREEMPT");
preempt_enable();
}
msleep(1);
}
}
static struct work_struct __percpu *works;
static void finish(void)
{
int cpu;
WRITE_ONCE(stop_testing, true); for_each_online_cpu(cpu)
flush_work(per_cpu_ptr(works, cpu));
free_percpu(works);
}
static int __init test_init(void)
{
int cpu;
works = alloc_percpu(struct work_struct);
if (!works)
return -ENOMEM;
/*
* This is just a test module. This will break if you
* do any CPU hot plugging between loading and
* unloading the module.
*/
for_each_online_cpu(cpu) {
struct work_struct *work = per_cpu_ptr(works, cpu);
INIT_WORK(work, &preempt_printk_workfn); schedule_work_on(cpu, work);
}
return 0;
}
static void __exit test_exit(void)
{
finish();
}
module_param(loops, uint, 0);
module_init(test_init);
module_exit(test_exit);
MODULE_LICENSE("GPL");
--- kernel/printk/printk.c | 108 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 107 insertions(+), 1 deletion(-)
kernel/printk/printk.c +107 -1
@@ -86,8 +86,15 @@ EXPORT_SYMBOL_GPL(console_drivers);static struct lockdep_map console_lock_dep_map = { .name ="console_lock" }; +static struct lockdep_map console_owner_dep_map = { + .name ="console_owner" +};#endif +static DEFINE_RAW_SPINLOCK (console_owner_lock); +static struct task_struct *console_owner; +static bool console_waiter; +enum devkmsg_log_bits { __DEVKMSG_LOG_BIT_ON =0 , __DEVKMSG_LOG_BIT_OFF,
@@ -1753,8 +1760,56 @@ asmlinkage int vprintk_emit(int facility, int level,* semaphore. The release will print out buffers and wake up * /dev/kmsg and syslog() users. */ -if (console_trylock ()) +if (console_trylock ()) {console_unlock (); + }else { +struct task_struct *owner =NULL ; +bool waiter; +bool spin = false; + +printk_safe_enter_irqsave (flags); + +raw_spin_lock (&console_owner_lock); + owner =READ_ONCE (console_owner); + waiter =READ_ONCE (console_waiter); +if (!waiter && owner && owner != current) { +WRITE_ONCE (console_waiter, true); + spin = true; + } +raw_spin_unlock (&console_owner_lock); + +/* +* If there is an active printk() writing to the +* consoles, instead of having it write our data too, +* see if we can offload that load from the active +* printer, and do some printing ourselves. +* Go into a spin only if there isn't already a waiter +* spinning, and there is an active printer, and +* that active printer isn't us (recursive printk?). +*/ +if (spin) { +/* We spin waiting for the owner to release us */ +spin_acquire (&console_owner_dep_map,0 ,0 , _THIS_IP_); +/* Owner will clear console_waiter on hand off */ +while (READ_ONCE (console_waiter)) +cpu_relax (); + +spin_release (&console_owner_dep_map,1 , _THIS_IP_); +printk_safe_exit_irqrestore (flags); + +/* +* The owner passed the console lock to us. +* Since we did not spin on console lock, annotate +* this as a trylock. Otherwise lockdep will +* complain. +*/ +mutex_acquire (&console_lock_dep_map,0 ,1 , _THIS_IP_); +console_unlock (); +printk_safe_enter_irqsave (flags); + } +printk_safe_exit_irqrestore (flags); + + } }return printed_len;
@@ -2141,6 +2196,7 @@ void console_unlock(void)static u64 seen_seq;unsigned long flags;bool wake_klogd = false; +bool waiter = false;bool do_cond_resched, retry;if (console_suspended) {
@@ -2229,14 +2285,64 @@ skip: console_seq++;raw_spin_unlock (&logbuf_lock); +/* +* While actively printing out messages, if another printk() +* were to occur on another CPU, it may wait for this one to +* finish. This task can not be preempted if there is a +* waiter waiting to take over. +*/ +raw_spin_lock (&console_owner_lock); + console_owner = current; +raw_spin_unlock (&console_owner_lock); + +/* The waiter may spin on us after setting console_owner */ +spin_acquire (&console_owner_dep_map,0 ,0 , _THIS_IP_); +stop_critical_timings ();/* don't trace print latency */ call_console_drivers (ext_text, ext_len, text, len);start_critical_timings (); + +raw_spin_lock (&console_owner_lock); + waiter =READ_ONCE (console_waiter); + console_owner =NULL ; +raw_spin_unlock (&console_owner_lock); + +/* +* If there is a waiter waiting for us, then pass the +* rest of the work load over to that waiter. +*/ +if (waiter) +break ; + +/* There was no waiter, and nothing will spin on us here */ +spin_release (&console_owner_dep_map,1 , _THIS_IP_); +printk_safe_exit_irqrestore (flags);if (do_cond_resched)cond_resched (); } + +/* +* If there is an active waiter waiting on the console_lock. +* Pass off the printing to the waiter, and the waiter +* will continue printing on its CPU, and when all writing +* has finished, the last printer will wake up klogd. +*/ +if (waiter) { +WRITE_ONCE (console_waiter, false); +/* The waiter is now free to continue */ +spin_release (&console_owner_dep_map,1 , _THIS_IP_); +/* +* Hand off console_lock to waiter. The waiter will perform +* the up(). After this, the waiter is the console_lock owner. +*/ +mutex_release (&console_lock_dep_map,1 , _THIS_IP_); +printk_safe_exit_irqrestore (flags); +/* Note, if waiter is set, logbuf_lock is not held */ +return ; + } + console_locked =0 ;/* Release the exclusive_console once it is used */
Signature · 1 line
2.15.1
PATCH 13/189 netfilter: ipv6: nf_defrag: Pass on packets to stack per RFC2460
In reply to Sasha LevinFrom: Subash Abhinov Kasiviswanathan <[email protected]>
[ Upstream commit 83f1999caeb14e15df205e80d210699951733287 ]
ipv6_defrag pulls network headers before fragment header. In case of an error, the netfilter layer is currently dropping these packets. This results in failure of some IPv6 standards tests which passed on older kernels due to the netfilter framework using cloning.
The test case run here is a check for ICMPv6 error message replies when some invalid IPv6 fragments are sent. This specific test case is listed in https://www.ipv6ready.org/docs/Core_Conformance_Latest.pdf
in the Extension Header Processing Order section.
A packet with unrecognized option Type 11 is sent and the test expects an ICMP error in line with RFC2460 section 4.2 -
11 - discard the packet and, only if the packet's Destination
Address was not a multicast address, send an ICMP Parameter Problem, Code 2, message to the packet's Source Address, pointing to the unrecognized Option Type.
Since netfilter layer now drops all invalid IPv6 frag packets, we no longer see the ICMP error message and fail the test case.
To fix this, save the transport header. If defrag is unable to process the packet due to RFC2460, restore the transport header and allow packet to be processed by stack. There is no change for other packet processing paths.
Tested by confirming that stack sends an ICMP error when it receives these packets. Also tested that fragmented ICMP pings succeed.
v1->v2: Instead of cloning always, save the transport_header and restore it in case of this specific error. Update the title and commit message accordingly.
--- net/ipv6/netfilter/nf_conntrack_reasm.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
net/ipv6/netfilter/nf_conntrack_reasm.c +10 -5
@@ -231,7 +231,7 @@ static int nf_ct_frag6_queue(struct frag_queue *fq, struct sk_buff *skb,if ((unsigned int )end >IPV6_MAXPLEN ) {pr_debug ("offset is too large.\n" ); -return -1 ; +return -EINVAL ; } ecn =ip6_frag_ecn (ipv6_hdr (skb));
@@ -264,7 +264,7 @@ static int nf_ct_frag6_queue(struct frag_queue *fq, struct sk_buff *skb,* this case. -DaveM */ pr_debug ("end of fragment not rounded to 8 bytes.\n" ); -return -1 ; +return -EPROTO ; }if (end > fq->q.len) {/* Some bits beyond end -> corruption. */
@@ -358,7 +358,7 @@ found: discard_fq:inet_frag_kill (&fq->q, &nf_frags); err: -return -1 ; +return -EINVAL ; }/*
@@ -567,6 +567,7 @@ find_prev_fhdr(struct sk_buff *skb, u8 *prevhdrp, int *prevhoff, int *fhoff)int nf_ct_frag6_gather (struct net *net,struct sk_buff *skb,u32 user) { +u16 savethdr = skb->transport_header;struct net_device *dev = skb->dev;int fhoff, nhoff, ret;struct frag_hdr *fhdr;
@@ -600,8 +601,12 @@ int nf_ct_frag6_gather(struct net *net, struct sk_buff *skb, u32 user)spin_lock_bh (&fq->q.lock); -if (nf_ct_frag6_queue (fq, skb, fhdr, nhoff) <0 ) { - ret = -EINVAL ; + ret =nf_ct_frag6_queue (fq, skb, fhdr, nhoff); +if (ret <0 ) { +if (ret == -EPROTO ) { + skb->transport_header = savethdr; + ret =0 ; + } goto out_unlock; }
Signature · 1 line
2.15.1
PATCH 14/189 tracing/hrtimer: Fix tracing bugs by taking all clock bases and modes into account
In reply to Sasha LevinFrom: Anna-Maria Gleixner <[email protected]>
[ Upstream commit 91633eed73a3ac37aaece5c8c1f93a18bae616a9 ]
So far only CLOCK_MONOTONIC and CLOCK_REALTIME were taken into account as well as HRTIMER_MODE_ABS/REL in the hrtimer_init tracepoint. The query for detecting the ABS or REL timer modes is not valid anymore, it got broken by the introduction of HRTIMER_MODE_PINNED.
HRTIMER_MODE_PINNED is not evaluated in the hrtimer_init() call, but for the sake of completeness print all given modes.
--- include/trace/events/timer.h | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
include/trace/events/timer.h +16 -4
@@ -136,6 +136,20 @@ DEFINE_EVENT(timer_class, timer_cancel,TP_ARGS (timer) ); +#define decode_clockid (type) \ + __print_symbolic(type, \ + { CLOCK_REALTIME, "CLOCK_REALTIME" }, \ + { CLOCK_MONOTONIC, "CLOCK_MONOTONIC" }, \ + { CLOCK_BOOTTIME, "CLOCK_BOOTTIME" }, \ + { CLOCK_TAI, "CLOCK_TAI" }) + +#define decode_hrtimer_mode (mode) \ + __print_symbolic(mode, \ + { HRTIMER_MODE_ABS, "ABS" }, \ + { HRTIMER_MODE_REL, "REL" }, \ + { HRTIMER_MODE_ABS_PINNED, "ABS|PINNED" }, \ + { HRTIMER_MODE_REL_PINNED, "REL|PINNED" }) +/** * hrtimer_init - called when the hrtimer is initialized * @hrtimer: pointer to struct hrtimer
@@ -162,10 +176,8 @@ TRACE_EVENT(hrtimer_init, ),TP_printk ("hrtimer=%p clockid=%s mode=%s" , __entry->hrtimer, - __entry->clockid ==CLOCK_REALTIME ? -"CLOCK_REALTIME" :"CLOCK_MONOTONIC" , - __entry->mode ==HRTIMER_MODE_ABS ? -"HRTIMER_MODE_ABS" :"HRTIMER_MODE_REL" ) +decode_clockid (__entry->clockid), +decode_hrtimer_mode (__entry->mode)) );/**
Signature · 1 line
2.15.1
PATCH 20/189 selftest: ftrace: Fix to pick text symbols for kprobes
In reply to Sasha LevinFrom: Masami Hiramatsu <[email protected]>
[ Upstream commit 5e46664703b364434a2cbda3e6988fc24ae0ced5 ]
Fix to pick text symbols for multiple kprobe testcase. kallsyms shows text symbols with " t " or " T " but current testcase picks all symbols including "t", so it picks data symbols if it includes 't' (e.g. "str").
This fixes it to find symbol lines with " t " or " T " (including spaces).
--- tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc +2 -2
@@ -12,8 +12,8 @@ case `uname -m` in *) OFFS=0;; esac -echo "Setup up to 256 kprobes" -grep t /proc/kallsyms | cut -f3 -d" " | grep -v .*\\..* | \ +echo "Setup up kprobes on first 256 text symbols" +grep -i " t " /proc/kallsyms | cut -f3 -d" " | grep -v .*\\..* | \ head -n 256 | while read i; do echo p ${i}+${OFFS} ; done > kprobe_events ||: echo 1 > events/kprobes/enable
Signature · 1 line
2.15.1
PATCH 15/189 KVM: s390: use created_vcpus in more places
In reply to Sasha LevinFrom: Christian Borntraeger <[email protected]>
[ Upstream commit 241e3ec0faf5ab1a0d9b1f6c43eefa919fb9c112 ]
commit a03825bbd0c3 ("KVM: s390: use kvm->created_vcpus") introduced kvm->created_vcpus to avoid races with the existing kvm->online_vcpus scheme. One place was "forgotten" and one new place was "added". Let's fix those.
--- arch/s390/kvm/kvm-s390.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/s390/kvm/kvm-s390.c +2 -2
@@ -602,7 +602,7 @@ static int kvm_vm_ioctl_enable_cap(struct kvm *kvm, struct kvm_enable_cap *cap)case KVM_CAP_S390_GS : r = -EINVAL ;mutex_lock (&kvm->lock); -if (atomic_read (&kvm->online_vcpus)) { +if (kvm->created_vcpus) { r = -EBUSY ; }else if (test_facility (133 )) {set_kvm_facility (kvm->arch.model.fac_mask,133 );
@@ -1122,7 +1122,7 @@ static int kvm_s390_set_processor_feat(struct kvm *kvm,return -EINVAL ;mutex_lock (&kvm->lock); -if (!atomic_read (&kvm->online_vcpus)) { +if (!kvm->created_vcpus) {bitmap_copy (kvm->arch.cpu_feat, (unsigned long *) data.feat,KVM_S390_VM_CPU_FEAT_NR_BITS ); ret =0 ;
Signature · 1 line
2.15.1
PATCH 16/189 platform/x86: dell-laptop: Filter out spurious keyboard backlight change events
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 4d6bde512a86c32df3a1f289d2b4cd04b17758d1 ]
On some Dell XPS models WMI events of type 0x0000 reporting a keycode of 0xe00c get reported when the brightness of the LCD panel changes.
This leads to us reporting false-positive kbd_led change events to userspace which in turn leads to the kbd backlight OSD showing when it should not.
We already read the current keyboard backlight brightness value when reporting events because the led_classdev_notify_brightness_hw_changed API requires this. Compare this value to the last known value and filter out duplicate events, fixing this.
Note the fixed issue is esp. a problem on XPS models with an ambient light sensor and automatic brightness adjustments turned on, this causes the kbd backlight OSD to show all the time there.
--- drivers/platform/x86/dell-laptop.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-)
drivers/platform/x86/dell-laptop.c +22 -2
@@ -1149,6 +1149,7 @@ static u8 kbd_previous_mode_bit;static bool kbd_led_present;static DEFINE_MUTEX (kbd_led_mutex); +static enum led_brightness kbd_led_level;/* * NOTE: there are three ways to set the keyboard backlight level.
@@ -1971,6 +1972,7 @@ static enum led_brightness kbd_led_level_get(struct led_classdev *led_cdev)static int kbd_led_level_set (struct led_classdev *led_cdev,enum led_brightness value) { +enum led_brightness new_value = value;struct kbd_state state;struct kbd_state new_state;u16 num;
@@ -2000,6 +2002,9 @@ static int kbd_led_level_set(struct led_classdev *led_cdev, } out: +if (ret ==0 ) + kbd_led_level = new_value; +mutex_unlock (&kbd_led_mutex);return ret; }
@@ -2027,6 +2032,9 @@ static int __init kbd_led_init(struct device *dev)if (kbd_led.max_brightness) kbd_led.max_brightness--; } + + kbd_led_level =kbd_led_level_get (NULL ); + ret =led_classdev_register (dev, &kbd_led);if (ret) kbd_led_present = false;
@@ -2051,13 +2059,25 @@ static void kbd_led_exit(void)static int dell_laptop_notifier_call (struct notifier_block *nb,unsigned long action,void *data) { +bool changed = false; +enum led_brightness new_kbd_led_level; +switch (action) {case DELL_LAPTOP_KBD_BACKLIGHT_BRIGHTNESS_CHANGED :if (!kbd_led_present)break ; -led_classdev_notify_brightness_hw_changed (&kbd_led, -kbd_led_level_get (&kbd_led)); +mutex_lock (&kbd_led_mutex); + new_kbd_led_level =kbd_led_level_get (&kbd_led); +if (kbd_led_level != new_kbd_led_level) { + kbd_led_level = new_kbd_led_level; + changed = true; + } +mutex_unlock (&kbd_led_mutex); + +if (changed) +led_classdev_notify_brightness_hw_changed (&kbd_led, + kbd_led_level);break ; }
Signature · 1 line
2.15.1
PATCH 17/189 xprtrdma: Fix backchannel allocation of extra rpcrdma_reps
In reply to Sasha LevinFrom: Chuck Lever <[email protected]>
[ Upstream commit d698c4a02ee02053bbebe051322ff427a2dad56a ]
The backchannel code uses rpcrdma_recv_buffer_put to add new reps to the free rep list. This also decrements rb_recv_count, which spoofs the receive overrun logic in rpcrdma_buffer_get_rep.
Commit 9b06688bc3b9 ("xprtrdma: Fix additional uses of spin_lock_irqsave(rb_lock)") replaced the original open-coded list_add with a call to rpcrdma_recv_buffer_put(), but then a year later, commit 05c974669ece ("xprtrdma: Fix receive buffer accounting") added rep accounting to rpcrdma_recv_buffer_put. It was an oversight to let the backchannel continue to use this function.
The fix this, let's combine the "add to free list" logic with rpcrdma_create_rep.
Also, do not allocate RPCRDMA_MAX_BC_REQUESTS rpcrdma_reps in rpcrdma_buffer_create and then allocate additional rpcrdma_reps in rpcrdma_bc_setup_reps. Allocating the extra reps during backchannel set-up is sufficient.
--- net/sunrpc/xprtrdma/backchannel.c | 12 ++---------- net/sunrpc/xprtrdma/verbs.c | 32 +++++++++++++++++++------------- net/sunrpc/xprtrdma/xprt_rdma.h | 2 +- 3 files changed, 22 insertions(+), 24 deletions(-)
net/sunrpc/xprtrdma/backchannel.c +2 -10
@@ -74,21 +74,13 @@ out_fail:static int rpcrdma_bc_setup_reps (struct rpcrdma_xprt *r_xprt,unsigned int count) { -struct rpcrdma_rep *rep;int rc =0 ;while (count--) { - rep =rpcrdma_create_rep (r_xprt); -if (IS_ERR (rep)) { -pr_err ("RPC: %s: reply buffer alloc failed\n" , - __func__); - rc =PTR_ERR (rep); + rc =rpcrdma_create_rep (r_xprt); +if (rc)break ; - } - -rpcrdma_recv_buffer_put (rep); } -return rc; }
net/sunrpc/xprtrdma/verbs.c +19 -13
@@ -1093,10 +1093,17 @@ rpcrdma_create_req(struct rpcrdma_xprt *r_xprt)return req; } -struct rpcrdma_rep * +/** +* rpcrdma_create_rep - Allocate an rpcrdma_rep object +* @r_xprt: controlling transport +* +* Returns 0 on success or a negative errno on failure. +*/ +int rpcrdma_create_rep (struct rpcrdma_xprt *r_xprt) {struct rpcrdma_create_data_internal *cdata = &r_xprt->rx_data; +struct rpcrdma_buffer *buf = &r_xprt->rx_buf;struct rpcrdma_rep *rep;int rc;
@@ -1121,12 +1128,18 @@ rpcrdma_create_rep(struct rpcrdma_xprt *r_xprt) rep->rr_recv_wr.wr_cqe = &rep->rr_cqe; rep->rr_recv_wr.sg_list = &rep->rr_rdmabuf->rg_iov; rep->rr_recv_wr.num_sge =1 ; -return rep; + +spin_lock (&buf->rb_lock); +list_add (&rep->rr_list, &buf->rb_recv_bufs); +spin_unlock (&buf->rb_lock); +return 0 ; out_free:kfree (rep); out: -return ERR_PTR (rc); +dprintk ("RPC: %s: reply buffer %d alloc failed\n" , + __func__, rc); +return rc; }int
@@ -1167,17 +1180,10 @@ rpcrdma_buffer_create(struct rpcrdma_xprt *r_xprt) }INIT_LIST_HEAD (&buf->rb_recv_bufs); -for (i =0 ; i < buf->rb_max_requests +RPCRDMA_MAX_BC_REQUESTS ; i++) { -struct rpcrdma_rep *rep; - - rep =rpcrdma_create_rep (r_xprt); -if (IS_ERR (rep)) { -dprintk ("RPC: %s: reply buffer %d alloc failed\n" , - __func__, i); - rc =PTR_ERR (rep); +for (i =0 ; i <= buf->rb_max_requests; i++) { + rc =rpcrdma_create_rep (r_xprt); +if (rc) goto out; - } -list_add (&rep->rr_list, &buf->rb_recv_bufs); } rc =rpcrdma_sendctxs_create (r_xprt);
net/sunrpc/xprtrdma/xprt_rdma.h +1 -1
@@ -564,8 +564,8 @@ int rpcrdma_ep_post_recv(struct rpcrdma_ia *, struct rpcrdma_rep *);* Buffer calls - xprtrdma/verbs.c */ struct rpcrdma_req *rpcrdma_create_req (struct rpcrdma_xprt *); -struct rpcrdma_rep *rpcrdma_create_rep (struct rpcrdma_xprt *);void rpcrdma_destroy_req (struct rpcrdma_req *); +int rpcrdma_create_rep (struct rpcrdma_xprt *r_xprt);int rpcrdma_buffer_create (struct rpcrdma_xprt *);void rpcrdma_buffer_destroy (struct rpcrdma_buffer *);struct rpcrdma_sendctx *rpcrdma_sendctx_get_locked (struct rpcrdma_buffer *buf);
Signature · 1 line
2.15.1
PATCH 18/189 xprtrdma: Eliminate unnecessary lock cycle in xprt_rdma_send_request
In reply to Sasha LevinFrom: Chuck Lever <[email protected]>
[ Upstream commit 42b9f5c58aa8c59c91ead0254f0c193e3438b020 ]
The rpcrdma_req is not shared yet, and its associated Send hasn't been posted, thus RMW should be safe. There's no need for the expense of a lock cycle here.
--- net/sunrpc/xprtrdma/transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/xprtrdma/transport.c +1 -1
@@ -744,7 +744,7 @@ xprt_rdma_send_request(struct rpc_task *task) goto drop_connection; req->rl_connect_cookie = xprt->connect_cookie; -set_bit (RPCRDMA_REQ_F_PENDING , &req->rl_flags); +__set_bit (RPCRDMA_REQ_F_PENDING , &req->rl_flags);if (rpcrdma_ep_post (&r_xprt->rx_ia, &r_xprt->rx_ep, req)) goto drop_connection;
Signature · 1 line
2.15.1
PATCH 21/189 PCI: Add function 1 DMA alias quirk for Marvell 9128
In reply to Sasha LevinFrom: Alex Williamson <[email protected]>
[ Upstream commit aa008206634363ef800fbd5f0262016c9ff81dea ]
The Marvell 9128 is the original device generating bug 42679, from which many other Marvell DMA alias quirks have been sourced, but we didn't have positive confirmation of the fix on 9128 until now.
--- drivers/pci/quirks.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/quirks.c +2 -0
@@ -3886,6 +3886,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9120, quirk_dma_func1_alias);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MARVELL_EXT ,0x9123 , quirk_dma_func1_alias); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MARVELL_EXT ,0x9128 , + quirk_dma_func1_alias);/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c14 */ DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MARVELL_EXT ,0x9130 , quirk_dma_func1_alias);
Signature · 1 line
2.15.1
PATCH 27/189 scsi: qla2xxx: Fix warning in qla2x00_async_iocb_timeout()
In reply to Sasha LevinFrom: "[email protected]" <[email protected]>
[ Upstream commit 7ac0c332f96bb9688560726f5e80c097ed8de59a ]
This patch fixes following Smatch warning:
drivers/scsi/qla2xxx/qla_init.c:130 qla2x00_async_iocb_timeout() error: we previously assumed 'fcport' could be null (see line 107)
Reported by: Dan Carpenter <[email protected]>
--- drivers/scsi/qla2xxx/qla_init.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/scsi/qla2xxx/qla_init.c +4 -0
@@ -115,6 +115,8 @@ qla2x00_async_iocb_timeout(void *data)switch (sp->type) {case SRB_LOGIN_CMD : +if (!fcport) +break ;/* Retry as needed. */ lio->u.logio.data[0 ] =MBS_COMMAND_ERROR ; lio->u.logio.data[1] = lio->u.logio.flags & SRB_LOGIN_RETRIED ?
@@ -128,6 +130,8 @@ qla2x00_async_iocb_timeout(void *data)qla24xx_handle_plogi_done_event (fcport->vha, &ea);break ;case SRB_LOGOUT_CMD : +if (!fcport) +break ;qlt_logo_completion_handler (fcport,QLA_FUNCTION_TIMEOUT );break ;case SRB_CT_PTHRU_CMD :
Signature · 1 line
2.15.1
PATCH 22/189 Input: psmouse - fix Synaptics detection when protocol is disabled
In reply to Sasha LevinFrom: Dmitry Torokhov <[email protected]>
[ Upstream commit 2bc4298f59d2f15175bb568e2d356b5912d0cdd9 ]
When Synaptics protocol is disabled, we still need to try and detect the hardware, so we can switch to SMBus device if SMbus is detected, or we know that it is Synaptics device and reset it properly for the bare PS/2 protocol.
--- drivers/input/mouse/psmouse-base.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-)
drivers/input/mouse/psmouse-base.c +21 -13
@@ -975,6 +975,21 @@ static void psmouse_apply_defaults(struct psmouse *psmouse) psmouse->pt_deactivate =NULL ; } +static bool psmouse_do_detect (int (*detect)(struct psmouse *,bool ), +struct psmouse *psmouse,bool allow_passthrough, +bool set_properties) +{ +if (psmouse->ps2dev.serio->id.type ==SERIO_PS_PSTHRU && + !allow_passthrough) { +return false; + } + +if (set_properties) +psmouse_apply_defaults (psmouse); + +return detect (psmouse, set_properties) ==0 ; +} + static bool psmouse_try_protocol(struct psmouse *psmouse, enum psmouse_type type, unsigned int *max_proto,
@@ -986,15 +1001,8 @@ static bool psmouse_try_protocol(struct psmouse *psmouse,if (!proto)return false; -if (psmouse->ps2dev.serio->id.type ==SERIO_PS_PSTHRU && - !proto->try_passthru) { -return false; - } - -if (set_properties) -psmouse_apply_defaults (psmouse); - -if (proto->detect (psmouse, set_properties) !=0 ) +if (!psmouse_do_detect (proto->detect, psmouse, proto->try_passthru, + set_properties))return false;if (set_properties && proto->init && init_allowed) {
@@ -1027,8 +1035,8 @@ static int psmouse_extensions(struct psmouse *psmouse,* Always check for focaltech, this is safe as it uses pnp-id * matching. */ -if (psmouse_try_protocol (psmouse,PSMOUSE_FOCALTECH , - &max_proto, set_properties, false)) { +if (psmouse_do_detect (focaltech_detect, + psmouse, false, set_properties)) {if (max_proto >PSMOUSE_IMEX &&IS_ENABLED (CONFIG_MOUSE_PS2_FOCALTECH ) && (!set_properties ||focaltech_init (psmouse) ==0 )) {
@@ -1074,8 +1082,8 @@ static int psmouse_extensions(struct psmouse *psmouse,* probing for IntelliMouse. */ if (max_proto >PSMOUSE_PS2 && -psmouse_try_protocol (psmouse,PSMOUSE_SYNAPTICS , &max_proto, - set_properties, false)) { +psmouse_do_detect (synaptics_detect, + psmouse, false, set_properties)) { synaptics_hardware = true;if (max_proto >PSMOUSE_IMEX ) {
Signature · 1 line
2.15.1
PATCH 23/189 libbpf: Makefile set specified permission mode
In reply to Sasha LevinFrom: Jesper Dangaard Brouer <[email protected]>
[ Upstream commit 7110d80d53f472956420cd05a6297f49b558b674 ]
The third parameter to do_install was not used by $(INSTALL) command. Fix this by only setting the -m option when the third parameter is supplied.
The use of a third parameter was introduced in commit eb54e522a000 ("bpf:
install libbpf headers on 'make install'").
Without this change, the header files are install as executables files (755).
--- tools/lib/bpf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/bpf/Makefile +1 -1
@@ -183,7 +183,7 @@ define do_install if [ ! -d '$(DESTDIR_SQ)$2' ]; then \ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \ fi; \ - $(INSTALL) $1 '$(DESTDIR_SQ)$2' + $(INSTALL) $1 $(if $3,-m $3,) '$(DESTDIR_SQ)$2' endef install_lib: all_cmd
Signature · 1 line
2.15.1
PATCH 24/189 Input: synaptics - reset the ABS_X/Y fuzz after initializing MT axes
In reply to Sasha LevinFrom: Peter Hutterer <[email protected]>
[ Upstream commit 19eb4ed1141bd1096b9bc84ba9c4d03d5830c143 ]
input_mt_init_slots() resets the ABS_X/Y fuzz to 0 and expects the driver to call input_mt_report_pointer_emulation(). That is based on the MT position bits which are already defuzzed - hence a fuzz of 0.
In the case of synaptics semi-mt devices, we report the ABS_X/Y axes manually. This results in the MT position being defuzzed but the single-touch emulation missing that defuzzing.
Work around this by re-initializing the ABS_X/Y axes after the MT axis to get the same fuzz value back.
https://bugs.freedesktop.org/show_bug.cgi?id=104533
--- drivers/input/mouse/synaptics.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/input/mouse/synaptics.c +10 -0
@@ -1280,6 +1280,16 @@ static void set_input_params(struct psmouse *psmouse,INPUT_MT_POINTER | (cr48_profile_sensor ? INPUT_MT_TRACK : INPUT_MT_SEMI_MT)); + +/* +* For semi-mt devices we send ABS_X/Y ourselves instead of +* input_mt_report_pointer_emulation. But +* input_mt_init_slots() resets the fuzz to 0, leading to a +* filtered ABS_MT_POSITION_X but an unfiltered ABS_X +* position. Let's re-initialize ABS_X/Y here. +*/ +if (!cr48_profile_sensor) +set_abs_position_params (dev, &priv->info,ABS_X ,ABS_Y ); }if (SYN_CAP_PALMDETECT (info->capabilities))
Signature · 1 line
2.15.1
PATCH 25/189 i40iw: Free IEQ resources
In reply to Sasha LevinFrom: Mustafa Ismail <[email protected]>
[ Upstream commit f20d429511affab6a2a9129f46042f43e6ffe396 ]
The iWARP Exception Queue (IEQ) resources are not freed when a QP is destroyed. Fix this by freeing IEQ resources when freeing QP resources.
--- drivers/infiniband/hw/i40iw/i40iw_puda.c | 3 +-- drivers/infiniband/hw/i40iw/i40iw_puda.h | 1 + drivers/infiniband/hw/i40iw/i40iw_verbs.c | 1 + 3 files changed, 3 insertions(+), 2 deletions(-)
drivers/infiniband/hw/i40iw/i40iw_puda.c +1 -2
@@ -48,7 +48,6 @@ static void i40iw_ieq_tx_compl(struct i40iw_sc_vsi *vsi, void *sqwrid);static void i40iw_ilq_putback_rcvbuf (struct i40iw_sc_qp *qp,u32 wqe_idx);static enum i40iw_status_code i40iw_puda_replenish_rq (struct i40iw_puda_rsrc *rsrc,bool initial); -static void i40iw_ieq_cleanup_qp (struct i40iw_puda_rsrc *ieq,struct i40iw_sc_qp *qp);/** * i40iw_puda_get_listbuf - get buffer from puda list * @list: list to use for buffers (ILQ or IEQ)
@@ -1483,7 +1482,7 @@ static void i40iw_ieq_tx_compl(struct i40iw_sc_vsi *vsi, void *sqwrid)* @ieq: ieq resource * @qp: all pending fpdu buffers */ -static void i40iw_ieq_cleanup_qp (struct i40iw_puda_rsrc *ieq,struct i40iw_sc_qp *qp) +void i40iw_ieq_cleanup_qp (struct i40iw_puda_rsrc *ieq,struct i40iw_sc_qp *qp) {struct i40iw_puda_buf *buf;struct i40iw_pfpdu *pfpdu = &qp->pfpdu;
drivers/infiniband/hw/i40iw/i40iw_puda.h +1 -0
@@ -184,4 +184,5 @@ enum i40iw_status_code i40iw_cqp_qp_create_cmd(struct i40iw_sc_dev *dev, structenum i40iw_status_code i40iw_cqp_cq_create_cmd (struct i40iw_sc_dev *dev,struct i40iw_sc_cq *cq);void i40iw_cqp_qp_destroy_cmd (struct i40iw_sc_dev *dev,struct i40iw_sc_qp *qp);void i40iw_cqp_cq_destroy_cmd (struct i40iw_sc_dev *dev,struct i40iw_sc_cq *cq); +void i40iw_ieq_cleanup_qp (struct i40iw_puda_rsrc *ieq,struct i40iw_sc_qp *qp);#endif
drivers/infiniband/hw/i40iw/i40iw_verbs.c +1 -0
@@ -412,6 +412,7 @@ void i40iw_free_qp_resources(struct i40iw_device *iwdev, {struct i40iw_pbl *iwpbl = &iwqp->iwpbl; +i40iw_ieq_cleanup_qp (iwdev->vsi.ieq, &iwqp->sc_qp);i40iw_dealloc_push_page (iwdev, &iwqp->sc_qp);if (qp_num)i40iw_free_resource (iwdev, iwdev->allocated_qps, qp_num);
Signature · 1 line
2.15.1
PATCH 29/189 tools lib traceevent: Simplify pointer print logic and fix %pF
In reply to Sasha LevinFrom: "Steven Rostedt (VMware)" <[email protected]>
[ Upstream commit 38d70b7ca1769f26c0b79f3c08ff2cc949712b59 ]
When processing %pX in pretty_print(), simplify the logic slightly by incrementing the ptr to the format string if isalnum(ptr[1]) is true. This follows the logic a bit more closely to what is in the kernel.
Also, this fixes a small bug where %pF was not giving the offset of the function.
--- tools/lib/traceevent/event-parse.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
tools/lib/traceevent/event-parse.c +9 -8
@@ -4949,21 +4949,22 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct eventelse ls =2 ; -if (*(ptr+1 ) =='F' || *(ptr+1 ) =='f' || - *(ptr+1 ) =='S' || *(ptr+1 ) =='s' ) { +if (isalnum (ptr[1 ])) ptr++; + +if (*ptr =='F' || *ptr =='f' || + *ptr =='S' || *ptr =='s' ) { show_func = *ptr; - }else if (*(ptr+1 ) =='M' || *(ptr+1 ) =='m' ) { -print_mac_arg (s, *(ptr+1 ), data, size, event, arg); - ptr++; + }else if (*ptr =='M' || *ptr =='m' ) { +print_mac_arg (s, *ptr, data, size, event, arg); arg = arg->next;break ; - }else if (*(ptr+1 ) =='I' || *(ptr+1 ) =='i' ) { + }else if (*ptr =='I' || *ptr =='i' ) {int n; - n =print_ip_arg (s, ptr+1 , data, size, event, arg); + n =print_ip_arg (s, ptr, data, size, event, arg);if (n >0 ) { - ptr += n; + ptr += n -1 ; arg = arg->next;break ; }
Signature · 1 line
2.15.1
PATCH 30/189 perf callchain: Fix attr.sample_max_stack setting
In reply to Sasha LevinFrom: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 249d98e567e25dd03e015e2d31e1b7b9648f34df ]
When setting the "dwarf" unwinder for a specific event and not specifying the max-stack, the attr.sample_max_stack ended up using an uninitialized callchain_param.max_stack, fix it by using designated initializers for that callchain_param variable, zeroing all non explicitely initialized struct members.
Here is what happened:
# perf trace -vv --no-syscalls --max-stack 4 -e probe_libc:inet_pton/call-graph=dwarf/ ping -6 -c 1 ::1
callchain: type DWARF
callchain: stack dump size 8192
perf_event_attr:
type 2
size 112
config 0x730
{ sample_period, sample_freq } 1
sample_type IP|TID|TIME|ADDR|CALLCHAIN|CPU|PERIOD|RAW|REGS_USER|STACK_USER|DATA_SRC
exclude_callchain_user 1
{ wakeup_events, wakeup_watermark } 1
sample_regs_user 0xff0fff
sample_stack_user 8192
sample_max_stack 50656
sys_perf_event_open failed, error -75
Value too large for defined data type
# perf trace -vv --no-syscalls --max-stack 4 -e probe_libc:inet_pton/call-graph=dwarf/ ping -6 -c 1 ::1
callchain: type DWARF
callchain: stack dump size 8192
perf_event_attr:
type 2
size 112
config 0x730
sample_type IP|TID|TIME|ADDR|CALLCHAIN|CPU|PERIOD|RAW|REGS_USER|STACK_USER|DATA_SRC
exclude_callchain_user 1
sample_regs_user 0xff0fff
sample_stack_user 8192
sample_max_stack 30448
sys_perf_event_open failed, error -75
Value too large for defined data type
#Now the attr.sample_max_stack is set to zero and the above works as expected:
# perf trace --no-syscalls --max-stack 4 -e probe_libc:inet_pton/call-graph=dwarf/ ping -6 -c 1 ::1 PING ::1(::1) 56 data bytes 64 bytes from ::1: icmp_seq=1 ttl=64 time=0.072 ms
--- ::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.072/0.072/0.072/0.000 ms
0.000 probe_libc:inet_pton:(7feb7a998350))
__inet_pton (inlined)
gaih_inet.constprop.7 (/usr/lib64/libc-2.26.so)
__GI_getaddrinfo (inlined)
[0xffffaa39b6108f3f] (/usr/bin/ping)#
--- tools/perf/util/evsel.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/perf/util/evsel.c +4 -4
@@ -722,14 +722,14 @@ static void apply_config_terms(struct perf_evsel *evsel,struct perf_evsel_config_term *term;struct list_head *config_terms = &evsel->config_terms;struct perf_event_attr *attr = &evsel->attr; -struct callchain_param param; +/* callgraph default */ +struct callchain_param param = { + .record_mode = callchain_param.record_mode, + };u32 dump_size =0 ;int max_stack =0 ;const char *callgraph_buf =NULL ; -/* callgraph default */ - param.record_mode = callchain_param.record_mode; -list_for_each_entry (term, config_terms, list) {switch (term->type) {case PERF_EVSEL__CONFIG_TERM_PERIOD :
Signature · 1 line
2.15.1
PATCH 26/189 i40iw: Zero-out consumer key on allocate stag for FMR
In reply to Sasha LevinFrom: Shiraz Saleem <[email protected]>
[ Upstream commit 6376e926af1a8661dd1b2e6d0896e07f84a35844 ]
If the application invalidates the MR before the FMR WR, HW parses the consumer key portion of the stag and returns an invalid stag key Asynchronous Event (AE) that tears down the QP.
Fix this by zeroing-out the consumer key portion of the allocated stag returned to application for FMR.
--- drivers/infiniband/hw/i40iw/i40iw_verbs.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/i40iw/i40iw_verbs.c +1 -0
@@ -1638,6 +1638,7 @@ static struct ib_mr *i40iw_alloc_mr(struct ib_pd *pd, err_code = -EOVERFLOW ; goto err; } + stag &= ~I40IW_CQPSQ_STAG_KEY_MASK ; iwmr->stag = stag; iwmr->ibmr.rkey = stag; iwmr->ibmr.lkey = stag;
Signature · 1 line
2.15.1
PATCH 34/189 powerpc: System reset avoid interleaving oops using die synchronisation
In reply to Sasha LevinFrom: Nicholas Piggin <[email protected]>
[ Upstream commit 4552d128c26e0f0f27a5bd2fadc24092b8f6c1d7 ]
The die() oops path contains a serializing lock to prevent oops messages from being interleaved. In the case of a system reset initiated oops (e.g., qemu nmi command), __die was being called which lacks that synchronisation and oops reports could be interleaved across CPUs.
A recent patch 4388c9b3a6ee7 ("powerpc: Do not send system reset request through the oops path") changed this to __die to avoid the debugger() call, but there is no real harm to calling it twice if the first time fell through. So go back to using die() here. This was observed to fix the problem.
--- arch/powerpc/kernel/traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/traps.c +1 -1
@@ -337,7 +337,7 @@ void system_reset_exception(struct pt_regs *regs)* No debugger or crash dump registered, print logs then * panic. */ -__die ("System Reset" , regs,SIGABRT ); +die ("System Reset" , regs,SIGABRT );mdelay (2 *MSEC_PER_SEC );/* Wait a little while for others to print */ add_taint (TAINT_DIE ,LOCKDEP_NOW_UNRELIABLE );
Signature · 1 line
2.15.1
PATCH 28/189 perf unwind: Do not look just at the global callchain_param.record_mode
In reply to Sasha LevinFrom: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit eabad8c6856f185f876b54c426c2cc69fe0f0a7d ]
When setting up DWARF callchains on specific events, without using 'record' or 'trace' --call-graph, but instead doing it like:
perf trace -e cycles/call-graph=dwarf/
The unwind__prepare_access() call in thread__insert_map() when we process PERF_RECORD_MMAP(2) metadata events were not being performed, precluding us from using per-event DWARF callchains, handling them just when we asked for all events to be DWARF, using "--call-graph dwarf".
We do it in the PERF_RECORD_MMAP because we have to look at one of the executable maps to figure out the executable type (64-bit, 32-bit) of the DSO laid out in that mmap. Also to look at the architecture where the perf.data file was recorded.
All this probably should be deferred to when we process a sample for some thread that has callchains, so that we do this processing only for the threads with samples, not for all of them.
For now, fix using DWARF on specific events.
Before:
# perf trace --no-syscalls -e probe_libc:inet_pton/call-graph=dwarf/ ping -6 -c 1 ::1 PING ::1(::1) 56 data bytes 64 bytes from ::1: icmp_seq=1 ttl=64 time=0.048 ms
--- ::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.048/0.048/0.048/0.000 ms
0.000 probe_libc:inet_pton:(7fe9597bb350))
Problem processing probe_libc:inet_pton callchain, skipping... #
After:
# perf trace --no-syscalls -e probe_libc:inet_pton/call-graph=dwarf/ ping -6 -c 1 ::1 PING ::1(::1) 56 data bytes 64 bytes from ::1: icmp_seq=1 ttl=64 time=0.060 ms
--- ::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.060/0.060/0.060/0.000 ms
0.000 probe_libc:inet_pton:(7fd4aa930350))
__inet_pton (inlined)
gaih_inet.constprop.7 (/usr/lib64/libc-2.26.so)
__GI_getaddrinfo (inlined)
[0xffffaa804e51af3f] (/usr/bin/ping)
__libc_start_main (/usr/lib64/libc-2.26.so)
[0xffffaa804e51b379] (/usr/bin/ping)
#
# perf trace --call-graph=dwarf --no-syscalls -e probe_libc:inet_pton/call-graph=dwarf/ ping -6 -c 1 ::1
PING ::1(::1) 56 data bytes
64 bytes from ::1: icmp_seq=1 ttl=64 time=0.057 ms --- ::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.057/0.057/0.057/0.000 ms
0.000 probe_libc:inet_pton:(7f9363b9e350))
__inet_pton (inlined)
gaih_inet.constprop.7 (/usr/lib64/libc-2.26.so)
__GI_getaddrinfo (inlined)
[0xffffa9e8a14e0f3f] (/usr/bin/ping)
__libc_start_main (/usr/lib64/libc-2.26.so)
[0xffffa9e8a14e1379] (/usr/bin/ping)
#
# perf trace --call-graph=fp --no-syscalls -e probe_libc:inet_pton/call-graph=dwarf/ ping -6 -c 1 ::1
PING ::1(::1) 56 data bytes
64 bytes from ::1: icmp_seq=1 ttl=64 time=0.077 ms --- ::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.077/0.077/0.077/0.000 ms
0.000 probe_libc:inet_pton:(7f4947e1c350))
__inet_pton (inlined)
gaih_inet.constprop.7 (/usr/lib64/libc-2.26.so)
__GI_getaddrinfo (inlined)
[0xffffaa716d88ef3f] (/usr/bin/ping)
__libc_start_main (/usr/lib64/libc-2.26.so)
[0xffffaa716d88f379] (/usr/bin/ping)
#
# perf trace --no-syscalls -e probe_libc:inet_pton/call-graph=fp/ ping -6 -c 1 ::1
PING ::1(::1) 56 data bytes
64 bytes from ::1: icmp_seq=1 ttl=64 time=0.078 ms --- ::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.078/0.078/0.078/0.000 ms
0.000 probe_libc:inet_pton:(7fa157696350))
__GI___inet_pton (/usr/lib64/libc-2.26.so)
getaddrinfo (/usr/lib64/libc-2.26.so)
[0xffffa9ba39c74f40] (/usr/bin/ping)#
--- tools/perf/builtin-c2c.c | 5 +++-- tools/perf/builtin-report.c | 5 +++-- tools/perf/builtin-script.c | 5 +++-- tools/perf/tests/dwarf-unwind.c | 1 + tools/perf/util/callchain.c | 10 ++++++++++ tools/perf/util/callchain.h | 2 ++ tools/perf/util/unwind-libunwind-local.c | 9 +++------ 7 files changed, 25 insertions(+), 12 deletions(-)
tools/perf/builtin-c2c.c +3 -2
@@ -2393,9 +2393,10 @@ static int setup_callchain(struct perf_evlist *evlist)enum perf_call_graph_mode mode =CALLCHAIN_NONE ;if ((sample_type &PERF_SAMPLE_REGS_USER ) && - (sample_type &PERF_SAMPLE_STACK_USER )) + (sample_type &PERF_SAMPLE_STACK_USER )) { mode =CALLCHAIN_DWARF ; -else if (sample_type &PERF_SAMPLE_BRANCH_STACK ) + dwarf_callchain_users = true; + }else if (sample_type &PERF_SAMPLE_BRANCH_STACK ) mode =CALLCHAIN_LBR ;else if (sample_type &PERF_SAMPLE_CALLCHAIN ) mode =CALLCHAIN_FP ;
tools/perf/builtin-report.c +3 -2
@@ -312,9 +312,10 @@ static int report__setup_sample_type(struct report *rep)if (symbol_conf.use_callchain || symbol_conf.cumulate_callchain) {if ((sample_type &PERF_SAMPLE_REGS_USER ) && - (sample_type &PERF_SAMPLE_STACK_USER )) + (sample_type &PERF_SAMPLE_STACK_USER )) { callchain_param.record_mode =CALLCHAIN_DWARF ; -else if (sample_type &PERF_SAMPLE_BRANCH_STACK ) + dwarf_callchain_users = true; + }else if (sample_type &PERF_SAMPLE_BRANCH_STACK ) callchain_param.record_mode =CALLCHAIN_LBR ;else callchain_param.record_mode =CALLCHAIN_FP ;
tools/perf/builtin-script.c +3 -2
@@ -2758,9 +2758,10 @@ static void script__setup_sample_type(struct perf_script *script)if (symbol_conf.use_callchain || symbol_conf.cumulate_callchain) {if ((sample_type &PERF_SAMPLE_REGS_USER ) && - (sample_type &PERF_SAMPLE_STACK_USER )) + (sample_type &PERF_SAMPLE_STACK_USER )) { callchain_param.record_mode =CALLCHAIN_DWARF ; -else if (sample_type &PERF_SAMPLE_BRANCH_STACK ) + dwarf_callchain_users = true; + }else if (sample_type &PERF_SAMPLE_BRANCH_STACK ) callchain_param.record_mode =CALLCHAIN_LBR ;else callchain_param.record_mode =CALLCHAIN_FP ;
tools/perf/tests/dwarf-unwind.c +1 -0
@@ -173,6 +173,7 @@ int test__dwarf_unwind(struct test *test __maybe_unused, int subtest __maybe_unu } callchain_param.record_mode =CALLCHAIN_DWARF ; + dwarf_callchain_users = true;if (init_live_machine (machine)) {pr_err ("Could not init machine\n" );
tools/perf/util/callchain.c +10 -0
@@ -37,6 +37,15 @@ struct callchain_param callchain_param = { CALLCHAIN_PARAM_DEFAULT }; +/* +* Are there any events usind DWARF callchains? +* +* I.e. +* +* -e cycles/call-graph=dwarf/ +*/ +bool dwarf_callchain_users; +struct callchain_param callchain_param_default = {CALLCHAIN_PARAM_DEFAULT };
@@ -265,6 +274,7 @@ int parse_callchain_record(const char *arg, struct callchain_param *param) ret =0 ; param->record_mode =CALLCHAIN_DWARF ; param->dump_size = default_stack_dump_size; + dwarf_callchain_users = true; tok =strtok_r (NULL ,"," , &saveptr);if (tok) {
tools/perf/util/callchain.h +2 -0
@@ -89,6 +89,8 @@ enum chain_value { CCVAL_COUNT, }; +extern bool dwarf_callchain_users; +struct callchain_param {bool enabled;enum perf_call_graph_mode record_mode;
tools/perf/util/unwind-libunwind-local.c +3 -6
@@ -631,9 +631,8 @@ static unw_accessors_t accessors = {static int _unwind__prepare_access (struct thread *thread) { -if (callchain_param.record_mode !=CALLCHAIN_DWARF ) +if (!dwarf_callchain_users)return 0 ; - thread->addr_space =unw_create_addr_space (&accessors,0 );if (!thread->addr_space) {pr_err ("unwind: Can't create unwind address space.\n" );
@@ -646,17 +645,15 @@ static int _unwind__prepare_access(struct thread *thread)static void _unwind__flush_access (struct thread *thread) { -if (callchain_param.record_mode !=CALLCHAIN_DWARF ) +if (!dwarf_callchain_users)return ; -unw_flush_cache (thread->addr_space,0 ,0 ); }static void _unwind__finish_access (struct thread *thread) { -if (callchain_param.record_mode !=CALLCHAIN_DWARF ) +if (!dwarf_callchain_users)return ; -unw_destroy_addr_space (thread->addr_space); }
Signature · 1 line
2.15.1
PATCH 36/189 dm thin: fix documentation relative to low water mark threshold
In reply to Sasha LevinFrom: mulhern <[email protected]>
[ Upstream commit 9b28a1102efc75d81298198166ead87d643a29ce ]
Fixes:
1. The use of "exceeds" when the opposite of exceeds, falls below, was meant.
2. Properly speaking, a table can not exceed a threshold.
It emphasizes the important point, which is that it is the userspace daemon's responsibility to check for low free space when a device is resumed, since it won't get a special event indicating low free space in that situation.
--- Documentation/device-mapper/thin-provisioning.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
Documentation/device-mapper/thin-provisioning.txt +5 -3
@@ -112,9 +112,11 @@ $low_water_mark is expressed in blocks of size $data_block_size. If free space on the data device drops below this level then a dm event will be triggered which a userspace daemon should catch allowing it to extend the pool device. Only one such event will be sent. -Resuming a device with a new table itself triggers an event so the -userspace daemon can use this to detect a situation where a new table -already exceeds the threshold. + +No special event is triggered if a just resumed device's free space is below +the low water mark. However, resuming a device always triggers an +event; a userspace daemon should verify that free space exceeds the low +water mark when handling this event. A low water mark for the metadata device is maintained in the kernel and will trigger a dm event if free space on the metadata device drops below
Signature · 1 line
2.15.1
PATCH 45/189 IB/cq: Don't force IB_POLL_DIRECT poll context for ib_process_cq_direct
In reply to Sasha LevinFrom: Sagi Grimberg <[email protected]>
[ Upstream commit 246d8b184c100e8eb6b4e8c88f232c2ed2a4e672 ]
polling the completion queue directly does not interfere with the existing polling logic, hence drop the requirement. Be aware that running ib_process_cq_direct with non IB_POLL_DIRECT CQ may trigger concurrent CQ processing.
This can be used for polling mode ULPs.
--- drivers/infiniband/core/cq.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/infiniband/core/cq.c +13 -10
@@ -25,9 +25,10 @@#define IB_POLL_FLAGS \ (IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS) -static int __ib_process_cq (struct ib_cq *cq,int budget) +static int __ib_process_cq (struct ib_cq *cq,int budget,struct ib_wc *poll_wc) {int i, n, completed =0 ; +struct ib_wc *wcs = poll_wc ? : cq->wc;/* * budget might be (-1) if the caller does not
@@ -35,9 +36,9 @@ static int __ib_process_cq(struct ib_cq *cq, int budget)* minimum here. */ while ((n =ib_poll_cq (cq,min_t (u32,IB_POLL_BATCH , - budget - completed), cq->wc)) >0 ) { + budget - completed), wcs)) >0 ) {for (i =0 ; i < n; i++) { -struct ib_wc *wc = &cq->wc[i]; +struct ib_wc *wc = &wcs[i];if (wc->wr_cqe) wc->wr_cqe->done (cq, wc);
@@ -60,18 +61,20 @@ static int __ib_process_cq(struct ib_cq *cq, int budget)* @cq: CQ to process * @budget: number of CQEs to poll for * -* This function is used to process all outstanding CQ entries on a -* %IB_POLL_DIRECT CQ. It does not offload CQ processing to a different -* context and does not ask for completion interrupts from the HCA. +* This function is used to process all outstanding CQ entries. +* It does not offload CQ processing to a different context and does +* not ask for completion interrupts from the HCA. +* Using direct processing on CQ with non IB_POLL_DIRECT type may trigger +* concurrent processing. * * Note: do not pass -1 as %budget unless it is guaranteed that the number * of completions that will be processed is small. */ int ib_process_cq_direct (struct ib_cq *cq,int budget) { -WARN_ON_ONCE (cq->poll_ctx !=IB_POLL_DIRECT ); +struct ib_wc wcs[IB_POLL_BATCH ]; -return __ib_process_cq (cq, budget); +return __ib_process_cq (cq, budget, wcs); }EXPORT_SYMBOL (ib_process_cq_direct);
@@ -85,7 +88,7 @@ static int ib_poll_handler(struct irq_poll *iop, int budget) struct ib_cq *cq = container_of(iop, struct ib_cq, iop);int completed; - completed =__ib_process_cq (cq, budget); + completed =__ib_process_cq (cq, budget,NULL );if (completed < budget) {irq_poll_complete (&cq->iop);if (ib_req_notify_cq (cq,IB_POLL_FLAGS ) >0 )
@@ -105,7 +108,7 @@ static void ib_cq_poll_work(struct work_struct *work) struct ib_cq *cq = container_of(work, struct ib_cq, work);int completed; - completed =__ib_process_cq (cq,IB_POLL_BUDGET_WORKQUEUE ); + completed =__ib_process_cq (cq,IB_POLL_BUDGET_WORKQUEUE ,NULL );if (completed >=IB_POLL_BUDGET_WORKQUEUE ||ib_req_notify_cq (cq,IB_POLL_FLAGS ) >0 )queue_work (ib_comp_wq, &cq->work);
Signature · 1 line
2.15.1
PATCH 48/189 clk: ingenic: Fix recalc_rate for clocks with fixed divider
In reply to Sasha LevinFrom: Paul Cercueil <[email protected]>
[ Upstream commit e6cfa64375d34a6c8c1861868a381013b2d3b921 ]
Previously, the clocks with a fixed divider would report their rate as being the same as the one of their parent, independently of the divider in use. This commit fixes this behaviour.
This went unnoticed as neither the jz4740 nor the jz4780 CGU code have clocks with fixed dividers yet.
Patchwork: https://patchwork.linux-mips.org/patch/18477/
--- drivers/clk/ingenic/cgu.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/ingenic/cgu.c +2 -0
@@ -328,6 +328,8 @@ ingenic_clk_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) div *= clk_info->div.div; rate /= div; + }else if (clk_info->type &CGU_CLK_FIXDIV ) { + rate /= clk_info->fixdiv.div; }return rate;
Signature · 1 line
2.15.1
PATCH 49/189 MIPS: JZ4770: Work around config2 misreporting associativity
In reply to Sasha LevinFrom: Maarten ter Huurne <[email protected]>
[ Upstream commit 1f7412e0e2f327fe7dc5a0c2fc36d7b319d05d47 ]
According to config2, the associativity would be 5-ways, but the documentation states 4-ways, which also matches the documented L2 cache size of 256 kB.
Patchwork: https://patchwork.linux-mips.org/patch/18488/
--- arch/mips/mm/sc-mips.c | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/mips/mm/sc-mips.c +9 -0
@@ -16,6 +16,7 @@#include <asm/mmu_context.h> #include <asm/r4kcache.h> #include <asm/mips-cps.h> +#include <asm/bootinfo.h> /* * MIPS32/MIPS64 L2 cache handling
@@ -220,6 +221,14 @@ static inline int __init mips_sc_probe(void)else return 0 ; +/* +* According to config2 it would be 5-ways, but that is contradicted +* by all documentation. +*/ +if (current_cpu_type () ==CPU_JZRISC && + mips_machtype ==MACH_INGENIC_JZ4770 ) + c->scache.ways =4 ; + c->scache.waysize = c->scache.sets * c->scache.linesz; c->scache.waybit =__ffs (c->scache.waysize);
Signature · 1 line
2.15.1
PATCH 51/189 watchdog: sp5100_tco: Fix watchdog disable bit
In reply to Sasha LevinFrom: Guenter Roeck <[email protected]>
[ Upstream commit f541c09ebfc61697b586b38c9ebaf4b70defb278 ]
According to all published information, the watchdog disable bit for SB800 compatible controllers is bit 1 of PM register 0x48, not bit 2. For the most part that doesn't matter in practice, since the bit has to be cleared to enable watchdog address decoding, which is the default setting, but it still needs to be fixed.
--- drivers/watchdog/sp5100_tco.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/sp5100_tco.h +1 -1
@@ -55,7 +55,7 @@#define SB800_PM_WATCHDOG_CONFIG 0x4C#define SB800_PCI_WATCHDOG_DECODE_EN (1 << 0) -#define SB800_PM_WATCHDOG_DISABLE (1 << 2) +#define SB800_PM_WATCHDOG_DISABLE (1 << 1)#define SB800_PM_WATCHDOG_SECOND_RES (3 << 0)#define SB800_ACPI_MMIO_DECODE_EN (1 << 0)#define SB800_ACPI_MMIO_SEL (1 << 1)
Signature · 1 line
2.15.1
PATCH 54/189 kconfig: Don't leak main menus during parsing
In reply to Sasha LevinFrom: Ulf Magnusson <[email protected]>
[ Upstream commit 0724a7c32a54e3e50d28e19e30c59014f61d4e2c ]
If a 'mainmenu' entry appeared in the Kconfig files, two things would leak:
- The 'struct property' allocated for the default "Linux Kernel Configuration" prompt.
- The string for the T_WORD/T_WORD_QUOTE prompt after the T_MAINMENU token, allocated on the heap in zconf.l.
To fix it, introduce a new 'no_mainmenu_stmt' nonterminal that matches if there's no 'mainmenu' and adds the default prompt. That means the prompt only gets allocated once regardless of whether there's a 'mainmenu' statement or not, and managing it becomes simple.
Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix:
LEAK SUMMARY: definitely lost: 344,568 bytes in 14,352 blocks ...
Summary after the fix:
LEAK SUMMARY: definitely lost: 344,440 bytes in 14,350 blocks ...
--- scripts/kconfig/zconf.y | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-)
scripts/kconfig/zconf.y +24 -9
@@ -108,7 +108,27 @@ static struct menu *current_menu, *current_entry; %% input: nl start | start; -start: mainmenu_stmt stmt_list | stmt_list; +start: mainmenu_stmt stmt_list | no_mainmenu_stmt stmt_list; + +/* mainmenu entry */ + +mainmenu_stmt: T_MAINMENU prompt nl +{ + menu_add_prompt(P_MENU, $2, NULL); +}; + +/* Default main menu, if there's no mainmenu entry */ + +no_mainmenu_stmt: /* empty */ +{ + /* + * Hack: Keep the main menu title on the heap so we can safely free it + * later regardless of whether it comes from the 'prompt' in + * mainmenu_stmt or here + */ + menu_add_prompt(P_MENU, strdup("Linux Kernel Configuration"), NULL); +}; + stmt_list: /* empty */
@@ -351,13 +371,6 @@ if_block: | if_block choice_stmt ; -/* mainmenu entry */ - -mainmenu_stmt: T_MAINMENU prompt nl -{ - menu_add_prompt(P_MENU, $2, NULL); -}; - /* menu entry */ menu: T_MENU prompt T_EOL
@@ -502,6 +515,7 @@ word_opt: /* empty */ { $$ = NULL; } void conf_parse(const char *name) { + const char *tmp; struct symbol *sym; int i;
@@ -509,7 +523,6 @@ void conf_parse(const char *name) sym_init(); _menu_init(); - rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); if (getenv("ZCONF_DEBUG")) zconfdebug = 1;
@@ -519,8 +532,10 @@ void conf_parse(const char *name) if (!modules_sym) modules_sym = sym_find( "n" ); + tmp = rootmenu.prompt->text; rootmenu.prompt->text = _(rootmenu.prompt->text); rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text); + free((char*)tmp); menu_finalize(&rootmenu); for_all_symbols(i, sym) {
Signature · 1 line
2.15.1
PATCH 55/189 kconfig: Fix automatic menu creation mem leak
In reply to Sasha LevinFrom: Ulf Magnusson <[email protected]>
[ Upstream commit ae7440ef0c8013d68c00dad6900e7cce5311bb1c ]
expr_trans_compare() always allocates and returns a new expression, giving the following leak outline:
...
*Allocate*
basedep = expr_trans_compare(basedep, E_UNEQUAL, &symbol_no);
...
for (menu = parent->next; menu; menu = menu->next) {
...
*Copy*
dep2 = expr_copy(basedep);
...
*Free copy*
expr_free(dep2);
}
*basedep lost!*Fix by freeing 'basedep' after the loop.
Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix:
LEAK SUMMARY: definitely lost: 344,376 bytes in 14,349 blocks ...
Summary after the fix:
LEAK SUMMARY: definitely lost: 44,448 bytes in 1,852 blocks ...
--- scripts/kconfig/menu.c | 1 + 1 file changed, 1 insertion(+)
scripts/kconfig/menu.c +1 -0
@@ -372,6 +372,7 @@ void menu_finalize(struct menu *parent) menu->parent = parent; last_menu = menu; } +expr_free (basedep);if (last_menu) { parent->list = parent->next; parent->next = last_menu->next;
Signature · 1 line
2.15.1
PATCH 56/189 kconfig: Fix expr_free() E_NOT leak
In reply to Sasha LevinFrom: Ulf Magnusson <[email protected]>
[ Upstream commit 5b1374b3b3c2fc4f63a398adfa446fb8eff791a4 ]
Only the E_NOT operand and not the E_NOT node itself was freed, due to accidentally returning too early in expr_free(). Outline of leak:
switch (e->type) {
...
case E_NOT:
expr_free(e->left.expr);
return;
...
}
*Never reached, 'e' leaked*
free(e);Fix by changing the 'return' to a 'break'.
Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix:
LEAK SUMMARY: definitely lost: 44,448 bytes in 1,852 blocks ...
Summary after the fix:
LEAK SUMMARY: definitely lost: 1,608 bytes in 67 blocks ...
--- scripts/kconfig/expr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kconfig/expr.c +1 -1
@@ -113,7 +113,7 @@ void expr_free(struct expr *e)break ;case E_NOT :expr_free (e->left.expr); -return ; +break ;case E_EQUAL :case E_GEQ :case E_GTH :
Signature · 1 line
2.15.1
PATCH 59/189 mac80211_hwsim: fix possible memory leak in hwsim_new_radio_nl()
In reply to Sasha LevinFrom: "weiyongjun (A)" <[email protected]>
[ Upstream commit 0ddcff49b672239dda94d70d0fcf50317a9f4b51 ]
'hwname' is malloced in hwsim_new_radio_nl() and should be freed before leaving from the error handling cases, otherwise it will cause memory leak.
--- drivers/net/wireless/mac80211_hwsim.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/mac80211_hwsim.c +3 -1
@@ -3155,8 +3155,10 @@ static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)if (info->attrs[HWSIM_ATTR_REG_CUSTOM_REG ]) {u32 idx =nla_get_u32 (info->attrs[HWSIM_ATTR_REG_CUSTOM_REG ]); -if (idx >=ARRAY_SIZE (hwsim_world_regdom_custom)) +if (idx >=ARRAY_SIZE (hwsim_world_regdom_custom)) { +kfree (hwname);return -EINVAL ; + } param.regd = hwsim_world_regdom_custom[idx]; }
Signature · 1 line
2.15.1
PATCH 61/189 Btrfs: set plug for fsync
In reply to Sasha LevinFrom: Liu Bo <[email protected]>
[ Upstream commit 343e4fc1c60971b0734de26dbbd475d433950982 ]
Setting plug can merge adjacent IOs before dispatching IOs to the disk driver.
Without plug, it'd not be a problem for single disk usecases, but for multiple disks using raid profile, a large IO can be split to several IOs of stripe length, and plug can be helpful to bring them together for each disk so that we can save several disk access.
Moreover, fsync issues synchronous writes, so plug can really take effect.
--- fs/btrfs/file.c | 9 +++++++++ 1 file changed, 9 insertions(+)
fs/btrfs/file.c +9 -0
@@ -2019,10 +2019,19 @@ int btrfs_release_file(struct inode *inode, struct file *filp)static int start_ordered_ops (struct inode *inode,loff_t start,loff_t end) {int ret; +struct blk_plug plug; +/* +* This is only called in fsync, which would do synchronous writes, so +* a plug can merge adjacent IOs as much as possible. Esp. in case of +* multiple disks using raid profile, a large IO can be split to +* several segments of stripe length (currently 64K). +*/ +blk_start_plug (&plug);atomic_inc (&BTRFS_I (inode)->sync_writers); ret =btrfs_fdatawrite_range (inode, start, end);atomic_dec (&BTRFS_I (inode)->sync_writers); +blk_finish_plug (&plug);return ret; }
Signature · 1 line
2.15.1
PATCH 62/189 btrfs: Fix out of bounds access in btrfs_search_slot
In reply to Sasha LevinFrom: Nikolay Borisov <[email protected]>
[ Upstream commit 9ea2c7c9da13c9073e371c046cbbc45481ecb459 ]
When modifying a tree where the root is at BTRFS_MAX_LEVEL - 1 then the level variable is going to be 7 (this is the max height of the tree). On the other hand btrfs_cow_block is always called with "level + 1" as an index into the nodes and slots arrays. This leads to an out of bounds access. Admittdely this will be benign since an OOB access of the nodes array will likely read the 0th element from the slots array, which in this case is going to be 0 (since we start CoW at the top of the tree). The OOB access into the slots array in turn will read the 0th and 1st values of the locks array, which would both be 0 at the time. However, this benign behavior relies on the fact that the path being passed hasn't been initialised, if it has already been used to query a btree then it could potentially have populated the nodes/slots arrays.
Fix it by explicitly checking if we are at level 7 (the maximum allowed index in nodes/slots arrays) and explicitly call the CoW routine with NULL for parent's node/slot.
Fixes-coverity-id: 711515
--- fs/btrfs/ctree.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
fs/btrfs/ctree.c +9 -3
@@ -2774,6 +2774,8 @@ again:* contention with the cow code */ if (cow) { +bool last_level = (level == (BTRFS_MAX_LEVEL -1 )); +/* * if we don't really need to cow this block * then we don't want to set the path blocking,
@@ -2798,9 +2800,13 @@ again: }btrfs_set_path_blocking (p); - err =btrfs_cow_block (trans, root, b, - p->nodes[level +1 ], - p->slots[level +1 ], &b); +if (last_level) + err =btrfs_cow_block (trans, root, b,NULL ,0 , + &b); +else + err =btrfs_cow_block (trans, root, b, + p->nodes[level +1 ], + p->slots[level +1 ], &b);if (err) { ret = err; goto done;
Signature · 1 line
2.15.1
PATCH 63/189 Btrfs: fix scrub to repair raid6 corruption
In reply to Sasha LevinFrom: Liu Bo <[email protected]>
[ Upstream commit 762221f095e3932669093466aaf4b85ed9ad2ac1 ]
The raid6 corruption is that,
suppose that all disks can be read without problems and if the content that was read out doesn't match its checksum, currently for raid6 btrfs at most retries twice,
- the 1st retry is to rebuild with all other stripes, it'll eventually be a raid5 xor rebuild,
- if the 1st fails, the 2nd retry will deliberately fail parity p so that it will do raid6 style rebuild,
however, the chances are that another non-parity stripe content also has something corrupted, so that the above retries are not able to return correct content.
We've fixed normal reads to rebuild raid6 correctly with more retries in Patch "Btrfs: make raid6 rebuild retry more"[1], this is to fix scrub to do the exactly same rebuild process.
[1]: https://patchwork.kernel.org/patch/10091755/
--- fs/btrfs/raid56.c | 18 ++++++++++++++---- fs/btrfs/volumes.c | 9 ++++++++- 2 files changed, 22 insertions(+), 5 deletions(-)
fs/btrfs/raid56.c +14 -4
@@ -2170,11 +2170,21 @@ int raid56_parity_recover(struct btrfs_fs_info *fs_info, struct bio *bio, }/* -* reconstruct from the q stripe if they are -* asking for mirror 3 +* Loop retry: +* for 'mirror == 2', reconstruct from all other stripes. +* for 'mirror_num > 2', select a stripe to fail on every retry. */ -if (mirror_num ==3 ) - rbio->failb = rbio->real_stripes -2 ; +if (mirror_num >2 ) { +/* +* 'mirror == 3' is to fail the p stripe and +* reconstruct from the q stripe. 'mirror > 3' is to +* fail a data stripe and reconstruct from p+q stripe. +*/ + rbio->failb = rbio->real_stripes - (mirror_num -1 ); +ASSERT (rbio->failb >0 ); +if (rbio->failb <= rbio->faila) + rbio->failb--; + } ret =lock_stripe_add (rbio);
fs/btrfs/volumes.c +8 -1
@@ -5105,7 +5105,14 @@ int btrfs_num_copies(struct btrfs_fs_info *fs_info, u64 logical, u64 len)else if (map->type &BTRFS_BLOCK_GROUP_RAID5 ) ret =2 ;else if (map->type &BTRFS_BLOCK_GROUP_RAID6 ) - ret =3 ; +/* +* There could be two corrupted data stripes, we need +* to loop retry in order to rebuild the correct data. +* +* Fail a stripe at a time on every retry except the +* stripe under reconstruction. +*/ + ret = map->num_stripes;else ret =1 ;free_extent_map (em);
Signature · 1 line
2.15.1
PATCH 68/189 f2fs: avoid hungtask when GC encrypted block if io_bits is set
In reply to Sasha LevinFrom: Sheng Yong <[email protected]>
[ Upstream commit a9d572c7550044d5b217b5287d99a2e6d34b97b0 ]
When io_bits is set, GCing encrypted block may hit the following hungtask. Since io_bits requires aligned block address, f2fs_submit_page_write may return -EAGAIN if new_blkaddr does not satisify io_bits alignment. As a result, the encrypted page will never be writtenback.
This patch makes move_data_block aware the EAGAIN error and cancel the writeback.
[ 246.751371] INFO: task kworker/u4:4:797 blocked for more than 90 seconds. [ 246.752423] Not tainted 4.15.0-rc4+ #11 [ 246.754176] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 246.755336] kworker/u4:4 D25448 797 2 0x80000000 [ 246.755597] Workqueue: writeback wb_workfn (flush-7:0) [ 246.755616] Call Trace: [ 246.755695] ? __schedule+0x322/0xa90 [ 246.755761] ? blk_init_request_from_bio+0x120/0x120 [ 246.755773] ? pci_mmcfg_check_reserved+0xb0/0xb0 [ 246.755801] ? __radix_tree_create+0x19e/0x200 [ 246.755813] ? delete_node+0x136/0x370 [ 246.755838] schedule+0x43/0xc0 [ 246.755904] io_schedule+0x17/0x40 [ 246.755939] wait_on_page_bit_common+0x17b/0x240 [ 246.755950] ? wake_page_function+0xa0/0xa0 [ 246.755961] ? add_to_page_cache_lru+0x160/0x160 [ 246.755972] ? page_cache_tree_insert+0x170/0x170 [ 246.755983] ? __lru_cache_add+0x96/0xb0 [ 246.756086] __filemap_fdatawait_range+0x14f/0x1c0 [ 246.756097] ? wait_on_page_bit_common+0x240/0x240 [ 246.756120] ? __wake_up_locked_key_bookmark+0x20/0x20 [ 246.756167] ? wait_on_all_pages_writeback+0xc9/0x100 [ 246.756179] ? __remove_ino_entry+0x120/0x120 [ 246.756192] ? wait_woken+0x100/0x100 [ 246.756204] filemap_fdatawait_range+0x9/0x20 [ 246.756216] write_checkpoint+0x18a1/0x1f00 [ 246.756254] ? blk_get_request+0x10/0x10 [ 246.756265] ? cpumask_next_and+0x43/0x60 [ 246.756279] ? f2fs_sync_inode_meta+0x160/0x160 [ 246.756289] ? remove_element.isra.4+0xa0/0xa0 [ 246.756300] ? __put_compound_page+0x40/0x40 [ 246.756310] ? f2fs_sync_fs+0xec/0x1c0 [ 246.756320] ? f2fs_sync_fs+0x120/0x1c0 [ 246.756329] f2fs_sync_fs+0x120/0x1c0 [ 246.756357] ? trace_event_raw_event_f2fs__page+0x260/0x260 [ 246.756393] ? ata_build_rw_tf+0x173/0x410 [ 246.756397] f2fs_balance_fs_bg+0x198/0x390 [ 246.756405] ? drop_inmem_page+0x230/0x230 [ 246.756415] ? ahci_qc_prep+0x1bb/0x2e0 [ 246.756418] ? ahci_qc_issue+0x1df/0x290 [ 246.756422] ? __accumulate_pelt_segments+0x42/0xd0 [ 246.756426] ? f2fs_write_node_pages+0xd1/0x380 [ 246.756429] f2fs_write_node_pages+0xd1/0x380 [ 246.756437] ? sync_node_pages+0x8f0/0x8f0 [ 246.756440] ? update_curr+0x53/0x220 [ 246.756444] ? __accumulate_pelt_segments+0xa2/0xd0 [ 246.756448] ? __update_load_avg_se.isra.39+0x349/0x360 [ 246.756452] ? do_writepages+0x2a/0xa0 [ 246.756456] do_writepages+0x2a/0xa0 [ 246.756460] __writeback_single_inode+0x70/0x490 [ 246.756463] ? check_preempt_wakeup+0x199/0x310 [ 246.756467] writeback_sb_inodes+0x2a2/0x660 [ 246.756471] ? is_empty_dir_inode+0x40/0x40 [ 246.756474] ? __writeback_single_inode+0x490/0x490 [ 246.756477] ? string+0xbf/0xf0 [ 246.756480] ? down_read_trylock+0x35/0x60 [ 246.756484] __writeback_inodes_wb+0x9f/0xf0 [ 246.756488] wb_writeback+0x41d/0x4b0 [ 246.756492] ? writeback_inodes_wb.constprop.55+0x150/0x150 [ 246.756498] ? set_worker_desc+0xf7/0x130 [ 246.756502] ? current_is_workqueue_rescuer+0x60/0x60 [ 246.756511] ? _find_next_bit+0x2c/0xa0 [ 246.756514] ? wb_workfn+0x400/0x5d0 [ 246.756518] wb_workfn+0x400/0x5d0 [ 246.756521] ? finish_task_switch+0xdf/0x2a0 [ 246.756525] ? inode_wait_for_writeback+0x30/0x30 [ 246.756529] process_one_work+0x3a7/0x6f0 [ 246.756533] worker_thread+0x82/0x750 [ 246.756537] kthread+0x16f/0x1c0 [ 246.756541] ? trace_event_raw_event_workqueue_work+0x110/0x110 [ 246.756544] ? kthread_create_worker_on_cpu+0xb0/0xb0 [ 246.756548] ret_from_fork+0x1f/0x30
--- fs/f2fs/gc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/f2fs/gc.c +6 -1
@@ -686,7 +686,12 @@ static void move_data_block(struct inode *inode, block_t bidx, fio.op =REQ_OP_WRITE ; fio.op_flags =REQ_SYNC ; fio.new_blkaddr = newaddr; -f2fs_submit_page_write (&fio); + err =f2fs_submit_page_write (&fio); +if (err) { +if (PageWriteback (fio.encrypted_page)) +end_page_writeback (fio.encrypted_page); + goto put_page_out; + }f2fs_update_iostat (fio.sbi,FS_GC_DATA_IO ,F2FS_BLKSIZE );
Signature · 1 line
2.15.1
PATCH 69/189 f2fs: fix to update last_disk_size correctly
In reply to Sasha LevinFrom: Chao Yu <[email protected]>
[ Upstream commit eb4497975e82448746bb7de3d13b743b7145aed7 ]
This patch fixes to update last_disk_size only when writing out page successfully.
--- fs/f2fs/data.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
fs/f2fs/data.c +8 -4
@@ -1571,10 +1571,14 @@ write: } } -down_write (&F2FS_I (inode)->i_sem); -if (F2FS_I (inode)->last_disk_size < psize) -F2FS_I (inode)->last_disk_size = psize; -up_write (&F2FS_I (inode)->i_sem); +if (err) { +file_set_keep_isize (inode); + }else { +down_write (&F2FS_I (inode)->i_sem); +if (F2FS_I (inode)->last_disk_size < psize) +F2FS_I (inode)->last_disk_size = psize; +up_write (&F2FS_I (inode)->i_sem); + } done:if (err && err != -ENOENT )
Signature · 1 line
2.15.1
PATCH 70/189 scsi: devinfo: fix format of the device list
In reply to Sasha LevinFrom: Xose Vazquez Perez <[email protected]>
[ Upstream commit 3f884a0a8bdf28cfd1e9987d54d83350096cdd46 ]
Replace "" with NULL for product revision level, and merge TEXEL duplicate entries.
--- drivers/scsi/scsi_devinfo.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/scsi/scsi_devinfo.c +3 -4
@@ -108,8 +108,8 @@ static struct {* seagate controller, which causes SCSI code to reset bus. */ {"HP", "C1750A", "3226", BLIST_NOLUN}, /* scanjet iic */ - {"HP", "C1790A", "", BLIST_NOLUN}, /* scanjet iip */ - {"HP", "C2500A", "", BLIST_NOLUN}, /* scanjet iicx */ + {"HP", "C1790A", NULL, BLIST_NOLUN}, /* scanjet iip */ + {"HP", "C2500A", NULL, BLIST_NOLUN}, /* scanjet iicx */ {"MEDIAVIS", "CDR-H93MV", "1.31", BLIST_NOLUN}, /* locks up */ {"MICROTEK", "ScanMaker II", "5.61", BLIST_NOLUN}, /* responds to all lun */ {"MITSUMI", "CD-R CR-2201CS", "6119", BLIST_NOLUN}, /* locks up */
@@ -119,7 +119,7 @@ static struct { {"QUANTUM", "FIREBALL ST4.3S", "0F0C", BLIST_NOLUN}, /* locks up */ {"RELISYS", "Scorpio", NULL, BLIST_NOLUN}, /* responds to all lun */ {"SANKYO", "CP525", "6.64", BLIST_NOLUN}, /* causes failed REQ SENSE, extra reset */ - {"TEXEL", "CD-ROM", "1.06", BLIST_NOLUN}, + {"TEXEL", "CD-ROM", "1.06", BLIST_NOLUN | BLIST_BORKEN}, {"transtec", "T5008", "0001", BLIST_NOREPORTLUN }, {"YAMAHA", "CDR100", "1.00", BLIST_NOLUN}, /* locks up */ {"YAMAHA", "CDR102", "1.00", BLIST_NOLUN}, /* locks up */
@@ -255,7 +255,6 @@ static struct { {"ST650211", "CF", NULL, BLIST_RETRY_HWERROR}, {"SUN", "T300", "*", BLIST_SPARSELUN}, {"SUN", "T4", "*", BLIST_SPARSELUN}, - {"TEXEL", "CD-ROM", "1.06", BLIST_BORKEN}, {"Tornado-", "F4", "*", BLIST_NOREPORTLUN}, {"TOSHIBA", "CDROM", NULL, BLIST_ISROM}, {"TOSHIBA", "CD-ROM", NULL, BLIST_ISROM},
Signature · 1 line
2.15.1
PATCH 73/189 HID: roccat: prevent an out of bounds read in kovaplus_profile_activated()
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit 7ad81482cad67cbe1ec808490d1ddfc420c42008 ]
We get the "new_profile_index" value from the mouse device when we're handling raw events. Smatch taints it as untrusted data and complains that we need a bounds check. This seems like a reasonable warning otherwise there is a small read beyond the end of the array.
--- drivers/hid/hid-roccat-kovaplus.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/hid/hid-roccat-kovaplus.c +2 -0
@@ -37,6 +37,8 @@ static uint kovaplus_convert_event_cpi(uint value)static void kovaplus_profile_activated (struct kovaplus_device *kovaplus,uint new_profile_index) { +if (new_profile_index >=ARRAY_SIZE (kovaplus->profile_settings)) +return ; kovaplus->actual_profile = new_profile_index; kovaplus->actual_cpi = kovaplus->profile_settings[new_profile_index].cpi_startup_level; kovaplus->actual_x_sensitivity = kovaplus->profile_settings[new_profile_index].sensitivity_x;
Signature · 1 line
2.15.1
PATCH 74/189 nfp: fix error return code in nfp_pci_probe()
In reply to Sasha LevinFrom: Wei Yongjun <[email protected]>
[ Upstream commit e58decc9c51eb61697aba35ba8eda33f4b80552d ]
Fix to return error code -EINVAL instead of 0 when num_vfs above limit_vfs, as done elsewhere in this function.
--- drivers/net/ethernet/netronome/nfp/nfp_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/netronome/nfp/nfp_main.c +1 -0
@@ -518,6 +518,7 @@ static int nfp_pci_probe(struct pci_dev *pdev,dev_err (&pdev->dev,"Error: %d VFs already enabled, but loaded FW can only support %d\n" , pf->num_vfs, pf->limit_vfs); + err = -EINVAL ; goto err_fw_unload; }
Signature · 1 line
2.15.1
PATCH 31/189 tools lib traceevent: Fix get_field_str() for dynamic strings
In reply to Sasha LevinFrom: "Steven Rostedt (VMware)" <[email protected]>
[ Upstream commit d777f8de99b05d399c0e4e51cdce016f26bd971b ]
If a field is a dynamic string, get_field_str() returned just the offset/size value and not the string. Have it parse the offset/size correctly to return the actual string. Otherwise filtering fails when trying to filter fields that are dynamic strings.
--- tools/lib/traceevent/parse-filter.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
tools/lib/traceevent/parse-filter.c +9 -1
@@ -1879,17 +1879,25 @@ static const char *get_field_str(struct filter_arg *arg, struct pevent_record *rstruct pevent *pevent;unsigned long long addr;const char *val =NULL ; +unsigned int size;char hex[64 ];/* If the field is not a string convert it */ if (arg->str.field->flags &FIELD_IS_STRING ) { val = record->data + arg->str.field->offset; + size = arg->str.field->size; + +if (arg->str.field->flags &FIELD_IS_DYNAMIC ) { + addr = *(unsigned int *)val; + val = record->data + (addr &0xffff ); + size = addr >>16 ; + }/* * We need to copy the data since we can't be sure the field * is null terminated. */ -if (*(val + arg->str.field->size -1 )) { +if (*(val + size -1 )) {/* copy it */ memcpy (arg->str.buffer, val, arg->str.field->size);/* the buffer is already NULL terminated */
Signature · 1 line
2.15.1
PATCH 32/189 perf record: Fix failed memory allocation for get_cpuid_str
In reply to Sasha LevinFrom: Thomas Richter <[email protected]>
[ Upstream commit 81fccd6ca507d3b2012eaf1edeb9b1dbf4bd22db ]
In x86 architecture dependend part function get_cpuid_str() mallocs a 128 byte buffer, but does not check if the memory allocation succeeded or not.
When the memory allocation fails, function __get_cpuid() is called with first parameter being a NULL pointer. However this function references its first parameter and operates on a NULL pointer which might cause core dumps.
--- tools/perf/arch/x86/util/header.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/arch/x86/util/header.c +1 -1
@@ -70,7 +70,7 @@ get_cpuid_str(void) {char *buf =malloc (128 ); -if (__get_cpuid (buf,128 ,"%s-%u-%X$" ) <0 ) { +if (buf &&__get_cpuid (buf,128 ,"%s-%u-%X$" ) <0 ) {free (buf);return NULL ; }
Signature · 1 line
2.15.1
PATCH 77/189 bpf: test_maps: cleanup sockmaps when test ends
In reply to Sasha LevinFrom: Prashant Bhole <[email protected]>
[ Upstream commit 783687810e986a15ffbf86c516a1a48ff37f38f7 ]
Bug: BPF programs and maps related to sockmaps test exist in memory even after test_maps ends.
This patch fixes it as a short term workaround (sockmap kernel side needs real fixing) by empyting sockmaps when test ends.
--- tools/testing/selftests/bpf/test_maps.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
tools/testing/selftests/bpf/test_maps.c +12 -4
@@ -463,7 +463,7 @@ static void test_devmap(int task, void *data)#define SOCKMAP_VERDICT_PROG "./sockmap_verdict_prog.o"static void test_sockmap (int tasks,void *data) { -int one =1 , map_fd_rx, map_fd_tx, map_fd_break, s, sc, rc; +int one =1 , map_fd_rx =0 , map_fd_tx =0 , map_fd_break, s, sc, rc;struct bpf_map *bpf_map_rx, *bpf_map_tx, *bpf_map_break;int ports[] = {50200 ,50201 ,50202 ,50204 };int err, i, fd, udp, sfd[6 ] = {0xdeadbeef };
@@ -868,9 +868,12 @@ static void test_sockmap(int tasks, void *data) goto out_sockmap; } -/* Test map close sockets */ -for (i =0 ; i <6 ; i++) +/* Test map close sockets and empty maps */ +for (i =0 ; i <6 ; i++) { +bpf_map_delete_elem (map_fd_tx, &i); +bpf_map_delete_elem (map_fd_rx, &i);close (sfd[i]); + }close (fd);close (map_fd_rx);bpf_object__close (obj);
@@ -881,8 +884,13 @@ out:printf ("Failed to create sockmap '%i:%s'!\n" , i,strerror (errno));exit (1 ); out_sockmap: -for (i =0 ; i <6 ; i++) +for (i =0 ; i <6 ; i++) { +if (map_fd_tx) +bpf_map_delete_elem (map_fd_tx, &i); +if (map_fd_rx) +bpf_map_delete_elem (map_fd_rx, &i);close (sfd[i]); + }close (fd);exit (1 ); }
Signature · 1 line
2.15.1
PATCH 33/189 iommu/exynos: Don't unconditionally steal bus ops
In reply to Sasha LevinFrom: Robin Murphy <[email protected]>
[ Upstream commit dc98b8480d8a68c2ce9aa28b9f0d714fd258bc0b ]
Removing the early device registration hook overlooked the fact that it only ran conditionally on a compatible device being present in the DT. With exynos_iommu_init() now running as an unconditional initcall, problems arise on non-Exynos systems when other IOMMU drivers find themselves unable to install their ops on the platform bus, or at worst the Exynos ops get called with someone else's domain and all hell breaks loose.
The global ops/cache setup could probably all now be triggered from the first IOMMU probe, as with dma_dev assigment, but for the time being the simplest fix is to resurrect the logic from commit a7b67cd5d9af ("iommu/exynos: Play nice in multi-platform builds") to explicitly check the DT for the presence of an Exynos IOMMU before trying anything.
--- drivers/iommu/exynos-iommu.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/iommu/exynos-iommu.c +7 -0
@@ -1353,8 +1353,15 @@ static const struct iommu_ops exynos_iommu_ops = {static int __init exynos_iommu_init (void ) { +struct device_node *np;int ret; + np =of_find_matching_node (NULL , sysmmu_of_match); +if (!np) +return 0 ; + +of_node_put (np); + lv2table_kmem_cache =kmem_cache_create ("exynos-iommu-lv2table" ,LV2TABLE_SIZE ,LV2TABLE_SIZE ,0 ,NULL );if (!lv2table_kmem_cache) {
Signature · 1 line
2.15.1
PATCH 78/189 i40evf: Don't schedule reset_task when device is being removed
In reply to Sasha LevinFrom: Avinash Dayanand <[email protected]>
[ Upstream commit 06aa040f039404a0039a5158cd12f41187487a1f ]
When a host disables and enables a PF device, all the associated VFs are removed and added back in. It also generates a PFR which in turn resets all the connected VFs. This behaviour is different from that of Linux guest on Linux host. Hence we end up in a situation where there's a PFR and device removal at the same time. And watchdog doesn't have a clue about this and schedules a reset_task. This patch adds code to send signal to reset_task that the device is currently being removed.
--- drivers/net/ethernet/intel/i40evf/i40evf.h | 1 + drivers/net/ethernet/intel/i40evf/i40evf_main.c | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40evf/i40evf.h +1 -0
@@ -187,6 +187,7 @@ enum i40evf_state_t {enum i40evf_critical_section_t { __I40EVF_IN_CRITICAL_TASK,/* cannot be interrupted */ __I40EVF_IN_CLIENT_TASK, + __I40EVF_IN_REMOVE_TASK,/* device being removed */ };/* board specific private data structure */
drivers/net/ethernet/intel/i40evf/i40evf_main.c +8 -1
@@ -1855,6 +1855,12 @@ static void i40evf_reset_task(struct work_struct *work)u32 reg_val;int i =0 , err; +/* When device is being removed it doesn't make sense to run the reset +* task, just return in such a case. +*/ +if (test_bit (__I40EVF_IN_REMOVE_TASK, &adapter->crit_section)) +return ; +while (test_and_set_bit (__I40EVF_IN_CLIENT_TASK, &adapter->crit_section))usleep_range (500 ,1000 );
@@ -3066,7 +3072,8 @@ static void i40evf_remove(struct pci_dev *pdev)struct i40evf_mac_filter *f, *ftmp;struct i40e_hw *hw = &adapter->hw;int err; - +/* Indicate we are in remove and not to run reset_task */ +set_bit (__I40EVF_IN_REMOVE_TASK, &adapter->crit_section);cancel_delayed_work_sync (&adapter->init_task);cancel_work_sync (&adapter->reset_task);cancel_delayed_work_sync (&adapter->client_task);
Signature · 1 line
2.15.1
PATCH 35/189 iommu/vt-d: Use domain instead of cache fetching
In reply to Sasha LevinFrom: Peter Xu <[email protected]>
[ Upstream commit 9d2e6505f6d6934e681aed502f566198cb25c74a ]
after commit a1ddcbe93010 ("iommu/vt-d: Pass dmar_domain directly into iommu_flush_iotlb_psi", 2015-08-12), we have domain pointer as parameter to iommu_flush_iotlb_psi(), so no need to fetch it from cache again.
More importantly, a NULL reference pointer bug is reported on RHEL7 (and it can be reproduced on some old upstream kernels too, e.g., v4.13) by unplugging an 40g nic from a VM (hard to test unplug on real host, but it should be the same):
https://bugzilla.redhat.com/show_bug.cgi?id=1531367
[ 24.391863] pciehp 0000:00:03.0:pcie004: Slot(0): Attention button pressed [ 24.393442] pciehp 0000:00:03.0:pcie004: Slot(0): Powering off due to button press [ 29.721068] i40evf 0000:01:00.0: Unable to send opcode 2 to PF, err I40E_ERR_QUEUE_EMPTY, aq_err OK [ 29.783557] iommu: Removing device 0000:01:00.0 from group 3 [ 29.784662] BUG: unable to handle kernel NULL pointer dereference at 0000000000000304 [ 29.785817] IP: iommu_flush_iotlb_psi+0xcf/0x120 [ 29.786486] PGD 0 [ 29.786487] P4D 0 [ 29.786812] [ 29.787390] Oops: 0000 [#1] SMP [ 29.787876] Modules linked in: ip6t_rpfilter ip6t_REJECT nf_reject_ipv6 xt_conntrack ip_set nfnetlink ebtable_nat ebtable_broute bridge stp llc ip6table_ng [ 29.795371] CPU: 0 PID: 156 Comm: kworker/0:2 Not tainted 4.13.0 #14 [ 29.796366] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.11.0-1.el7 04/01/2014 [ 29.797593] Workqueue: pciehp-0 pciehp_power_thread [ 29.798328] task: ffff94f5745b4a00 task.stack: ffffb326805ac000 [ 29.799178] RIP: 0010:iommu_flush_iotlb_psi+0xcf/0x120 [ 29.799919] RSP: 0018:ffffb326805afbd0 EFLAGS: 00010086 [ 29.800666] RAX: ffff94f5bc56e800 RBX: 0000000000000000 RCX: 0000000200000025 [ 29.801667] RDX: ffff94f5bc56e000 RSI: 0000000000000082 RDI: 0000000000000000 [ 29.802755] RBP: ffffb326805afbf8 R08: 0000000000000000 R09: ffff94f5bc86bbf0 [ 29.803772] R10: ffffb326805afba8 R11: 00000000000ffdc4 R12: ffff94f5bc86a400 [ 29.804789] R13: 0000000000000000 R14: 00000000ffdc4000 R15: 0000000000000000 [ 29.805792] FS: 0000000000000000(0000) GS:ffff94f5bfc00000(0000) knlGS:0000000000000000 [ 29.806923] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 29.807736] CR2: 0000000000000304 CR3: 000000003499d000 CR4: 00000000000006f0 [ 29.808747] Call Trace: [ 29.809156] flush_unmaps_timeout+0x126/0x1c0 [ 29.809800] domain_exit+0xd6/0x100 [ 29.810322] device_notifier+0x6b/0x70 [ 29.810902] notifier_call_chain+0x4a/0x70 [ 29.812822] __blocking_notifier_call_chain+0x47/0x60 [ 29.814499] blocking_notifier_call_chain+0x16/0x20 [ 29.816137] device_del+0x233/0x320 [ 29.817588] pci_remove_bus_device+0x6f/0x110 [ 29.819133] pci_stop_and_remove_bus_device+0x1a/0x20 [ 29.820817] pciehp_unconfigure_device+0x7a/0x1d0 [ 29.822434] pciehp_disable_slot+0x52/0xe0 [ 29.823931] pciehp_power_thread+0x8a/0xa0 [ 29.825411] process_one_work+0x18c/0x3a0 [ 29.826875] worker_thread+0x4e/0x3b0 [ 29.828263] kthread+0x109/0x140 [ 29.829564] ? process_one_work+0x3a0/0x3a0 [ 29.831081] ? kthread_park+0x60/0x60 [ 29.832464] ret_from_fork+0x25/0x30 [ 29.833794] Code: 85 ed 74 0b 5b 41 5c 41 5d 41 5e 41 5f 5d c3 49 8b 54 24 60 44 89 f8 0f b6 c4 48 8b 04 c2 48 85 c0 74 49 45 0f b6 ff 4a 8b 3c f8 <80> bf [ 29.838514] RIP: iommu_flush_iotlb_psi+0xcf/0x120 RSP: ffffb326805afbd0 [ 29.840362] CR2: 0000000000000304 [ 29.841716] ---[ end trace b10ec0d6900868d3 ]---
This patch fixes that problem if applied to v4.13 kernel.
The bug does not exist on latest upstream kernel since it's fixed as a side effect of commit 13cf01744608 ("iommu/vt-d: Make use of iova deferred flushing", 2017-08-15). But IMHO it's still good to have this patch upstream.
--- drivers/iommu/intel-iommu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/iommu/intel-iommu.c +1 -2
@@ -1601,8 +1601,7 @@ static void iommu_flush_iotlb_psi(struct intel_iommu *iommu,* flush. However, device IOTLB doesn't need to be flushed in this case. */ if (!cap_caching_mode (iommu->cap) || !map) -iommu_flush_dev_iotlb (get_iommu_domain (iommu, did), - addr, mask); +iommu_flush_dev_iotlb (domain, addr, mask); }static void iommu_flush_iova (struct iova_domain *iovad)
Signature · 1 line
2.15.1
PATCH 81/189 platform/x86: thinkpad_acpi: suppress warning about palm detection
In reply to Sasha LevinFrom: David Herrmann <[email protected]>
[ Upstream commit 587d8628fb71c3bfae29fb2bbe84c1478c59bac8 ]
This patch prevents the thinkpad_acpi driver from warning about 2 event codes returned for keyboard palm-detection. No behavioral changes, other than suppressing the warning in the kernel log. The events are still forwarded via acpi-netlink channels.
We could, optionally, decide to forward the event through a input-switch on the tpacpi input device. However, so far no suitable input-code exists, and no similar drivers report such events. Hence, leave it an acpi event for now.
Note that the event-codes are named based on empirical studies. On the ThinkPad X1 5th Gen the sensor can be found underneath the arrow key.
--- drivers/platform/x86/thinkpad_acpi.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/platform/x86/thinkpad_acpi.c +10 -0
@@ -214,6 +214,10 @@ enum tpacpi_hkey_event_t {/* AC-related events */ TP_HKEY_EV_AC_CHANGED =0x6040 ,/* AC status changed */ +/* Further user-interface events */ +TP_HKEY_EV_PALM_DETECTED =0x60b0 ,/* palm hoveres keyboard */ +TP_HKEY_EV_PALM_UNDETECTED =0x60b1 ,/* palm removed */ +/* Misc */ TP_HKEY_EV_RFKILL_CHANGED = 0x7000, /* rfkill switch changed */ };
@@ -4079,6 +4083,12 @@ static bool hotkey_notify_6xxx(const u32 hkey, *send_acpi_ev = false;break ; +case TP_HKEY_EV_PALM_DETECTED : +case TP_HKEY_EV_PALM_UNDETECTED : +/* palm detected hovering the keyboard, forward to user-space +* via netlink for consumption */ +return true; +default :pr_warn ("unknown possible thermal alarm or keyboard event received\n" ); known = false;
Signature · 1 line
2.15.1
PATCH 37/189 dm mpath: return DM_MAPIO_REQUEUE on blk-mq rq allocation failure
In reply to Sasha LevinFrom: Ming Lei <[email protected]>
[ Upstream commit 050af08ffb1b62af69196d61c22a0755f9a3cdbd ]
blk-mq will rerun queue via RESTART or dispatch wake after one request is completed, so not necessary to wait random time for requeuing, we should trust blk-mq to do it.
More importantly, we need to return BLK_STS_RESOURCE to blk-mq so that dequeuing from the I/O scheduler can be stopped, this results in improved I/O merging.
--- drivers/md/dm-mpath.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/md/dm-mpath.c +13 -1
@@ -534,8 +534,20 @@ static int multipath_clone_and_map(struct dm_target *ti, struct request *rq,if (queue_dying) {atomic_inc (&m->pg_init_in_progress);activate_or_offline_path (pgpath); +return DM_MAPIO_DELAY_REQUEUE ; } -return DM_MAPIO_DELAY_REQUEUE ; + +/* +* blk-mq's SCHED_RESTART can cover this requeue, so we +* needn't deal with it by DELAY_REQUEUE. More importantly, +* we have to return DM_MAPIO_REQUEUE so that blk-mq can +* get the queue busy feedback (via BLK_STS_RESOURCE), +* otherwise I/O merging can suffer. +*/ +if (q->mq_ops) +return DM_MAPIO_REQUEUE ; +else +return DM_MAPIO_DELAY_REQUEUE ; } clone->bio = clone->biotail =NULL ; clone->rq_disk = bdev->bd_disk;
Signature · 1 line
2.15.1
PATCH 39/189 nvme-fc: fix rogue admin cmds stalling teardown
In reply to Sasha LevinFrom: James Smart <[email protected]>
[ Upstream commit d625d05ef0f0914a706d824fab85472a42be6659 ]
When connectivity is lost to a device, the association is terminated and the blk-mq queues are quiesced/stopped. When connectivity is re-established, they are resumed.
If an admin command is received while connectivity is list, the ioctl queues the command on the admin_q and the command stalls (the thread issuing the ioctl hangs/waits). if the connectivity is lost long enough such that the controller is then deleted, the delete code makes its calls to initiate the delete, which then expects the core layer to call the transport when all references are removed and the controller can be freed. Unfortunately, nothing in this path dequeued the admin command, so a reference sits outstanding and things stop, hanging the delete indefinitely.
Correct by unquiescing the admin queue in the delete association. This means any admin command (which should only be from an ioctl) issued after connectivity is lost will detect the controller is in a reconnecting state and will (fast) fail the command. Thus, a pending reference can no longer be created. Once connectivity is re-established, a new ioctl/admin command would see proper device state and function again.
--- drivers/nvme/host/fc.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/nvme/host/fc.c +3 -0
@@ -2921,6 +2921,9 @@ nvme_fc_delete_association(struct nvme_fc_ctrl *ctrl)__nvme_fc_delete_hw_queue (ctrl, &ctrl->queues[0 ],0 );nvme_fc_free_queue (&ctrl->queues[0 ]); +/* re-enable the admin_q so anything new can fast fail */ +blk_mq_unquiesce_queue (ctrl->ctrl.admin_q); +nvme_fc_ctlr_inactive_on_rport (ctrl); }
Signature · 1 line
2.15.1
PATCH 40/189 ubifs: Fix uninitialized variable in search_dh_cookie()
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit c877154d307f4a91e0b5b85b75535713dab945ae ]
fs/ubifs/tnc.c: In function ‘search_dh_cookie’:fs/ubifs/tnc.c:1893: warning: ‘err’ is used uninitialized in this function
Indeed, err is always used uninitialized.
According to an original review comment from Hyunchul, acknowledged by Richard, err should be initialized to -ENOENT to avoid the first call to tnc_next(). But we can achieve the same by reordering the code.
--- fs/ubifs/tnc.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-)
fs/ubifs/tnc.c +7 -14
@@ -1890,35 +1890,28 @@ static int search_dh_cookie(struct ubifs_info *c, const union ubifs_key *key,union ubifs_key *dkey;for (;;) { -if (!err) { - err =tnc_next (c, &znode, n); -if (err) - goto out; - } - zbr = &znode->zbranch[*n]; dkey = &zbr->key;if (key_inum (c, dkey) !=key_inum (c, key) ||key_type (c, dkey) !=key_type (c, key)) { - err = -ENOENT ; - goto out; +return -ENOENT ; } err =tnc_read_hashed_node (c, zbr, dent);if (err) - goto out; +return err;if (key_hash (c, key) ==key_hash (c, dkey) &&le32_to_cpu (dent->cookie) == cookie) { *zn = znode; - goto out; +return 0 ; } - } - -out: -return err; + err =tnc_next (c, &znode, n); +if (err) +return err; + } } static int do_lookup_dh(struct ubifs_info *c, const union ubifs_key *key,
Signature · 1 line
2.15.1
PATCH 41/189 net: stmmac: dwmac-meson8b: fix setting the RGMII TX clock on Meson8b
In reply to Sasha LevinFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit 433c6cab9d298687c097f6ee82e49157044dc7c6 ]
Meson8b only supports MPLL2 as clock input. The rate of the MPLL2 clock set by Odroid-C1's u-boot is close to (but not exactly) 500MHz. The exact rate is 500002394Hz, which is calculated in drivers/clk/meson/clk-mpll.c using the following formula:DIV_ROUND_UP_ULL((u64)parent_rate * SDM_DEN, (SDM_DEN * n2) + sdm) Odroid-C1's u-boot configures MPLL2 with the following values:
- SDM_DEN = 16384
- SDM = 1638
- N2 = 5
The 250MHz clock (m250_div) inside dwmac-meson8b driver is derived from the MPLL2 clock. Due to MPLL2 running slightly faster than 500MHz the common clock framework chooses a divider which is too big to generate the 250MHz clock (a divider of 2 would be needed, but this is rounded up to a divider of 3). This breaks the RTL8211F RGMII PHY on Odroid-C1 because it requires a (close to) 125MHz RGMII TX clock (on Gbit speeds, the IP block internally divides that down to 25MHz on 100Mbit/s connections and 2.5MHz on 10Mbit/s connections - we don't need any special configuration for that).
Round the divider to the closest value to prevent this issue on Meson8b. This means we'll now end up with a clock rate for the RGMII TX clock of 125001197Hz (= 125MHz plus 1197Hz), which is close-enough to 125MHz. This has no effect on the Meson GX SoCs since there fclk_div2 is used as input clock, which has a rate of 1000MHz (and thus is divisible cleanly to 250MHz and 125MHz).
--- drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +3 -1
@@ -144,7 +144,9 @@ static int meson8b_init_clk(struct meson8b_dwmac *dwmac) dwmac->m250_div.shift =PRG_ETH0_CLK_M250_DIV_SHIFT ; dwmac->m250_div.width =PRG_ETH0_CLK_M250_DIV_WIDTH ; dwmac->m250_div.hw.init = &init; - dwmac->m250_div.flags =CLK_DIVIDER_ONE_BASED |CLK_DIVIDER_ALLOW_ZERO ; + dwmac->m250_div.flags =CLK_DIVIDER_ONE_BASED | +CLK_DIVIDER_ALLOW_ZERO | +CLK_DIVIDER_ROUND_CLOSEST ; dwmac->m250_div_clk =devm_clk_register (dev, &dwmac->m250_div.hw);if (WARN_ON (IS_ERR (dwmac->m250_div_clk)))
Signature · 1 line
2.15.1
PATCH 42/189 net: stmmac: dwmac-meson8b: propagate rate changes to the parent clock
In reply to Sasha LevinFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit fb7d38a70e1d8ffd54f7a7464dcc4889d7e490ad ]
On Meson8b the only valid input clock is MPLL2. The bootloader configures that to run at 500002394Hz which cannot be divided evenly down to 125MHz using the m250_div clock. Currently the common clock framework chooses a m250_div of 2 - with the internal fixed "divide by 10" this results in a RGMII TX clock of 125001197Hz (120Hz above the requested 125MHz).
Letting the common clock framework propagate the rate changes up to the parent of m250_mux allows us to get the best possible clock rate. With this patch the common clock framework calculates a rate of very-close-to-250MHz (249999701Hz to be exact) for the MPLL2 clock (which is the mux input). Dividing that by 2 (which is an internal, fixed divider for the RGMII TX clock) gives us an RGMII TX clock of 124999850Hz (which is only 150Hz off the requested 125MHz, compared to 1197Hz based on the MPLL2 rate set by u-boot and the Amlogic GPL kernel sources).
SoCs from the Meson GX series are not affected by this change because the input clock is FCLK_DIV2 whose rate cannot be changed (which is fine since it's running at 1GHz, so it's already a multiple of 250MHz and 125MHz).
--- drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +1 -1
@@ -116,7 +116,7 @@ static int meson8b_init_clk(struct meson8b_dwmac *dwmac)snprintf (clk_name,sizeof (clk_name),"%s#m250_sel" ,dev_name (dev)); init.name = clk_name; init.ops = &clk_mux_ops; - init.flags =0 ; + init.flags =CLK_SET_RATE_PARENT ; init.parent_names = mux_parent_names; init.num_parents =MUX_CLK_NUM_PARENTS ;
Signature · 1 line
2.15.1
PATCH 86/189 igb: Allow to remove administratively set MAC on VFs
In reply to Sasha LevinFrom: Corinna Vinschen <[email protected]>
[ Upstream commit 177132df5e45b134c147f419f567a3b56aafaf2b ]
Before libvirt modifies the MAC address and vlan tag for an SRIOV VF for use by a virtual machine (either using vfio device assignment or macvtap passthru mode), it saves the current MAC address and vlan tag so that it can reset them to their original value when the guest is done. Libvirt can't leave the VF MAC set to the value used by the now-defunct guest since it may be started again later using a different VF, but it certainly shouldn't just pick any random value, either. So it saves the state of everything prior to using the VF, and resets it to that.
The igb driver initializes the MAC addresses of all VFs to 00:00:00:00:00:00, and reports that when asked (via an RTM_GETLINK netlink message, also visible in the list of VFs in the output of "ip link show"). But when libvirt attempts to restore the MAC address back to 00:00:00:00:00:00 (using an RTM_SETLINK netlink message) the kernel responds with "Invalid argument".
Forbidding a reset back to the original value leaves the VF MAC at the value set for the now-defunct virtual machine. Especially on a system with NetworkManager enabled, this has very bad consequences, since NetworkManager forces all interfacess to be IFF_UP all the time - if the same virtual machine is restarted using a different VF (or even on a different host), there will be multiple interfaces watching for traffic with the same MAC address.
To allow libvirt to revert to the original state, we need a way to remove the administrative set MAC on a VF, to allow normal host operation again, and to reset/overwrite the VF MAC via VF netdev.
This patch implements the outlined scenario by allowing to set the VF MAC to 00:00:00:00:00:00 via RTM_SETLINK on the PF. igb_ndo_set_vf_mac resets the IGB_VF_FLAG_PF_SET_MAC flag to 0, so it's possible to reset the VF MAC back to the original value via the VF netdev.
Note: Recent patches to libvirt allow for a workaround if the NIC isn't capable of resetting the administrative MAC back to all 0, but in theory the NIC should allow resetting the MAC in the first place.
--- drivers/net/ethernet/intel/igb/igb_main.c | 42 +++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 11 deletions(-)
drivers/net/ethernet/intel/igb/igb_main.c +31 -11
@@ -8718,7 +8718,8 @@ static void igb_rar_set_index(struct igb_adapter *adapter, u32 index)/* Indicate to hardware the Address is Valid. */ if (adapter->mac_table[index].state &IGB_MAC_STATE_IN_USE ) { - rar_high |=E1000_RAH_AV ; +if (is_valid_ether_addr (addr)) + rar_high |=E1000_RAH_AV ;if (hw->mac.type == e1000_82575) rar_high |= E1000_RAH_POOL_1 *
@@ -8756,17 +8757,36 @@ static int igb_set_vf_mac(struct igb_adapter *adapter,static int igb_ndo_set_vf_mac (struct net_device *netdev,int vf,u8 *mac) {struct igb_adapter *adapter =netdev_priv (netdev); -if (!is_valid_ether_addr (mac) || (vf >= adapter->vfs_allocated_count)) + +if (vf >= adapter->vfs_allocated_count) +return -EINVAL ; + +/* Setting the VF MAC to 0 reverts the IGB_VF_FLAG_PF_SET_MAC +* flag and allows to overwrite the MAC via VF netdev. This +* is necessary to allow libvirt a way to restore the original +* MAC after unbinding vfio-pci and reloading igbvf after shutting +* down a VM. +*/ +if (is_zero_ether_addr (mac)) { + adapter->vf_data[vf].flags &= ~IGB_VF_FLAG_PF_SET_MAC ; +dev_info (&adapter->pdev->dev, +"remove administratively set MAC on VF %d\n" , + vf); + }else if (is_valid_ether_addr (mac)) { + adapter->vf_data[vf].flags |=IGB_VF_FLAG_PF_SET_MAC ; +dev_info (&adapter->pdev->dev,"setting MAC %pM on VF %d\n" , + mac, vf); +dev_info (&adapter->pdev->dev, +"Reload the VF driver to make this change effective." ); +/* Generate additional warning if PF is down */ +if (test_bit (__IGB_DOWN, &adapter->state)) { +dev_warn (&adapter->pdev->dev, +"The VF MAC address has been set, but the PF device is not up.\n" ); +dev_warn (&adapter->pdev->dev, +"Bring the PF device up before attempting to use the VF device.\n" ); + } + }else {return -EINVAL ; - adapter->vf_data[vf].flags |=IGB_VF_FLAG_PF_SET_MAC ; -dev_info (&adapter->pdev->dev,"setting MAC %pM on VF %d\n" , mac, vf); -dev_info (&adapter->pdev->dev, -"Reload the VF driver to make this change effective." ); -if (test_bit (__IGB_DOWN, &adapter->state)) { -dev_warn (&adapter->pdev->dev, -"The VF MAC address has been set, but the PF device is not up.\n" ); -dev_warn (&adapter->pdev->dev, -"Bring the PF device up before attempting to use the VF device.\n" ); }return igb_set_vf_mac (adapter, vf, mac); }
Signature · 1 line
2.15.1
PATCH 43/189 spi: a3700: Clear DATA_OUT when performing a read
In reply to Sasha LevinFrom: Maxime Chevallier <[email protected]>
[ Upstream commit 44a5f423e70374e5b42cecd85e78f2d79334e0f2 ]
When performing a read using FIFO mode, the spi controller shifts out the last 2 bytes that were written in a previous transfer on MOSI.
This undocumented behaviour can cause devices to misinterpret the transfer, so we explicitly clear the WFIFO before each read.
This behaviour was noticed on EspressoBin.
--- drivers/spi/spi-armada-3700.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/spi/spi-armada-3700.c +5 -0
@@ -615,6 +615,11 @@ static int a3700_spi_transfer_one(struct spi_master *master,a3700_spi_header_set (a3700_spi);if (xfer->rx_buf) { +/* Clear WFIFO, since it's last 2 bytes are shifted out during +* a read operation +*/ +spireg_write (a3700_spi,A3700_SPI_DATA_OUT_REG ,0 ); +/* Set read data length */ spireg_write (a3700_spi,A3700_SPI_IF_DIN_CNT_REG , a3700_spi->buf_len);
Signature · 1 line
2.15.1
PATCH 44/189 ASoC: bcm2835: fix hw_params error when device is in prepared state
In reply to Sasha LevinFrom: Matthias Reichl <[email protected]>
[ Upstream commit 8d5737a5f53902a916ee1e1cb248c9b8b883b2ea ]
If bcm2835 is configured as bitclock master calling hw_params() after prepare() fails with EBUSY. This also makes it impossible to use bcm2835 in full duplex mode.
The error is caused by the split clock setup: clk_set_rate is called in hw_params, clk_prepare_enable in prepare. As hw_params doesn't check if the clock was already enabled clk_set_rate fails with EBUSY.
Fix this by moving clock startup from prepare to hw_params and let hw_params properly deal with an already set up or enabled clock.
--- sound/soc/bcm/bcm2835-i2s.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
sound/soc/bcm/bcm2835-i2s.c +14 -6
@@ -130,6 +130,7 @@ struct bcm2835_i2s_dev {struct regmap *i2s_regmap;struct clk *clk;bool clk_prepared; +int clk_rate; };static void bcm2835_i2s_start_clock (struct bcm2835_i2s_dev *dev)
@@ -419,10 +420,19 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream, }/* Clock should only be set up here if CPU is clock master */ -if (bit_clock_master) { - ret =clk_set_rate (dev->clk, bclk_rate); -if (ret) -return ret; +if (bit_clock_master && + (!dev->clk_prepared || dev->clk_rate != bclk_rate)) { +if (dev->clk_prepared) +bcm2835_i2s_stop_clock (dev); + +if (dev->clk_rate != bclk_rate) { + ret =clk_set_rate (dev->clk, bclk_rate); +if (ret) +return ret; + dev->clk_rate = bclk_rate; + } + +bcm2835_i2s_start_clock (dev); }/* Setup the frame format */
@@ -618,8 +628,6 @@ static int bcm2835_i2s_prepare(struct snd_pcm_substream *substream,struct bcm2835_i2s_dev *dev =snd_soc_dai_get_drvdata (dai);uint32_t cs_reg; -bcm2835_i2s_start_clock (dev); -/* * Clear both FIFOs if the one that should be started * is not empty at the moment. This should only happen
Signature · 1 line
2.15.1
PATCH 87/189 igb: Clear TXSTMP when ptp_tx_work() is timeout
In reply to Sasha LevinFrom: Daniel Hua <[email protected]>
[ Upstream commit 3a53285228165225a7f76c7d5ff1ddc0213ce0e4 ]
Problem description:
After ethernet cable connect and disconnect for several iterations on a device with i210, tx timestamp will stop being put into the socket.
Steps to reproduce:
1. Setup a device with i210 and wire it to a 802.1AS capable switch ( Extreme Networks Summit x440 is used in our case)
2. Have the gptp daemon running on the device and make sure it is synced with the switch
3. Have the switch disable and enable the port, wait for the device gets resynced with the switch
4. Iterates step 3 until the device is not albe to get resynced
5. Review the log in dmesg and you will see warning message "igb : clearing Tx timestamp hang"
Root cause:
If ptp_tx_work() gets scheduled just before the port gets disabled, a LINK DOWN event will be processed before ptp_tx_work(), which may cause timeout in ptp_tx_work(). In the timeout logic, the TSYNCTXCTL's TXTT bit (Transmit timestamp valid bit) is not cleared, causing no new timestamp loaded to TXSTMP register. Consequently therefore, no new interrupt is triggerred by TSICR.TXTS bit and no more Tx timestamp send to the socket.
--- drivers/net/ethernet/intel/igb/igb_ptp.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/net/ethernet/intel/igb/igb_ptp.c +9 -0
@@ -643,6 +643,10 @@ static void igb_ptp_tx_work(struct work_struct *work) adapter->ptp_tx_skb =NULL ;clear_bit_unlock (__IGB_PTP_TX_IN_PROGRESS, &adapter->state); adapter->tx_hwtstamp_timeouts++; +/* Clear the tx valid bit in TSYNCTXCTL register to enable +* interrupt +*/ +rd32 (E1000_TXSTMPH );dev_warn (&adapter->pdev->dev,"clearing Tx timestamp hang\n" );return ; }
@@ -717,6 +721,7 @@ void igb_ptp_rx_hang(struct igb_adapter *adapter)*/ void igb_ptp_tx_hang (struct igb_adapter *adapter) { +struct e1000_hw *hw = &adapter->hw;bool timeout =time_is_before_jiffies (adapter->ptp_tx_start +IGB_PTP_TX_TIMEOUT );
@@ -736,6 +741,10 @@ void igb_ptp_tx_hang(struct igb_adapter *adapter) adapter->ptp_tx_skb =NULL ;clear_bit_unlock (__IGB_PTP_TX_IN_PROGRESS, &adapter->state); adapter->tx_hwtstamp_timeouts++; +/* Clear the tx valid bit in TSYNCTXCTL register to enable +* interrupt +*/ +rd32 (E1000_TXSTMPH );dev_warn (&adapter->pdev->dev,"clearing Tx timestamp hang\n" ); } }
Signature · 1 line
2.15.1
PATCH 89/189 Input: edt-ft5x06 - fix error handling for factory mode on non-M06
In reply to Sasha LevinFrom: Dmitry Torokhov <[email protected]>
[ Upstream commit 4b3e910d7f430ab76dd37131bb75129878950163 ]
When attempting enter factory mode on firmware that does not support it, we'd error out, but leave the device with interrupts disabled, and thus touch not working. Fix it by moving the check before we disable interrupts/allocate memory for debug buffers.
--- drivers/input/touchscreen/edt-ft5x06.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/input/touchscreen/edt-ft5x06.c +6 -8
@@ -511,6 +511,12 @@ static int edt_ft5x06_factory_mode(struct edt_ft5x06_ts_data *tsdata)int ret;int error; +if (tsdata->version !=EDT_M06 ) { +dev_err (&client->dev, +"No factory mode support for non-M06 devices\n" ); +return -EINVAL ; + } +disable_irq (client->irq);if (!tsdata->raw_buffer) {
@@ -524,9 +530,6 @@ static int edt_ft5x06_factory_mode(struct edt_ft5x06_ts_data *tsdata) }/* mode register is 0x3c when in the work mode */ -if (tsdata->version !=EDT_M06 ) - goto m09_out; - error =edt_ft5x06_register_write (tsdata,WORK_REGISTER_OPMODE ,0x03 );if (error) { dev_err(&client->dev,
@@ -559,11 +562,6 @@ err_out:enable_irq (client->irq);return error; - -m09_out: -dev_err (&client->dev,"No factory mode support for M09/M12/GENERIC_FT\n" ); -return -EINVAL ; - }static int edt_ft5x06_work_mode (struct edt_ft5x06_ts_data *tsdata)
Signature · 1 line
2.15.1
PATCH 46/189 nfs: Do not convert nfs_idmap_cache_timeout to jiffies
In reply to Sasha LevinFrom: Jan Chochol <[email protected]>
[ Upstream commit cbebc6ef4fc830f4040d4140bf53484812d5d5d9 ]
Since commit 57e62324e469 ("NFS: Store the legacy idmapper result in the keyring") nfs_idmap_cache_timeout changed units from jiffies to seconds. Unfortunately sysctl interface was not updated accordingly.
As a effect updating /proc/sys/fs/nfs/idmap_cache_timeout with some value will incorrectly multiply this value by HZ.
Also reading /proc/sys/fs/nfs/idmap_cache_timeout will show real value divided by HZ.
--- fs/nfs/nfs4sysctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/nfs4sysctl.c +1 -1
@@ -32,7 +32,7 @@ static struct ctl_table nfs4_cb_sysctls[] = { .data = &nfs_idmap_cache_timeout, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_dointvec_jiffies, + .proc_handler = proc_dointvec, }, { } };
Signature · 1 line
2.15.1
PATCH 47/189 MIPS: Fix clean of vmlinuz.{32,ecoff,bin,srec}
In reply to Sasha LevinFrom: James Hogan <[email protected]>
[ Upstream commit 5f2483eb2423152445b39f2db59d372f523e664e ]
Make doesn't expand shell style "vmlinuz.{32,ecoff,bin,srec}" to the 4 separate files, so none of these files get cleaned up by make clean. List the files separately instead.
Patchwork: https://patchwork.linux-mips.org/patch/18491/
--- arch/mips/boot/compressed/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/mips/boot/compressed/Makefile +5 -1
@@ -133,4 +133,8 @@ vmlinuz.srec: vmlinuz uzImage.bin: vmlinuz.bin FORCE $(call if_changed,uimage,none) -clean-files := $(objtree)/vmlinuz $(objtree)/vmlinuz.{32,ecoff,bin,srec} +clean-files += $(objtree)/vmlinuz +clean-files += $(objtree)/vmlinuz.32 +clean-files += $(objtree)/vmlinuz.ecoff +clean-files += $(objtree)/vmlinuz.bin +clean-files += $(objtree)/vmlinuz.srec
Signature · 1 line
2.15.1
PATCH 90/189 x86/hyperv: Stop suppressing X86_FEATURE_PCID
In reply to Sasha LevinFrom: Vitaly Kuznetsov <[email protected]>
[ Upstream commit 617ab45c9a8900e64a78b43696c02598b8cad68b ]
When hypercall-based TLB flush was enabled for Hyper-V guests PCID feature was deliberately suppressed as a precaution: back then PCID was never exposed to Hyper-V guests and it wasn't clear what will happen if some day it becomes available. The day came and PCID/INVPCID features are already exposed on certain Hyper-V hosts.
Quoted 1 line
From TLFS (as of 5.0b) it is unclear how TLB flush hypercalls combine with
PCID. In particular the usage of PCID is per-cpu based: the same mm gets different CR3 values on different CPUs. If the hypercall does exact matching this will fail. However, this is not the case. David Zhang explains:
"In practice, the AddressSpace argument is ignored on any VM that supports
PCIDs.
Architecturally, the AddressSpace argument must match the CR3 with PCID bits stripped out (i.e., the low 12 bits of AddressSpace should be 0 in long mode). The flush hypercalls flush all PCIDs for the specified AddressSpace."
With this, PCID can be enabled.
--- arch/x86/hyperv/mmu.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
arch/x86/hyperv/mmu.c +10 -2
@@ -137,7 +137,12 @@ static void hyperv_flush_tlb_others(const struct cpumask *cpus, }if (info->mm) { +/* +* AddressSpace argument must match the CR3 with PCID bits +* stripped out. +*/ flush->address_space =virt_to_phys (info->mm->pgd); + flush->address_space &=CR3_ADDR_MASK ; flush->flags =0 ; }else { flush->address_space =0 ;
@@ -219,7 +224,12 @@ static void hyperv_flush_tlb_others_ex(const struct cpumask *cpus, }if (info->mm) { +/* +* AddressSpace argument must match the CR3 with PCID bits +* stripped out. +*/ flush->address_space =virt_to_phys (info->mm->pgd); + flush->address_space &=CR3_ADDR_MASK ; flush->flags =0 ; }else { flush->address_space =0 ;
@@ -278,8 +288,6 @@ void hyperv_setup_mmu_ops(void)if (!(ms_hyperv.hints &HV_X64_REMOTE_TLB_FLUSH_RECOMMENDED ))return ; -setup_clear_cpu_cap (X86_FEATURE_PCID ); -if (!(ms_hyperv.hints &HV_X64_EX_PROCESSOR_MASKS_RECOMMENDED )) {pr_info ("Using hypercall for remote TLB flush\n" ); pv_mmu_ops.flush_tlb_others = hyperv_flush_tlb_others;
Signature · 5 lines
2.15.1 _______________________________________________ devel mailing list [email protected] http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
PATCH 50/189 PCI: Add dummy pci_irqd_intx_xlate() for CONFIG_PCI=n build
In reply to Sasha LevinFrom: Niklas Cassel <[email protected]>
[ Upstream commit 80db6f08b7af93eddc9487535e6150b220262637 ]
Some hardware can operate in either "host" or "endpoint" mode, which means there can be both a host bridge driver and an endpoint driver for the same device. Those drivers share a lot of code, so sometimes they live in the same source file.
The host bridge driver requires CONFIG_PCI=y because it enumerates PCI devices below the bridge using the PCI core. The endpoint driver does not require CONFIG_PCI=y because it runs in an embedded kernel on the other side of the device, e.g., on an adapter card.
pci-dra7xx.c contains both host and endpoint drivers. If we select only the endpoint driver (CONFIG_PCI=n and CONFIG_PCI_DRA7XX_EP=y), the unneeded host driver is still compiled. It references pci_irqd_intx_xlate(), which is not present when CONFIG_PCI=n, which causes this error:
drivers/pci/dwc/pci-dra7xx.c:229:11: error: 'pci_irqd_intx_xlate' undeclared here (not in a function)
Add a dummy pci_irqd_intx_xlate() for the CONFIG_PCI=n case.
--- include/linux/pci.h | 7 +++++++ 1 file changed, 7 insertions(+)
include/linux/pci.h +7 -0
@@ -1686,6 +1686,13 @@ static inline int pci_get_new_domain_nr(void) { return -ENOSYS; }#define dev_is_pf (d) (false)static inline bool pci_acs_enabled (struct pci_dev *pdev,u16 acs_flags) {return false; } +static inline int pci_irqd_intx_xlate (struct irq_domain *d, +struct device_node *node, +const u32 *intspec, +unsigned int intsize, +unsigned long *out_hwirq, +unsigned int *out_type) +{return -EINVAL ; }#endif /* CONFIG_PCI */ /* Include architecture-dependent settings and functions */
Signature · 1 line
2.15.1
PATCH 92/189 tty: serial: exar: Relocate sleep wake-up handling
In reply to Sasha LevinFrom: Aaron Sierra <[email protected]>
[ Upstream commit c7e1b4059075c9e8eed101d7cc5da43e95eb5e18 ]
Exar sleep wake-up handling has been done on a per-channel basis by virtue of INT0 being accessible from each channel's address space. I believe this was initially done out of necessity, but now that Exar devices have their own driver, we can do things more efficiently by registering a dedicated INT0 handler at the PCI device level.
I see this change providing the following benefits:
1. If more than one port is active, eliminates the redundant bus cycles for reading INT0 on every interrupt.
2. This note associated with hooking in the per-channel handler in 8250_port.c is resolved:
/* Fixme: probably not the best place for this */
--- drivers/tty/serial/8250/8250_exar.c | 34 ++++++++++++++++++++++++++++++---- drivers/tty/serial/8250/8250_port.c | 26 -------------------------- 2 files changed, 30 insertions(+), 30 deletions(-)
drivers/tty/serial/8250/8250_exar.c +30 -4
@@ -34,6 +34,7 @@#define PCI_DEVICE_ID_EXAR_XR17V4358 0x4358#define PCI_DEVICE_ID_EXAR_XR17V8358 0x8358 +#define UART_EXAR_INT0 0x80#define UART_EXAR_8XMODE 0x88/* 8X sampling rate select */ #define UART_EXAR_FCTR 0x08/* Feature Control Register */
@@ -121,6 +122,7 @@ struct exar8250_board {struct exar8250 {unsigned int nr;struct exar8250_board *board; +void __iomem *virt;int line[0 ]; };
@@ -131,12 +133,9 @@ static int default_setup(struct exar8250 *priv, struct pci_dev *pcidev,const struct exar8250_board *board = priv->board;unsigned int bar =0 ; -if (!pcim_iomap_table (pcidev)[bar] && !pcim_iomap (pcidev, bar,0 )) -return -ENOMEM ; - port->port.iotype =UPIO_MEM ; port->port.mapbase =pci_resource_start (pcidev, bar) + offset; - port->port.membase =pcim_iomap_table (pcidev)[bar] + offset; + port->port.membase = priv->virt + offset; port->port.regshift = board->reg_shift;return 0 ;
@@ -420,6 +419,25 @@ static void pci_xr17v35x_exit(struct pci_dev *pcidev) port->port.private_data =NULL ; } +/* +* These Exar UARTs have an extra interrupt indicator that could fire for a +* few interrupts that are not presented/cleared through IIR. One of which is +* a wakeup interrupt when coming out of sleep. These interrupts are only +* cleared by reading global INT0 or INT1 registers as interrupts are +* associated with channel 0. The INT[3:0] registers _are_ accessible from each +* channel's address space, but for the sake of bus efficiency we register a +* dedicated handler at the PCI device level to handle them. +*/ +static irqreturn_t exar_misc_handler (int irq,void *data) +{ +struct exar8250 *priv = data; + +/* Clear all PCI interrupts by reading INT0. No effect on IIR */ +ioread8 (priv->virt +UART_EXAR_INT0 ); + +return IRQ_HANDLED ; +} +static int exar_pci_probe (struct pci_dev *pcidev,const struct pci_device_id *ent) {
@@ -448,6 +466,9 @@ exar_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *ent)return -ENOMEM ; priv->board = board; + priv->virt =pcim_iomap (pcidev, bar,0 ); +if (!priv->virt) +return -ENOMEM ;pci_set_master (pcidev);
@@ -461,6 +482,11 @@ exar_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *ent) uart.port.irq =pci_irq_vector (pcidev,0 ); uart.port.dev = &pcidev->dev; + rc =devm_request_irq (&pcidev->dev, uart.port.irq, exar_misc_handler, +IRQF_SHARED ,"exar_uart" , priv); +if (rc) +return rc; +for (i =0 ; i < nr_ports && i < maxnr; i++) { rc = board->setup (priv, pcidev, &uart, i);if (rc) {
drivers/tty/serial/8250/8250_port.c +0 -26
@@ -441,7 +441,6 @@ static void io_serial_out(struct uart_port *p, int offset, int value) }static int serial8250_default_handle_irq (struct uart_port *port); -static int exar_handle_irq (struct uart_port *port);static void set_io_from_upio (struct uart_port *p) {
@@ -1883,26 +1882,6 @@ static int serial8250_default_handle_irq(struct uart_port *port)return ret; } -/* -* These Exar UARTs have an extra interrupt indicator that could -* fire for a few unimplemented interrupts. One of which is a -* wakeup event when coming out of sleep. Put this here just -* to be on the safe side that these interrupts don't go unhandled. -*/ -static int exar_handle_irq (struct uart_port *port) -{ -unsigned int iir =serial_port_in (port,UART_IIR ); -int ret =0 ; - -if (((port->type ==PORT_XR17V35X ) || (port->type ==PORT_XR17D15X )) && -serial_port_in (port,UART_EXAR_INT0 ) !=0 ) - ret =1 ; - - ret |=serial8250_handle_irq (port, iir); - -return ret; -} -/* * Newer 16550 compatible parts such as the SC16C650 & Altera 16550 Soft IP * have a programmable TX threshold that triggers the THRE interrupt in
@@ -3067,11 +3046,6 @@ static void serial8250_config_port(struct uart_port *port, int flags)if (port->type ==PORT_UNKNOWN )serial8250_release_std_resource (up); -/* Fixme: probably not the best place for this */ -if ((port->type ==PORT_XR17V35X ) || - (port->type ==PORT_XR17D15X )) - port->handle_irq = exar_handle_irq; -register_dev_spec_attr_grp (up); up->fcr = uart_config[up->port.type].fcr; }
Signature · 1 line
2.15.1
PATCH 52/189 ARM: 8738/1: Disable CONFIG_DEBUG_VIRTUAL for NOMMU
In reply to Sasha LevinFrom: Vladimir Murzin <[email protected]>
[ Upstream commit c7780ab56c091a9ba95a3278e6e1d9c73afb5052 ]
While running MPS2 platform (NOMMU) with DTB placed below PHYS_OFFSET following warning poped up:
------------[ cut here ]------------ WARNING: CPU: 0 PID: 0 at arch/arm/mm/physaddr.c:42 __virt_to_phys+0x2f/0x40 virt_to_phys used for non-linear address: 00004000 (0x4000) CPU: 0 PID: 0 Comm: swapper Not tainted 4.15.0-rc1-5a31bf2-clean+ #2767 Hardware name: MPS2 (Device Tree Support) [<2100bf39>] (unwind_backtrace) from [<2100b3ff>] (show_stack+0xb/0xc) [<2100b3ff>] (show_stack) from [<2100e697>] (__warn+0x87/0xac) [<2100e697>] (__warn) from [<2100e6db>] (warn_slowpath_fmt+0x1f/0x28) [<2100e6db>] (warn_slowpath_fmt) from [<2100c603>] (__virt_to_phys+0x2f/0x40) [<2100c603>] (__virt_to_phys) from [<2116a499>] (early_init_fdt_reserve_self+0xd/0x24) [<2116a499>] (early_init_fdt_reserve_self) from [<2116222d>] (arm_memblock_init+0xb5/0xf8) [<2116222d>] (arm_memblock_init) from [<21161cad>] (setup_arch+0x38b/0x50e) [<21161cad>] (setup_arch) from [<21160455>] (start_kernel+0x31/0x280) [<21160455>] (start_kernel) from [<00000000>] ( (null)) random: get_random_bytes called from init_oops_id+0x17/0x2c with crng_init=0 ---[ end trace 0000000000000000 ]---
Platforms without MMU support run with 1:1 (i.e. linear) memory mapping, so disable CONFIG_DEBUG_VIRTUAL.
--- arch/arm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/Kconfig +1 -1
@@ -4,7 +4,7 @@ config ARM default y select ARCH_CLOCKSOURCE_DATA select ARCH_DISCARD_MEMBLOCK if !HAVE_ARCH_PFN_VALID - select ARCH_HAS_DEBUG_VIRTUAL + select ARCH_HAS_DEBUG_VIRTUAL if MMU select ARCH_HAS_DEVMEM_IS_ALLOWED select ARCH_HAS_ELF_RANDOMIZE select ARCH_HAS_SET_MEMORY
Signature · 1 line
2.15.1
PATCH 93/189 device property: Define type of PROPERTY_ENRTY_*() macros
In reply to Sasha LevinFrom: Andy Shevchenko <[email protected]>
[ Upstream commit c505cbd45f6e9c539d57dd171d95ec7e5e9f9cd0 ]
Some of the drivers may use the macro at runtime flow, like
struct property_entry p[10];
...
p[index++] = PROPERTY_ENTRY_U8("u8 property", u8_data);
In that case and absence of the data type compiler fails the build:
drivers/char/ipmi/ipmi_dmi.c:79:29: error: Expected ; at end of statement drivers/char/ipmi/ipmi_dmi.c:79:29: error: got {
--- include/linux/property.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
include/linux/property.h +5 -5
@@ -206,7 +206,7 @@ struct property_entry {*/ #define PROPERTY_ENTRY_INTEGER_ARRAY (_name_, _type_, _val_) \ -{ \ +(struct property_entry) { \ .name = _name_, \ .length = ARRAY_SIZE(_val_) * sizeof(_type_), \ .is_array = true, \
@@ -224,7 +224,7 @@ struct property_entry { PROPERTY_ENTRY_INTEGER_ARRAY(_name_, u64, _val_)#define PROPERTY_ENTRY_STRING_ARRAY (_name_, _val_) \ -{ \ +(struct property_entry) { \ .name = _name_, \ .length = ARRAY_SIZE(_val_) * sizeof(const char *), \ .is_array = true, \
@@ -233,7 +233,7 @@ struct property_entry { }#define PROPERTY_ENTRY_INTEGER (_name_, _type_, _val_) \ -{ \ +(struct property_entry) { \ .name = _name_, \ .length = sizeof(_type_), \ .is_string = false, \
@@ -250,7 +250,7 @@ struct property_entry { PROPERTY_ENTRY_INTEGER(_name_, u64, _val_)#define PROPERTY_ENTRY_STRING (_name_, _val_) \ -{ \ +(struct property_entry) { \ .name = _name_, \ .length = sizeof(_val_), \ .is_string = true, \
@@ -258,7 +258,7 @@ struct property_entry { }#define PROPERTY_ENTRY_BOOL (_name_) \ -{ \ +(struct property_entry) { \ .name = _name_, \ }
Signature · 1 line
2.15.1
PATCH 58/189 powerpc/pseries, ps3: panic flush kernel messages before halting system
In reply to Sasha LevinFrom: Nicholas Piggin <[email protected]>
[ Upstream commit 35adacd6fc48d658419522f192a3c8b2785612da ]
Platforms with a panic handler that halts the system can have problems getting kernel messages out, because the panic notifiers are called before kernel/panic.c does its flushing of printk buffers an console etc.
This was attempted to be solved with commit a3b2cb30f252 ("powerpc: Do not call ppc_md.panic in fadump panic notifier"), but that wasn't the right approach and caused other problems, and was reverted by commit ab9dbf771ff9.
Instead, the powernv shutdown paths have already had a similar problem, fixed by taking the message flushing sequence from kernel/panic.c. That's a little bit ugly, but while we have the code duplicated, it will work for this case as well. So have ppc panic handlers do the same flushing before they terminate.
Without this patch, a qemu pseries_le_defconfig guest stops silently when issued the nmi command when xmon is off and no crash dumpers enabled. Afterwards, an oops is printed by each CPU as expected.
--- arch/powerpc/include/asm/bug.h | 3 ++- arch/powerpc/kernel/traps.c | 24 ++++++++++++++++++++++++ arch/powerpc/platforms/powernv/opal.c | 18 ++++-------------- arch/powerpc/platforms/ps3/setup.c | 1 + arch/powerpc/platforms/pseries/setup.c | 8 +++++++- 5 files changed, 38 insertions(+), 16 deletions(-)
arch/powerpc/include/asm/bug.h +2 -1
@@ -135,7 +135,8 @@ extern void bad_page_fault(struct pt_regs *, unsigned long, int);extern void _exception (int ,struct pt_regs *,int ,unsigned long );extern void die (const char *,struct pt_regs *,long );extern bool die_will_crash (void ); - +extern void panic_flush_kmsg_start (void ); +extern void panic_flush_kmsg_end (void );#endif /* !__ASSEMBLY__ */ #endif /* __KERNEL__ */
arch/powerpc/kernel/traps.c +24 -0
@@ -38,6 +38,8 @@#include <linux/ratelimit.h> #include <linux/context_tracking.h> #include <linux/smp.h> +#include <linux/console.h> +#include <linux/kmsg_dump.h> #include <asm/emulated_ops.h> #include <asm/pgtable.h>
@@ -142,6 +144,28 @@ static int die_owner = -1;static unsigned int die_nest_count;static int die_counter; +extern void panic_flush_kmsg_start (void ) +{ +/* +* These are mostly taken from kernel/panic.c, but tries to do +* relatively minimal work. Don't use delay functions (TB may +* be broken), don't crash dump (need to set a firmware log), +* don't run notifiers. We do want to get some information to +* Linux console. +*/ +console_verbose (); +bust_spinlocks (1 ); +} + +extern void panic_flush_kmsg_end (void ) +{ +printk_safe_flush_on_panic (); +kmsg_dump (KMSG_DUMP_PANIC ); +bust_spinlocks (0 ); +debug_locks_off (); +console_flush_on_panic (); +} +static unsigned long oops_begin (struct pt_regs *regs) {int cpu;
arch/powerpc/platforms/powernv/opal.c +4 -14
@@ -461,24 +461,14 @@ static int opal_recover_mce(struct pt_regs *regs,void pnv_platform_error_reboot (struct pt_regs *regs,const char *msg) { -/* -* This is mostly taken from kernel/panic.c, but tries to do -* relatively minimal work. Don't use delay functions (TB may -* be broken), don't crash dump (need to set a firmware log), -* don't run notifiers. We do want to get some information to -* Linux console. -*/ -console_verbose (); -bust_spinlocks (1 ); +panic_flush_kmsg_start (); +pr_emerg ("Hardware platform error: %s\n" , msg);if (regs)show_regs (regs);smp_send_stop (); -printk_safe_flush_on_panic (); -kmsg_dump (KMSG_DUMP_PANIC ); -bust_spinlocks (0 ); -debug_locks_off (); -console_flush_on_panic (); + +panic_flush_kmsg_end ();/* * Don't bother to shut things down because this will
arch/powerpc/platforms/ps3/setup.c +1 -0
@@ -113,6 +113,7 @@ static void ps3_panic(char *str)printk (" System does not reboot automatically.\n" );printk (" Please press POWER button.\n" );printk ("\n" ); +panic_flush_kmsg_end ();while (1 )lv1_pause (1 );
arch/powerpc/platforms/pseries/setup.c +7 -1
@@ -533,6 +533,12 @@ static void __init pSeries_setup_arch(void) ppc_md.pcibios_root_bridge_prepare = pseries_root_bridge_prepare; } +static void pseries_panic (char *str) +{ +panic_flush_kmsg_end (); +rtas_os_term (str); +} +static int __init pSeries_init_panel (void ) {/* Manually leave the kernel version on the panel. */
@@ -761,7 +767,7 @@ define_machine(pseries) { .pcibios_fixup = pSeries_final_fixup, .restart = rtas_restart, .halt = rtas_halt, - .panic = rtas_os_term, + .panic = pseries_panic, .get_boot_time = rtas_get_boot_time, .get_rtc_time = rtas_get_rtc_time, .set_rtc_time = rtas_set_rtc_time,
Signature · 1 line
2.15.1
PATCH 60/189 ipmi/powernv: Fix error return code in ipmi_powernv_probe()
In reply to Sasha LevinFrom: Wei Yongjun <[email protected]>
[ Upstream commit e749d328b0b450aa78d562fa26a0cd8872325dd9 ]
Fix to return a negative error code from the request_irq() error handling case instead of 0, as done elsewhere in this function.
--- drivers/char/ipmi/ipmi_powernv.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/char/ipmi/ipmi_powernv.c +3 -2
@@ -250,8 +250,9 @@ static int ipmi_powernv_probe(struct platform_device *pdev) ipmi->irq =opal_event_request (prop); } -if (request_irq (ipmi->irq, ipmi_opal_event,IRQ_TYPE_LEVEL_HIGH , -"opal-ipmi" , ipmi)) { + rc =request_irq (ipmi->irq, ipmi_opal_event,IRQ_TYPE_LEVEL_HIGH , +"opal-ipmi" , ipmi); +if (rc) {dev_warn (dev,"Unable to request irq\n" ); goto err_dispose; }
Signature · 1 line
2.15.1
PATCH 96/189 jffs2: Fix use-after-free bug in jffs2_iget()'s error handling path
In reply to Sasha LevinFrom: Jake Daryll Obina <[email protected]>
[ Upstream commit 5bdd0c6f89fba430e18d636493398389dadc3b17 ]
If jffs2_iget() fails for a newly-allocated inode, jffs2_do_clear_inode() can get called twice in the error handling path, the first call in jffs2_iget() itself and the second through iget_failed(). This can result to a use-after-free error in the second jffs2_do_clear_inode() call, such as shown by the oops below wherein the second jffs2_do_clear_inode() call was trying to free node fragments that were already freed in the first jffs2_do_clear_inode() call.
[ 78.178860] jffs2: error: (1904) jffs2_do_read_inode_internal: CRC failed for read_inode of inode 24 at physical location 0x1fc00c [ 78.178914] Unable to handle kernel paging request at virtual address 6b6b6b6b6b6b6b7b [ 78.185871] pgd = ffffffc03a567000 [ 78.188794] [6b6b6b6b6b6b6b7b] *pgd=0000000000000000, *pud=0000000000000000 [ 78.194968] Internal error: Oops: 96000004 [#1] PREEMPT SMP ... [ 78.513147] PC is at rb_first_postorder+0xc/0x28 [ 78.516503] LR is at jffs2_kill_fragtree+0x28/0x90 [jffs2] [ 78.520672] pc : [<ffffff8008323d28>] lr : [<ffffff8000eb1cc8>] pstate: 60000105 [ 78.526757] sp : ffffff800cea38f0 [ 78.528753] x29: ffffff800cea38f0 x28: ffffffc01f3f8e80 [ 78.532754] x27: 0000000000000000 x26: ffffff800cea3c70 [ 78.536756] x25: 00000000dc67c8ae x24: ffffffc033d6945d [ 78.540759] x23: ffffffc036811740 x22: ffffff800891a5b8 [ 78.544760] x21: 0000000000000000 x20: 0000000000000000 [ 78.548762] x19: ffffffc037d48910 x18: ffffff800891a588 [ 78.552764] x17: 0000000000000800 x16: 0000000000000c00 [ 78.556766] x15: 0000000000000010 x14: 6f2065646f6e695f [ 78.560767] x13: 6461657220726f66 x12: 2064656c69616620 [ 78.564769] x11: 435243203a6c616e x10: 7265746e695f6564 [ 78.568771] x9 : 6f6e695f64616572 x8 : ffffffc037974038 [ 78.572774] x7 : bbbbbbbbbbbbbbbb x6 : 0000000000000008 [ 78.576775] x5 : 002f91d85bd44a2f x4 : 0000000000000000 [ 78.580777] x3 : 0000000000000000 x2 : 000000403755e000 [ 78.584779] x1 : 6b6b6b6b6b6b6b6b x0 : 6b6b6b6b6b6b6b6b ... [ 79.038551] [<ffffff8008323d28>] rb_first_postorder+0xc/0x28 [ 79.042962] [<ffffff8000eb5578>] jffs2_do_clear_inode+0x88/0x100 [jffs2] [ 79.048395] [<ffffff8000eb9ddc>] jffs2_evict_inode+0x3c/0x48 [jffs2] [ 79.053443] [<ffffff8008201ca8>] evict+0xb0/0x168 [ 79.056835] [<ffffff8008202650>] iput+0x1c0/0x200 [ 79.060228] [<ffffff800820408c>] iget_failed+0x30/0x3c [ 79.064097] [<ffffff8000eba0c0>] jffs2_iget+0x2d8/0x360 [jffs2] [ 79.068740] [<ffffff8000eb0a60>] jffs2_lookup+0xe8/0x130 [jffs2] [ 79.073434] [<ffffff80081f1a28>] lookup_slow+0x118/0x190 [ 79.077435] [<ffffff80081f4708>] walk_component+0xfc/0x28c [ 79.081610] [<ffffff80081f4dd0>] path_lookupat+0x84/0x108 [ 79.085699] [<ffffff80081f5578>] filename_lookup+0x88/0x100 [ 79.089960] [<ffffff80081f572c>] user_path_at_empty+0x58/0x6c [ 79.094396] [<ffffff80081ebe14>] vfs_statx+0xa4/0x114 [ 79.098138] [<ffffff80081ec44c>] SyS_newfstatat+0x58/0x98 [ 79.102227] [<ffffff800808354c>] __sys_trace_return+0x0/0x4 [ 79.106489] Code: d65f03c0 f9400001 b40000e1 aa0103e0 (f9400821)
The jffs2_do_clear_inode() call in jffs2_iget() is unnecessary since iget_failed() will eventually call jffs2_do_clear_inode() if needed, so just remove it.
--- fs/jffs2/fs.c | 1 - 1 file changed, 1 deletion(-)
fs/jffs2/fs.c +0 -1
@@ -362,7 +362,6 @@ error_io: ret = -EIO ; error:mutex_unlock (&f->sem); -jffs2_do_clear_inode (c, f);iget_failed (inode);return ERR_PTR (ret); }
Signature · 1 line
2.15.1
PATCH 53/189 ARM: 8740/1: NOMMU: Make sure we do not hold stale data in mem[] array
In reply to Sasha LevinFrom: Vladimir Murzin <[email protected]>
[ Upstream commit 636e645f1f2a5826beacd23548696f1655b0b5d8 ]
adjust_lowmem_bounds() called twice which can lead to stalled data (i.e. subreg) value in mem[] array after the first call.
Zero out mem[] array before we allocate MPU regions for memory.
--- arch/arm/mm/pmsa-v7.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/mm/pmsa-v7.c +2 -0
@@ -6,6 +6,7 @@#include <linux/bitops.h> #include <linux/memblock.h> +#include <linux/string.h> #include <asm/cacheflush.h> #include <asm/cp15.h>
@@ -296,6 +297,7 @@ void __init adjust_lowmem_bounds_mpu(void) } } +memset (mem,0 ,sizeof (mem)); num =allocate_region (mem_start, specified_mem_size, mem_max_regions, mem);for (i =0 ; i < num; i++) {
Signature · 1 line
2.15.1
PATCH 101/189 powerpc/numa: Use ibm,max-associativity-domains to discover possible nodes
In reply to Sasha LevinFrom: Michael Bringmann <[email protected]>
[ Upstream commit a346137e9142b039fd13af2e59696e3d40c487ef ]
On powerpc systems which allow 'hot-add' of CPU or memory resources, it may occur that the new resources are to be inserted into nodes that were not used for these resources at bootup. In the kernel, any node that is used must be defined and initialized. These empty nodes may occur when,
* Dedicated vs. shared resources. Shared resources require information such as the VPHN hcall for CPU assignment to nodes. Associativity decisions made based on dedicated resource rules, such as associativity properties in the device tree, may vary from decisions made using the values returned by the VPHN hcall.
* memoryless nodes at boot. Nodes need to be defined as 'possible' at boot for operation with other code modules. Previously, the powerpc code would limit the set of possible nodes to those which have memory assigned at boot, and were thus online. Subsequent add/remove of CPUs or memory would only work with this subset of possible nodes.
* memoryless nodes with CPUs at boot. Due to the previous restriction on nodes, nodes that had CPUs but no memory were being collapsed into other nodes that did have memory at boot. In practice this meant that the node assignment presented by the runtime kernel differed from the affinity and associativity attributes presented by the device tree or VPHN hcalls. Nodes that might be known to the pHyp were not 'possible' in the runtime kernel because they did not have memory at boot.
This patch ensures that sufficient nodes are defined to support configuration requirements after boot, as well as at boot. This patch set fixes a couple of problems.
* Nodes known to powerpc to be memoryless at boot, but to have CPUs in them are allowed to be 'possible' and 'online'. Memory allocations for those nodes are taken from another node that does have memory until and if memory is hot-added to the node. * Nodes which have no resources assigned at boot, but which may still be referenced subsequently by affinity or associativity attributes, are kept in the list of 'possible' nodes for powerpc. Hot-add of memory or CPUs to the system can reference these nodes and bring them online instead of redirecting to one of the set of nodes that were known to have memory at boot.
This patch extracts the value of the lowest domain level (number of allocable resources) from the device tree property "ibm,max-associativity-domains" to use as the maximum number of nodes to setup as possibly available in the system. This new setting will override the instruction:
nodes_and(node_possible_map, node_possible_map, node_online_map);
presently seen in the function arch/powerpc/mm/numa.c:initmem_init().
If the "ibm,max-associativity-domains" property is not present at boot, no operation will be performed to define or enable additional nodes, or enable the above 'nodes_and()'.
--- arch/powerpc/mm/numa.c | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-)
arch/powerpc/mm/numa.c +34 -3
@@ -887,6 +887,34 @@ static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn)NODE_DATA (nid)->node_spanned_pages = spanned_pages; } +static void __init find_possible_nodes (void ) +{ +struct device_node *rtas; +u32 numnodes, i; + +if (min_common_depth <=0 ) +return ; + + rtas =of_find_node_by_path ("/rtas" ); +if (!rtas) +return ; + +if (of_property_read_u32_index (rtas, +"ibm,max-associativity-domains" , + min_common_depth, &numnodes)) + goto out; + +for (i =0 ; i < numnodes; i++) { +if (!node_possible (i)) { +setup_node_data (i,0 ,0 ); +node_set (i, node_possible_map); + } + } + +out: +of_node_put (rtas); +} +void __init initmem_init (void ) {int nid, cpu;
@@ -900,12 +928,15 @@ void __init initmem_init(void)memblock_dump_all ();/* -* Reduce the possible NUMA nodes to the online NUMA nodes, -* since we do not support node hotplug. This ensures that we -* lower the maximum NUMA node ID to what is actually present. +* Modify the set of possible NUMA nodes to reflect information +* available about the set of online nodes, and the set of nodes +* that we expect to make use of for this platform's affinity +* calculations. */ nodes_and (node_possible_map, node_possible_map, node_online_map); +find_possible_nodes (); +for_each_online_node (nid) {unsigned long start_pfn, end_pfn;
Signature · 1 line
2.15.1
PATCH 104/189 NTB: ntb_hw_switchtec: Fix peer BAR bug in switchtec_ntb_init_shared_mw
In reply to Sasha LevinFrom: Doug Meyer <[email protected]>
[ Upstream commit 140eb5227767c6754742020a16d2691222b9c19b ]
This resolves a bug which may incorrectly configure the peer host's LUT for shared memory window access. The code was using the local host's first BAR number, rather than the peer hosts's first BAR number, to determine what peer NT control register to program.
The bug will cause the Switchtec NTB link to work only if both peers have the same first NTB BAR configured. In all other configurations, the link will not come up, failing silently.
When both hosts have the same first BAR, the configuration works only because the first BAR numbers happent to be the same. When the hosts do not have the same first BAR, then the LUT translation will not be configured in the correct peer LUT and will not give the peer the shared memory window access required for the link to operate.
--- drivers/ntb/hw/mscc/ntb_hw_switchtec.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/ntb/hw/mscc/ntb_hw_switchtec.c +5 -4
@@ -964,7 +964,8 @@ static void switchtec_ntb_init_shared(struct switchtec_ntb *sndev)static int switchtec_ntb_init_shared_mw (struct switchtec_ntb *sndev) {struct ntb_ctrl_regs __iomem *ctl = sndev->mmio_peer_ctrl; -int bar = sndev->direct_mw_to_bar[0 ]; +int self_bar = sndev->direct_mw_to_bar[0 ]; +int peer_bar = sndev->peer_direct_mw_to_bar[0 ];u32 ctl_val;int rc;
@@ -985,12 +986,12 @@ static int switchtec_ntb_init_shared_mw(struct switchtec_ntb *sndev)if (rc) goto unalloc_and_exit; - ctl_val =ioread32 (&ctl->bar_entry[bar].ctl); + ctl_val =ioread32 (&ctl->bar_entry[peer_bar].ctl); ctl_val &=0xFF ; ctl_val |=NTB_CTRL_BAR_LUT_WIN_EN ; ctl_val |=ilog2 (LUT_SIZE ) <<8 ; ctl_val |= (sndev->nr_lut_mw -1 ) <<14 ; -iowrite32 (ctl_val, &ctl->bar_entry[bar].ctl); +iowrite32 (ctl_val, &ctl->bar_entry[peer_bar].ctl); iowrite64((NTB_CTRL_LUT_EN | (sndev->self_partition << 1) | sndev->self_shared_dma),
@@ -1009,7 +1010,7 @@ static int switchtec_ntb_init_shared_mw(struct switchtec_ntb *sndev) goto unalloc_and_exit; } - sndev->peer_shared =pci_iomap (sndev->stdev->pdev, bar,LUT_SIZE ); + sndev->peer_shared =pci_iomap (sndev->stdev->pdev, self_bar,LUT_SIZE );if (!sndev->peer_shared) { rc = -ENOMEM ; goto unalloc_and_exit;
Signature · 1 line
2.15.1
PATCH 57/189 powerpc/tm: Fix endianness flip on trap
In reply to Sasha LevinFrom: Gustavo Romero <[email protected]>
[ Upstream commit 1c200e63d055ec0125e44a5e386b9b78aada7eb3 ]
Currently it's possible that a thread on PPC64 LE has its endianness flipped inadvertently to Big-Endian resulting in a crash once the process is back from the signal handler.
If giveup_all() is called when regs->msr has the bits MSR.FP and MSR.VEC disabled (and hence MSR.VSX disabled too) it returns without calling check_if_tm_restore_required() which copies regs->msr to ckpt_regs->msr if the process caught a signal whilst in transactional mode. Then once in setup_tm_sigcontexts() MSR from ckpt_regs.msr is used, but since check_if_tm_restore_required() was not called previuosly, gp_regs[PT_MSR] gets a copy of invalid MSR bits as MSR in ckpt_regs was not updated from regs->msr and so is zeroed. Later when leaving the signal handler once in sys_rt_sigreturn() the TS bits of gp_regs[PT_MSR] are checked to determine if restore_tm_sigcontexts() must be called to pull in the correct MSR state into the user context. Because TS bits are zeroed restore_tm_sigcontexts() is never called and MSR restored from the user context on returning from the signal handler has the MSR.LE (the endianness bit) forced to zero (Big-Endian). That leads, for instance, to 'nop' being treated as an illegal instruction in the following sequence:
tbegin. beq 1f trap tend.
1: nop
on PPC64 LE machines and the process dies just after returning from the signal handler.
PPC64 BE is also affected but in a subtle way since forcing Big-Endian on a BE machine does not change the endianness.
This commit fixes the issue described above by ensuring that once in setup_tm_sigcontexts() the MSR used is from regs->msr instead of from ckpt_regs->msr and by ensuring that we pull in only the MSR.FP, MSR.VEC, and MSR.VSX bits from ckpt_regs->msr.
The fix was tested both on LE and BE machines and no regression regarding the powerpc/tm selftests was observed.
--- arch/powerpc/kernel/signal_64.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
arch/powerpc/kernel/signal_64.c +7 -1
@@ -207,7 +207,7 @@ static long setup_tm_sigcontexts(struct sigcontext __user *sc,elf_vrreg_t __user *tm_v_regs =sigcontext_vmx_regs (tm_sc);#endif struct pt_regs *regs = tsk->thread.regs; -unsigned long msr = tsk->thread.ckpt_regs.msr; +unsigned long msr = tsk->thread.regs->msr;long err =0 ;BUG_ON (tsk != current);
@@ -216,6 +216,12 @@ static long setup_tm_sigcontexts(struct sigcontext __user *sc,WARN_ON (tm_suspend_disabled); +/* Restore checkpointed FP, VEC, and VSX bits from ckpt_regs as +* it contains the correct FP, VEC, VSX state after we treclaimed +* the transaction and giveup_all() was called on reclaiming. +*/ + msr |= tsk->thread.ckpt_regs.msr & (MSR_FP |MSR_VEC |MSR_VSX ); +/* Remove TM bits from thread's MSR. The MSR in the sigcontext * just indicates to userland that we were doing a transaction, but we * don't want to return in transactional state. This also ensures
Signature · 1 line
2.15.1
PATCH 106/189 ntb_hw_switchtec: Check for alignment of the buffer in mw_set_trans()
In reply to Sasha LevinFrom: Logan Gunthorpe <[email protected]>
[ Upstream commit 1e2fd202f8593985cdadca32e0c322f98e7fe7cb ]
With Switchtec hardware, the buffer used for a memory window must be aligned to its size (the hardware only replaces the lower bits). In certain circumstances dma_alloc_coherent() will not provide a buffer that adheres to this requirement like when using the CMA and CONFIG_CMA_ALIGNMENT is set lower than the buffer size.
When we get an unaligned buffer mw_set_trans() should return an error. We also log an error so we know the cause of the problem.
--- drivers/ntb/hw/mscc/ntb_hw_switchtec.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/ntb/hw/mscc/ntb_hw_switchtec.c +13 -0
@@ -315,6 +315,19 @@ static int switchtec_ntb_mw_set_trans(struct ntb_dev *ntb, int pidx, int widx,if (xlate_pos <12 )return -EINVAL ; +if (!IS_ALIGNED (addr,BIT_ULL (xlate_pos))) { +/* +* In certain circumstances we can get a buffer that is +* not aligned to its size. (Most of the time +* dma_alloc_coherent ensures this). This can happen when +* using large buffers allocated by the CMA +* (see CMA_CONFIG_ALIGNMENT) +*/ +dev_err (&sndev->stdev->dev, +"ERROR: Memory window address is not aligned to it's size!\n" ); +return -EINVAL ; + } + rc =switchtec_ntb_part_op (sndev, ctl,NTB_CTRL_PART_OP_LOCK ,NTB_CTRL_PART_STATUS_LOCKED );if (rc)
Signature · 1 line
2.15.1
PATCH 109/189 x86/hyperv: Check for required priviliges in hyperv_init()
In reply to Sasha LevinFrom: Vitaly Kuznetsov <[email protected]>
[ Upstream commit 89a8f6d4904c8cf3ff8fee9fdaff392a6bbb8bf6 ]
In hyperv_init() its presumed that it always has access to VP index and hypercall MSRs while according to the specification it should be checked if it's allowed to access the corresponding MSRs before accessing them.
--- arch/x86/hyperv/hv_init.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
arch/x86/hyperv/hv_init.c +8 -1
@@ -110,12 +110,19 @@ static int hv_cpu_init(unsigned int cpu)*/ void hyperv_init (void ) { -u64 guest_id; +u64 guest_id, required_msrs;union hv_x64_msr_hypercall_contents hypercall_msr;if (x86_hyper_type !=X86_HYPER_MS_HYPERV )return ; +/* Absolutely required MSRs */ + required_msrs =HV_X64_MSR_HYPERCALL_AVAILABLE | +HV_X64_MSR_VP_INDEX_AVAILABLE ; + +if ((ms_hyperv.features & required_msrs) != required_msrs) +return ; +/* Allocate percpu VP index */ hv_vp_index =kmalloc_array (num_possible_cpus (),sizeof (*hv_vp_index),GFP_KERNEL );
Signature · 5 lines
2.15.1 _______________________________________________ devel mailing list [email protected] http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
PATCH 110/189 riscv: disable SUM in the exception handler
In reply to Sasha LevinFrom: Christoph Hellwig <[email protected]>
[ Upstream commit fe9b842f72921fb18b93cf47a255f374289ef242 ]
The SUM bit is enabled at the beginning of the copy_{to,from}_user and {get,put}_user routines, and cleared before they return. But these user copy helper can be interrupted by exceptions, in which case the SUM bit will remain set, which leads to elevated privileges for the code running in exception context, as that can now access userspace address space unconditionally. This frequently happens when the user copy routines access freshly allocated user memory that hasn't been faulted in, and a pagefault needs to be taken before the user copy routines can continue.
Fix this by unconditionally clearing SUM when the exception handler is called - the restore code will automatically restore it based on the saved value.
--- arch/riscv/kernel/entry.S | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
arch/riscv/kernel/entry.S +6 -3
@@ -78,10 +78,13 @@ _save_context: REG_S x31, PT_T6(sp) /* - * Disable FPU to detect illegal usage of - * floating point in kernel space + * Disable user-mode memory access as it should only be set in the + * actual user copy routines. + * + * Disable the FPU to detect illegal usage of floating point in kernel + * space. */ - li t0, SR_FS + li t0, SR_SUM | SR_FS REG_L s0, TASK_TI_USER_SP(tp) csrrc s1, sstatus, t0
Signature · 1 line
2.15.1
PATCH 113/189 kvm: Map PFN-type memory regions as writable (if possible)
In reply to Sasha LevinFrom: KarimAllah Ahmed <[email protected]>
[ Upstream commit a340b3e229b24a56f1c7f5826b15a3af0f4b13e5 ]
For EPT-violations that are triggered by a read, the pages are also mapped with write permissions (if their memory region is also writable). That would avoid getting yet another fault on the same page when a write occurs.
This optimization only happens when you have a "struct page" backing the memory region. So also enable it for memory regions that do not have a "struct page".
--- virt/kvm/kvm_main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
virt/kvm/kvm_main.c +5 -2
@@ -1433,7 +1433,8 @@ static bool vma_is_valid(struct vm_area_struct *vma, bool write_fault)static int hva_to_pfn_remapped (struct vm_area_struct *vma,unsigned long addr,bool *async, -bool write_fault,kvm_pfn_t *p_pfn) +bool write_fault,bool *writable, +kvm_pfn_t *p_pfn) {unsigned long pfn;int r;
@@ -1459,6 +1460,8 @@ static int hva_to_pfn_remapped(struct vm_area_struct *vma, } +if (writable) + *writable = true;/* * Get a reference here because callers of *hva_to_pfn* and
@@ -1524,7 +1527,7 @@ retry:if (vma ==NULL ) pfn =KVM_PFN_ERR_FAULT ;else if (vma->vm_flags & (VM_IO |VM_PFNMAP )) { - r =hva_to_pfn_remapped (vma, addr, async, write_fault, &pfn); + r =hva_to_pfn_remapped (vma, addr, async, write_fault, writable, &pfn);if (r == -EAGAIN ) goto retry;if (r <0 )
Signature · 1 line
2.15.1
PATCH 115/189 fs/dax.c: release PMD lock even when there is no PMD support in DAX
In reply to Sasha LevinFrom: Jan H. Schönherr <[email protected]>
[ Upstream commit ee190ca6516bc8257e3d36187ca6f0f71a9ec477 ]
follow_pte_pmd() can theoretically return after having acquired a PMD lock, even when DAX was not compiled with CONFIG_FS_DAX_PMD.
Release the PMD lock unconditionally.
--- fs/dax.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/dax.c +1 -1
@@ -636,8 +636,8 @@ static void dax_mapping_entry_mkclean(struct address_space *mapping, pmd =pmd_mkclean (pmd);set_pmd_at (vma->vm_mm, address, pmdp, pmd); unlock_pmd: -spin_unlock (ptl);#endif +spin_unlock (ptl); }else {if (pfn !=pte_pfn (*ptep)) goto unlock_pte;
Signature · 1 line
2.15.1
PATCH 116/189 ocfs2: return -EROFS to mount.ocfs2 if inode block is invalid
In reply to Sasha LevinFrom: piaojun <[email protected]>
[ Upstream commit 025bcbde3634b2c9b316f227fed13ad6ad6817fb ]
If metadata is corrupted such as 'invalid inode block', we will get failed by calling 'mount()' and then set filesystem readonly as below:
ocfs2_mount
ocfs2_initialize_super
ocfs2_init_global_system_inodes
ocfs2_iget
ocfs2_read_locked_inode
ocfs2_validate_inode_block
ocfs2_error
ocfs2_handle_error
ocfs2_set_ro_flag(osb, 0); // set readonlyIn this situation we need return -EROFS to 'mount.ocfs2', so that user can fix it by fsck. And then mount again. In addition, 'mount.ocfs2' should be updated correspondingly as it only return 1 for all errno. And I will post a patch for 'mount.ocfs2' too.
--- fs/ocfs2/super.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
fs/ocfs2/super.c +2 -3
@@ -474,9 +474,8 @@ static int ocfs2_init_global_system_inodes(struct ocfs2_super *osb) new =ocfs2_get_system_file_inode (osb, i, osb->slot_num);if (!new) {ocfs2_release_system_inodes (osb); - status = -EINVAL ; + status =ocfs2_is_soft_readonly (osb) ? -EROFS : -EINVAL ;mlog_errno (status); -/* FIXME: Should ERROR_RO_FS */ mlog (ML_ERROR ,"Unable to load system inode %d, " "possibly corrupt fs?" , i); goto bail;
@@ -505,7 +504,7 @@ static int ocfs2_init_local_system_inodes(struct ocfs2_super *osb) new =ocfs2_get_system_file_inode (osb, i, osb->slot_num);if (!new) {ocfs2_release_system_inodes (osb); - status = -EINVAL ; + status =ocfs2_is_soft_readonly (osb) ? -EROFS : -EINVAL ;mlog (ML_ERROR ,"status=%d, sysfile=%d, slot=%d\n" , status, i, osb->slot_num); goto bail;
Signature · 1 line
2.15.1
PATCH 122/189 sparc64: update pmdp_invalidate() to return old pmd value
In reply to Sasha LevinFrom: Nitin Gupta <[email protected]>
[ Upstream commit a8e654f01cb725d0bfd741ebca1bf4c9337969cc ]
It's required to avoid losing dirty and accessed bits.
--- arch/sparc/include/asm/pgtable_64.h | 2 +- arch/sparc/mm/tlb.c | 23 ++++++++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-)
arch/sparc/include/asm/pgtable_64.h +1 -1
@@ -1010,7 +1010,7 @@ void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long addr, pmd_t *pmd);#define __HAVE_ARCH_PMDP_INVALIDATE -extern void pmdp_invalidate (struct vm_area_struct *vma,unsigned long address, +extern pmd_t pmdp_invalidate (struct vm_area_struct *vma,unsigned long address,pmd_t *pmdp);#define __HAVE_ARCH_PGTABLE_DEPOSIT
arch/sparc/mm/tlb.c +18 -5
@@ -219,17 +219,28 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr, } } +static inline pmd_t pmdp_establish (struct vm_area_struct *vma, +unsigned long address,pmd_t *pmdp,pmd_t pmd) +{ +pmd_t old; + +do { + old = *pmdp; + }while (cmpxchg64 (&pmdp->pmd, old.pmd, pmd.pmd) != old.pmd); + +return old; +} +/* * This routine is only called when splitting a THP */ -void pmdp_invalidate (struct vm_area_struct *vma,unsigned long address, +pmd_t pmdp_invalidate (struct vm_area_struct *vma,unsigned long address,pmd_t *pmdp) { -pmd_t entry = *pmdp; - -pmd_val (entry) &= ~_PAGE_VALID; +pmd_t old, entry; -set_pmd_at (vma->vm_mm, address, pmdp, entry); + entry =__pmd (pmd_val (*pmdp) & ~_PAGE_VALID); + old =pmdp_establish (vma, address, pmdp, entry);flush_tlb_range (vma, address, address +HPAGE_PMD_SIZE );/*
@@ -240,6 +251,8 @@ void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,if ((pmd_val (entry) & _PAGE_PMD_HUGE) && !is_huge_zero_page (pmd_page (entry))) (vma->vm_mm)->context.thp_pte_count--; + +return old; } void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,
Signature · 1 line
2.15.1
PATCH 126/189 openvswitch: Remove padding from packet before L3+ conntrack processing
In reply to Sasha LevinFrom: Ed Swierk <[email protected]>
[ Upstream commit 9382fe71c0058465e942a633869629929102843d ]
IPv4 and IPv6 packets may arrive with lower-layer padding that is not included in the L3 length. For example, a short IPv4 packet may have up to 6 bytes of padding following the IP payload when received on an Ethernet device with a minimum packet length of 64 bytes.
Higher-layer processing functions in netfilter (e.g. nf_ip_checksum(), and help() in nf_conntrack_ftp) assume skb->len reflects the length of the L3 header and payload, rather than referring back to ip_hdr->tot_len or ipv6_hdr->payload_len, and get confused by lower-layer padding.
In the normal IPv4 receive path, ip_rcv() trims the packet to ip_hdr->tot_len before invoking netfilter hooks. In the IPv6 receive path, ip6_rcv() does the same using ipv6_hdr->payload_len. Similarly in the br_netfilter receive path, br_validate_ipv4() and br_validate_ipv6() trim the packet to the L3 length before invoking netfilter hooks.
Currently in the OVS conntrack receive path, ovs_ct_execute() pulls the skb to the L3 header but does not trim it to the L3 length before calling nf_conntrack_in(NF_INET_PRE_ROUTING). When nf_conntrack_proto_tcp encounters a packet with lower-layer padding, nf_ip_checksum() fails causing a "nf_ct_tcp: bad TCP checksum" log message. While extra zero bytes don't affect the checksum, the length in the IP pseudoheader does. That length is based on skb->len, and without trimming, it doesn't match the length the sender used when computing the checksum.
In ovs_ct_execute(), trim the skb to the L3 length before higher-layer processing.
--- net/openvswitch/conntrack.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
net/openvswitch/conntrack.c +34 -0
@@ -1098,6 +1098,36 @@ static int ovs_ct_commit(struct net *net, struct sw_flow_key *key,return 0 ; } +/* Trim the skb to the length specified by the IP/IPv6 header, +* removing any trailing lower-layer padding. This prepares the skb +* for higher-layer processing that assumes skb->len excludes padding +* (such as nf_ip_checksum). The caller needs to pull the skb to the +* network header, and ensure ip_hdr/ipv6_hdr points to valid data. +*/ +static int ovs_skb_network_trim (struct sk_buff *skb) +{ +unsigned int len; +int err; + +switch (skb->protocol) { +case htons (ETH_P_IP ): + len =ntohs (ip_hdr (skb)->tot_len); +break ; +case htons (ETH_P_IPV6 ): + len =sizeof (struct ipv6hdr ) + +ntohs (ipv6_hdr (skb)->payload_len); +break ; +default : + len = skb->len; + } + + err =pskb_trim_rcsum (skb, len); +if (err) +kfree_skb (skb); + +return err; +} +/* Returns 0 on success, -EINPROGRESS if 'skb' is stolen, or other nonzero * value if 'skb' is freed. */
@@ -1112,6 +1142,10 @@ int ovs_ct_execute(struct net *net, struct sk_buff *skb, nh_ofs =skb_network_offset (skb);skb_pull_rcsum (skb, nh_ofs); + err =ovs_skb_network_trim (skb); +if (err) +return err; +if (key->ip.frag !=OVS_FRAG_TYPE_NONE ) { err =handle_fragments (net, key, info->zone.id, skb);if (err)
Signature · 1 line
2.15.1
PATCH 129/189 IB/hfi1: Re-order IRQ cleanup to address driver cleanup race
In reply to Sasha LevinFrom: "Michael J. Ruhl" <[email protected]>
[ Upstream commit 82a979265638c505e12fbe7ba40980dc0901436d ]
The pci_request_irq() interfaces always adds the IRQF_SHARED bit to all IRQ requests.
When the kernel is built with CONFIG_DEBUG_SHIRQ config flag, if the IRQF_SHARED bit is set, a call to the IRQ handler is made from the __free_irq() function. This is testing a race condition between the IRQ cleanup and an IRQ racing the cleanup. The HFI driver should be able to handle this race, but does not.
This race can cause traces that start with this footprint:
BUG: unable to handle kernel NULL pointer dereference at (null) Call Trace: <hfi1 irq handler> ... __free_irq+0x1b3/0x2d0 free_irq+0x35/0x70 pci_free_irq+0x1c/0x30 clean_up_interrupts+0x53/0xf0 [hfi1] hfi1_start_cleanup+0x122/0x190 [hfi1] postinit_cleanup+0x1d/0x280 [hfi1] remove_one+0x233/0x250 [hfi1] pci_device_remove+0x39/0xc0
Export IRQ cleanup function so it can be called from other modules.
Using the exported cleanup function:
Re-order the driver cleanup code to clean up IRQ resources before other resources, eliminating the race.
Re-order error path for init so that the race does not occur.
Reduce severity on spurious error message for SDMA IRQs to info.
--- drivers/infiniband/hw/hfi1/chip.c | 18 ++++++++++++------ drivers/infiniband/hw/hfi1/hfi.h | 1 + drivers/infiniband/hw/hfi1/init.c | 4 +++- 3 files changed, 16 insertions(+), 7 deletions(-)
drivers/infiniband/hw/hfi1/chip.c +12 -6
@@ -8263,8 +8263,8 @@ static irqreturn_t sdma_interrupt(int irq, void *data)/* handle the interrupt(s) */ sdma_engine_interrupt (sde, status); }else { -dd_dev_err_ratelimited (dd,"SDMA engine %u interrupt, but no status bits set\n" , - sde->this_idx); +dd_dev_info_ratelimited (dd,"SDMA engine %u interrupt, but no status bits set\n" , + sde->this_idx); }return IRQ_HANDLED ; }
@@ -12984,7 +12984,14 @@ static void disable_intx(struct pci_dev *pdev)pci_intx (pdev,0 ); } -static void clean_up_interrupts (struct hfi1_devdata *dd) +/** +* hfi1_clean_up_interrupts() - Free all IRQ resources +* @dd: valid device data data structure +* +* Free the MSI or INTx IRQs and assoicated PCI resources, +* if they have been allocated. +*/ +void hfi1_clean_up_interrupts (struct hfi1_devdata *dd) {int i;
@@ -13345,7 +13352,7 @@ static int set_up_interrupts(struct hfi1_devdata *dd)return 0 ; fail: -clean_up_interrupts (dd); +hfi1_clean_up_interrupts (dd);return ret; }
@@ -14772,7 +14779,6 @@ void hfi1_start_cleanup(struct hfi1_devdata *dd)aspm_exit (dd);free_cntrs (dd);free_rcverr (dd); -clean_up_interrupts (dd);finish_chip_resources (dd); }
@@ -15229,7 +15235,7 @@ bail_free_rcverr: bail_free_cntrs:free_cntrs (dd); bail_clear_intr: -clean_up_interrupts (dd); +hfi1_clean_up_interrupts (dd); bail_cleanup:hfi1_pcie_ddcleanup (dd); bail_free:
drivers/infiniband/hw/hfi1/hfi.h +1 -0
@@ -1957,6 +1957,7 @@ void hfi1_verbs_unregister_sysfs(struct hfi1_devdata *dd);int qsfp_dump (struct hfi1_pportdata *ppd,char *buf,int len);int hfi1_pcie_init (struct pci_dev *pdev,const struct pci_device_id *ent); +void hfi1_clean_up_interrupts (struct hfi1_devdata *dd);void hfi1_pcie_cleanup (struct pci_dev *pdev);int hfi1_pcie_ddinit (struct hfi1_devdata *dd,struct pci_dev *pdev);void hfi1_pcie_ddcleanup (struct hfi1_devdata *);
drivers/infiniband/hw/hfi1/init.c +3 -1
@@ -1058,8 +1058,9 @@ static void shutdown_device(struct hfi1_devdata *dd) } dd->flags &= ~HFI1_INITTED ; -/* mask interrupts, but not errors */ +/* mask and clean up interrupts, but not errors */ set_intr_state (dd,0 ); +hfi1_clean_up_interrupts (dd);for (pidx =0 ; pidx < dd->num_pports; ++pidx) { ppd = dd->pport + pidx;
@@ -1702,6 +1703,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)dd_dev_err (dd,"Failed to create /dev devices: %d\n" , -j);if (initfail || ret) { +hfi1_clean_up_interrupts (dd);stop_timers (dd);flush_workqueue (ib_wq);for (pidx =0 ; pidx < dd->num_pports; ++pidx) {
Signature · 1 line
2.15.1
PATCH 130/189 IB/hfi1: Fix for early release of sdma context
In reply to Sasha LevinFrom: Alex Estrin <[email protected]>
[ Upstream commit 473291b3ea0e1df81f7abf13b8ab4b98a346df5e ]
With IRQF_SHARED flag set and CONFIG_DEBUG_SHIRQ enabled module removal may result in panic in sdma_interrupt() routine if associated sdma context was released before pci_free_irq();
[ 9198.939885] BUG: unable to handle kernel NULL pointer dereference at (null) [ 9198.940514] IP: sdma_make_progress+0xa5/0x450 [hfi1] [ 9198.941114] PGD 170bdc0067 P4D 170bdc0067 PUD 172063e067 PMD 0 [ 9198.941783] Oops: 0000 [#1] SMP ..... [ 9198.958877] CPU: 132 PID: 64173 Comm: rmmod Tainted: G OE 4.14.0-rc4+ #1 [ 9198.961032] Hardware name: Intel Corporation S7200AP/S7200AP, BIOS S72C610.86B.01.02.0118.080620171935 08/06/2017 [ 9198.963323] task: ffff9681397f0000 task.stack: ffffae1647c40000 [ 9198.965695] RIP: 0010:sdma_make_progress+0xa5/0x450 [hfi1] [ 9198.968082] RSP: 0018:ffffae1647c43be8 EFLAGS: 00010046 [ 9198.970503] RAX: 0000000000000000 RBX: ffff9680ce8b5ca8 RCX: 0000000000000000 [ 9198.973006] RDX: 0000000000000000 RSI: 0000000001a00d28 RDI: ffff9680ce8b5ca0 [ 9198.975546] RBP: ffffae1647c43c40 R08: ffff96814325ec00 R09: 00000000ffffffff [ 9198.978142] R10: 000000004325e501 R11: ffff96814325ec00 R12: ffff9680ce8b5c44 [ 9198.980779] R13: ffff9680ce8b5ca0 R14: 0000000000000000 R15: ffff9680ce8b5b00 [ 9198.983462] FS: 00007f31196ba740(0000) GS:ffff96819df00000(0000) knlGS:0000000000000000 [ 9198.986231] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 9198.989036] CR2: 0000000000000000 CR3: 000000170833f000 CR4: 00000000001406e0 [ 9198.991911] Call Trace: [ 9198.994847] sdma_engine_interrupt+0x82/0x100 [hfi1] [ 9198.997852] sdma_interrupt+0x61/0xc0 [hfi1] [ 9199.000852] __free_irq+0x1b3/0x2d0 [ 9199.003873] free_irq+0x35/0x70 [ 9199.006909] pci_free_irq+0x1c/0x30 [ 9199.009999] clean_up_interrupts+0x53/0xf0 [hfi1] [ 9199.013137] hfi1_start_cleanup+0x117/0x190 [hfi1] [ 9199.016315] postinit_cleanup+0x1d/0x270 [hfi1] [ 9199.019529] remove_one+0x1f3/0x210 [hfi1] [ 9199.022738] pci_device_remove+0x39/0xc0 [ 9199.025974] device_release_driver_internal+0x141/0x210 [ 9199.029268] driver_detach+0x3f/0x80 [ 9199.032580] bus_remove_driver+0x55/0xd0 [ 9199.035931] driver_unregister+0x2c/0x50 [ 9199.039321] pci_unregister_driver+0x2a/0xa0 [ 9199.042755] hfi1_mod_cleanup+0x10/0xb50 [hfi1] [ 9199.046196] SyS_delete_module+0x171/0x250
...
Fix by exporting sdma_clean() and removing from sdma_exit(). sdma_exit() now just manipulates the engine state, leaving the memory free to sdma_clean() which is now called just before the dd is freed.
--- drivers/infiniband/hw/hfi1/init.c | 1 + drivers/infiniband/hw/hfi1/sdma.c | 13 +++++++------ drivers/infiniband/hw/hfi1/sdma.h | 1 + 3 files changed, 9 insertions(+), 6 deletions(-)
drivers/infiniband/hw/hfi1/init.c +1 -0
@@ -1219,6 +1219,7 @@ static void __hfi1_free_devdata(struct kobject *kobj)free_percpu (dd->rcv_limit);free_percpu (dd->send_schedule);free_percpu (dd->tx_opstats); +sdma_clean (dd, dd->num_sdma);rvt_dealloc_device (&dd->verbs_dev.rdi); }
drivers/infiniband/hw/hfi1/sdma.c +7 -6
@@ -1276,13 +1276,15 @@ bail:return -ENOMEM ; } -/* -* Clean up allocated memory. -* -* This routine is can be called regardless of the success of sdma_init() +/** +* sdma_clean() Clean up allocated memory +* @dd: struct hfi1_devdata +* @num_engines: num sdma engines * +* This routine can be called regardless of the success of +* sdma_init() */ -static void sdma_clean (struct hfi1_devdata *dd,size_t num_engines) +void sdma_clean (struct hfi1_devdata *dd,size_t num_engines) {size_t i;struct sdma_engine *sde;
@@ -1618,7 +1620,6 @@ void sdma_exit(struct hfi1_devdata *dd)*/ sdma_finalput (&sde->state); } -sdma_clean (dd, dd->num_sdma); }/*
drivers/infiniband/hw/hfi1/sdma.h +1 -0
@@ -420,6 +420,7 @@ struct sdma_engine {int sdma_init (struct hfi1_devdata *dd,u8 port);void sdma_start (struct hfi1_devdata *dd);void sdma_exit (struct hfi1_devdata *dd); +void sdma_clean (struct hfi1_devdata *dd,size_t num_engines);void sdma_all_running (struct hfi1_devdata *dd);void sdma_all_idle (struct hfi1_devdata *dd);void sdma_freeze_notify (struct hfi1_devdata *dd,int go_idle);
Signature · 1 line
2.15.1
PATCH 64/189 btrfs: fail mount when sb flag is not in BTRFS_SUPER_FLAG_SUPP
In reply to Sasha LevinFrom: Anand Jain <[email protected]>
[ Upstream commit 6f794e3c5c8f8fdd3b5bb20d9ded894e685b5bbe ]
It appears from the original commit [1] that there isn't any design specific reason not to fail the mount instead of just warning. This patch will change it to fail.
[1]
commit 319e4d0661e5323c9f9945f0f8fb5905e5fe74c3
btrfs: Enhance super validation check
--- fs/btrfs/disk-io.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/btrfs/disk-io.c +4 -2
@@ -3910,9 +3910,11 @@ static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info)btrfs_err (fs_info,"no valid FS found" ); ret = -EINVAL ; } -if (btrfs_super_flags (sb) & ~BTRFS_SUPER_FLAG_SUPP ) -btrfs_warn (fs_info,"unrecognized super flag: %llu" , +if (btrfs_super_flags (sb) & ~BTRFS_SUPER_FLAG_SUPP ) { +btrfs_err (fs_info,"unrecognized or unsupported super flag: %llu" ,btrfs_super_flags (sb) & ~BTRFS_SUPER_FLAG_SUPP ); + ret = -EINVAL ; + }if (btrfs_super_root_level (sb) >=BTRFS_MAX_LEVEL ) {btrfs_err (fs_info,"tree_root level too big: %d >= %d" ,btrfs_super_root_level (sb),BTRFS_MAX_LEVEL );
Signature · 1 line
2.15.1
PATCH 65/189 Btrfs: fix unexpected EEXIST from btrfs_get_extent
In reply to Sasha LevinFrom: Liu Bo <[email protected]>
[ Upstream commit 18e83ac75bfe67009c4ddcdd581bba8eb16f4030 ]
This fixes a corner case that is caused by a race of dio write vs dio read/write.
Here is how the race could happen.
Suppose that no extent map has been loaded into memory yet. There is a file extent [0, 32K), two jobs are running concurrently against it, t1 is doing dio write to [8K, 32K) and t2 is doing dio read from [0, 4K) or [4K, 8K).
t1 goes ahead of t2 and splits em [0, 32K) to em [0K, 8K) and [8K 32K).
------------------------------------------------------
t1 t2
btrfs_get_blocks_direct() btrfs_get_blocks_direct()
-> btrfs_get_extent() -> btrfs_get_extent()
-> lookup_extent_mapping()
-> add_extent_mapping() -> lookup_extent_mapping()
# load [0, 32K)
-> btrfs_new_extent_direct()
-> btrfs_drop_extent_cache()
# split [0, 32K) and
# drop [8K, 32K)
-> add_extent_mapping()
# add [8K, 32K)
-> add_extent_mapping()
# handle -EEXIST when adding
# [0, 32K)------------------------------------------------------
About how t2(dio read/write) runs into -EEXIST:
a) add_extent_mapping() gets -EEXIST for adding em [0, 32k),
b) search_extent_mapping() then returns [0, 8k) as the existing em, even though start == existing->start, em is [0, 32k) so that extent_map_end(em) > extent_map_end(existing), i.e. 32k > 8k,
c) then it goes thru merge_extent_mapping() which tries to add a [8k, 8k) (with a length 0) and returns -EEXIST as [8k, 32k) is already in tree,
d) so btrfs_get_extent() ends up returning -EEXIST to dio read/write, which is confusing applications.
Here I conclude all the possible situations,
1) start < existing->start
+-----------+em+-----------+
+--prev---+ | +-------------+ |
| | | | | |
+---------+ + +---+existing++ ++
+
|
+
start2) start == existing->start
+------------em------------+
| +-------------+ |
| | | |
+ +----existing-+ +
|
|
+
start3) start > existing->start && start < (existing->start + existing->len)
+------------em------------+
| +-------------+ |
| | | |
+ +----existing-+ +
|
|
+
start4) start >= (existing->start + existing->len)
+-----------+em+-----------+
| +-------------+ | +--next---+
| | | | | |
+ +---+existing++ + +---------+
+
|
+
startAs we can see, it turns out that if start is within existing em (front inclusive), then the existing em should be returned as is, otherwise, we try our best to merge candidate em with sibling ems to form a larger em (in order to reduce the total number of em).
--- fs/btrfs/inode.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-)
fs/btrfs/inode.c +3 -14
@@ -7180,19 +7180,12 @@ insert:* existing will always be non-NULL, since there must be * extent causing the -EEXIST. */ -if (existing->start == em->start && -extent_map_end (existing) >=extent_map_end (em) && - em->block_start == existing->block_start) { -/* -* The existing extent map already encompasses the -* entire extent map we tried to add. -*/ +if (start >= existing->start && + start <extent_map_end (existing)) {free_extent_map (em); em = existing; err =0 ; - - }else if (start >=extent_map_end (existing) || - start <= existing->start) { + }else {/* * The existing extent map is the one nearest to * the [start, start + len) range which overlaps
@@ -7204,10 +7197,6 @@ insert:free_extent_map (em); em =NULL ; } - }else { -free_extent_map (em); - em = existing; - err =0 ; } }write_unlock (&em_tree->lock);
Signature · 1 line
2.15.1
PATCH 66/189 Btrfs: raid56: fix race between merge_bio and rbio_orig_end_io
In reply to Sasha LevinFrom: Liu Bo <[email protected]>
[ Upstream commit 7583d8d088ff2c323b1d4f15b191ca2c23d32558 ]
Before rbio_orig_end_io() goes to free rbio, rbio may get merged with more bios from other rbios and rbio->bio_list becomes non-empty, in that case, these newly merged bios don't end properly.
Once unlock_stripe() is done, rbio->bio_list will not be updated any more and we can call bio_endio() on all queued bios.
It should only happen in error-out cases, the normal path of recover and full stripe write have already set RBIO_RMW_LOCKED_BIT to disable merge before doing IO, so rbio_orig_end_io() called by them doesn't have the above issue.
--- fs/btrfs/raid56.c | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-)
fs/btrfs/raid56.c +25 -12
@@ -858,10 +858,17 @@ static void __free_raid_bio(struct btrfs_raid_bio *rbio)kfree (rbio); } -static void free_raid_bio (struct btrfs_raid_bio *rbio) +static void rbio_endio_bio_list (struct bio *cur,blk_status_t err) { -unlock_stripe (rbio); -__free_raid_bio (rbio); +struct bio *next; + +while (cur) { + next = cur->bi_next; + cur->bi_next =NULL ; + cur->bi_status = err; +bio_endio (cur); + cur = next; + } }/*
@@ -871,20 +878,26 @@ static void free_raid_bio(struct btrfs_raid_bio *rbio)static void rbio_orig_end_io (struct btrfs_raid_bio *rbio,blk_status_t err) {struct bio *cur =bio_list_get (&rbio->bio_list); -struct bio *next; +struct bio *extra;if (rbio->generic_bio_cnt)btrfs_bio_counter_sub (rbio->fs_info, rbio->generic_bio_cnt); -free_raid_bio (rbio); +/* +* At this moment, rbio->bio_list is empty, however since rbio does not +* always have RBIO_RMW_LOCKED_BIT set and rbio is still linked on the +* hash list, rbio may be merged with others so that rbio->bio_list +* becomes non-empty. +* Once unlock_stripe() is done, rbio->bio_list will not be updated any +* more and we can call bio_endio() on all queued bios. +*/ +unlock_stripe (rbio); + extra =bio_list_get (&rbio->bio_list); +__free_raid_bio (rbio); -while (cur) { - next = cur->bi_next; - cur->bi_next =NULL ; - cur->bi_status = err; -bio_endio (cur); - cur = next; - } +rbio_endio_bio_list (cur, err); +if (extra) +rbio_endio_bio_list (extra, err); }/*
Signature · 1 line
2.15.1
PATCH 67/189 RDMA/cma: Check existence of netdevice during port validation
In reply to Sasha LevinFrom: Parav Pandit <[email protected]>
[ Upstream commit 00db63c128dd3daf38f481371976c24d32678142 ]
If valid netdevice is not found for RoCE, GID table should not be searched with NULL netdevice.
Doing so causes the search routines to ignore the netdev argument and may match the wrong GID table entry if the netdev is deleted.
--- drivers/infiniband/core/cma.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/infiniband/core/cma.c +5 -3
@@ -624,11 +624,13 @@ static inline int cma_validate_port(struct ib_device *device, u8 port,if ((dev_type !=ARPHRD_INFINIBAND ) &&rdma_protocol_ib (device, port))return ret; -if (dev_type ==ARPHRD_ETHER &&rdma_protocol_roce (device, port)) +if (dev_type ==ARPHRD_ETHER &&rdma_protocol_roce (device, port)) { ndev =dev_get_by_index (&init_net, bound_if_index); -else +if (!ndev) +return ret; + }else { gid_type =IB_GID_TYPE_IB ; - + } ret =ib_find_cached_gid_by_port (device, gid, gid_type, port, ndev,NULL );
Signature · 1 line
2.15.1
PATCH 71/189 scsi: fas216: fix sense buffer initialization
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 96d5eaa9bb74d299508d811d865c2c41b38b0301 ]
While testing with the ARM specific memset() macro removed, I ran into a compiler warning that shows an old bug:
drivers/scsi/arm/fas216.c: In function 'fas216_rq_sns_done':drivers/scsi/arm/fas216.c:2014:40: error: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to provide an explicit length? [-Werror=sizeof-pointer-memaccess]
It turns out that the definition of the scsi_cmd structure changed back in linux-2.6.25, so now we clear only four bytes (sizeof(pointer)) instead of 96 (SCSI_SENSE_BUFFERSIZE). I did not check whether we actually need to initialize the buffer here, but it's clear that if we do it, we should use the correct size.
--- drivers/scsi/arm/fas216.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/arm/fas216.c +1 -1
@@ -2011,7 +2011,7 @@ static void fas216_rq_sns_done(FAS216_Info *info, struct scsi_cmnd *SCpnt,* have valid data in the sense buffer that could * confuse the higher levels. */ -memset (SCpnt->sense_buffer,0 ,sizeof (SCpnt->sense_buffer)); +memset (SCpnt->sense_buffer,0 ,SCSI_SENSE_BUFFERSIZE );//printk("scsi%d.%c: sense buffer: ", info->host->host_no, '0' + SCpnt->device->id); //{ int i; for (i = 0; i < 32; i++) printk("%02x ", SCpnt->sense_buffer[i]); printk("\n"); } /*
Signature · 1 line
2.15.1
PATCH 136/189 s390/eadm: fix CONFIG_BLOCK include dependency
In reply to Sasha LevinFrom: Sebastian Ott <[email protected]>
[ Upstream commit 366b77ae43c5a3bf1a367f15ec8bc16e05035f14 ]
Commit 2a842acab109 ("block: introduce new block status code type") added blk_status_t usage to the eadm subchannel driver. However blk_status_t is unknown when included via <linux/blkdev.h> for CONFIG_BLOCK=n.
Only include <linux/blk_types.h> since this is the only dependency eadm has.
This fixes build failures like below:
In file included from drivers/s390/cio/eadm_sch.c:24:0:./arch/s390/include/asm/eadm.h:111:4: error: unknown type name 'blk_status_t'; did you mean 'si_status'?
blk_status_t error);
--- arch/s390/include/asm/eadm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/include/asm/eadm.h +1 -1
@@ -4,7 +4,7 @@#include <linux/types.h> #include <linux/device.h> -#include <linux/blkdev.h> +#include <linux/blk_types.h> struct arqb {u64 data;
Signature · 1 line
2.15.1
PATCH 72/189 Input: stmfts - set IRQ_NOAUTOEN to the irq flag
In reply to Sasha LevinFrom: Andi Shyti <[email protected]>
[ Upstream commit cba04cdf437d745fac85220d1d692a9ae23d7004 ]
The interrupt is requested before the device is powered on and it's value in some cases cannot be reliable. It happens on some devices that an interrupt is generated as soon as requested before having the chance to disable the irq.
Set the irq flag as IRQ_NOAUTOEN before requesting it.
This patch mutes the error:
stmfts 2-0049: failed to read events: -11
received sometimes during boot time.
--- drivers/input/touchscreen/stmfts.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/input/touchscreen/stmfts.c +8 -3
@@ -682,6 +682,14 @@ static int stmfts_probe(struct i2c_client *client,input_set_drvdata (sdata->input, sdata); +/* +* stmfts_power_on expects interrupt to be disabled, but +* at this point the device is still off and I do not trust +* the status of the irq line that can generate some spurious +* interrupts. To be on the safe side it's better to not enable +* the interrupts during their request. +*/ +irq_set_status_flags (client->irq,IRQ_NOAUTOEN ); err = devm_request_threaded_irq(&client->dev, client->irq, NULL, stmfts_irq_handler, IRQF_ONESHOT,
@@ -689,9 +697,6 @@ static int stmfts_probe(struct i2c_client *client,if (err)return err; -/* stmfts_power_on expects interrupt to be disabled */ -disable_irq (client->irq); -dev_dbg (&client->dev,"initializing ST-Microelectronics FTS...\n" ); err =stmfts_power_on (sdata);
Signature · 1 line
2.15.1
PATCH 140/189 x86/power: Fix swsusp_arch_resume prototype
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 328008a72d38b5bde6491e463405c34a81a65d3e ]
The declaration for swsusp_arch_resume marks it as 'asmlinkage', but the definition in x86-32 does not, and it fails to include the header with the declaration. This leads to a warning when building with link-time-optimizations:
kernel/power/power.h:108:23: error: type of 'swsusp_arch_resume' does not match original declaration [-Werror=lto-type-mismatch]
extern asmlinkage int swsusp_arch_resume(void);
^arch/x86/power/hibernate_32.c:148:0: note: 'swsusp_arch_resume' was previously declared here
int swsusp_arch_resume(void)
This moves the declaration into a globally visible header file and fixes up both x86 definitions to match it.
--- arch/x86/power/hibernate_32.c | 2 +- arch/x86/power/hibernate_64.c | 2 +- include/linux/suspend.h | 2 ++ kernel/power/power.h | 3 --- 4 files changed, 4 insertions(+), 5 deletions(-)
arch/x86/power/hibernate_32.c +1 -1
@@ -145,7 +145,7 @@ static inline void resume_init_first_level_page_table(pgd_t *pg_dir)#endif } -int swsusp_arch_resume (void ) +asmlinkage int swsusp_arch_resume(void) {int error;
arch/x86/power/hibernate_64.c +1 -1
@@ -174,7 +174,7 @@ out:return 0 ; } -int swsusp_arch_resume (void ) +asmlinkage int swsusp_arch_resume(void) {int error;
include/linux/suspend.h +2 -0
@@ -384,6 +384,8 @@ extern int swsusp_page_is_forbidden(struct page *);extern void swsusp_set_page_free (struct page *);extern void swsusp_unset_page_free (struct page *);extern unsigned long get_safe_page (gfp_t gfp_mask); +extern asmlinkage int swsusp_arch_suspend(void); +extern asmlinkage int swsusp_arch_resume(void);extern void hibernation_set_ops (const struct platform_hibernation_ops *ops);extern int hibernate (void );
kernel/power/power.h +0 -3
@@ -104,9 +104,6 @@ extern int in_suspend;extern dev_t swsusp_resume_device;extern sector_t swsusp_resume_block; -extern asmlinkage int swsusp_arch_suspend(void); -extern asmlinkage int swsusp_arch_resume(void); -extern int create_basic_memory_bitmaps (void );extern void free_basic_memory_bitmaps (void );extern int hibernate_preallocate_memory (void );
Signature · 1 line
2.15.1
PATCH 75/189 block: Set BIO_TRACE_COMPLETION on new bio during split
In reply to Sasha LevinFrom: Goldwyn Rodrigues <[email protected]>
[ Upstream commit 20d59023c5ec4426284af492808bcea1f39787ef ]
We inadvertently set it again on the source bio, but we need to set it on the new split bio instead.
--- block/bio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/bio.c +1 -1
@@ -1838,7 +1838,7 @@ struct bio *bio_split(struct bio *bio, int sectors,bio_advance (bio, split->bi_iter.bi_size);if (bio_flagged (bio,BIO_TRACE_COMPLETION )) -bio_set_flag (bio,BIO_TRACE_COMPLETION ); +bio_set_flag (split,BIO_TRACE_COMPLETION );return split; }
Signature · 1 line
2.15.1
PATCH 76/189 selftests/bpf: fix test_dev_cgroup
In reply to Sasha LevinFrom: Alexei Starovoitov <[email protected]>
[ Upstream commit 8e6875250a1189e0d8db8b05e18abe63c2744521 ]
The test incorrectly doing
mkdir /mnt/cgroup-test-work-dirtest-bpf-based-device-cgroup instead of
mkdir /mnt/cgroup-test-work-dir/test-bpf-based-device-cgroup
somehow such mkdir succeeds and new directory appears:/mnt/cgroup-test-work-dir/cgroup-test-work-dirtest-bpf-based-device-cgroup
Later cleanup via nftw("/mnt/cgroup-test-work-dir", ...); doesn't walk this directory.
"rmdir /mnt/cgroup-test-work-dir" succeeds, but bpf program and dangling cgroup stays in memory.
That's a separate issue on a cgroup side.
For now fix the test.
--- tools/testing/selftests/bpf/test_dev_cgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/test_dev_cgroup.c +1 -1
@@ -19,7 +19,7 @@#define DEV_CGROUP_PROG "./dev_cgroup.o" -#define TEST_CGROUP "test-bpf-based-device-cgroup/" +#define TEST_CGROUP "/test-bpf-based-device-cgroup/"int main (int argc,char **argv) {
Signature · 1 line
2.15.1
PATCH 79/189 i40evf: ignore link up if not running
In reply to Sasha LevinFrom: Alan Brady <[email protected]>
[ Upstream commit e0346f9fcb6c636d2f870e6666de8781413f34ea ]
If we receive the link status message from PF with link up before queues are actually enabled, it will trigger a TX hang. This fixes the issue by ignoring a link up message if the VF state is not yet in RUNNING state.
--- .../net/ethernet/intel/i40evf/i40evf_virtchnl.c | 35 ++++++++++++++-------- 1 file changed, 23 insertions(+), 12 deletions(-)
drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c +23 -12
@@ -965,23 +965,34 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,if (v_opcode ==VIRTCHNL_OP_EVENT ) {struct virtchnl_pf_event *vpe = (struct virtchnl_pf_event *)msg; +bool link_up = vpe->event_data.link_event.link_status;switch (vpe->event) {case VIRTCHNL_EVENT_LINK_CHANGE : adapter->link_speed = vpe->event_data.link_event.link_speed; -if (adapter->link_up != - vpe->event_data.link_event.link_status) { - adapter->link_up = - vpe->event_data.link_event.link_status; -if (adapter->link_up) { -netif_tx_start_all_queues (netdev); -netif_carrier_on (netdev); - }else { -netif_tx_stop_all_queues (netdev); -netif_carrier_off (netdev); - } -i40evf_print_link_message (adapter); + +/* we've already got the right link status, bail */ +if (adapter->link_up == link_up) +break ; + +/* If we get link up message and start queues before +* our queues are configured it will trigger a TX hang. +* In that case, just ignore the link status message, +* we'll get another one after we enable queues and +* actually prepared to send traffic. +*/ +if (link_up && adapter->state != __I40EVF_RUNNING) +break ; + + adapter->link_up = link_up; +if (link_up) { +netif_tx_start_all_queues (netdev); +netif_carrier_on (netdev); + }else { +netif_tx_stop_all_queues (netdev); +netif_carrier_off (netdev); } +i40evf_print_link_message (adapter);break ;case VIRTCHNL_EVENT_RESET_IMPENDING :dev_info (&adapter->pdev->dev,"PF reset warning received\n" );
Signature · 1 line
2.15.1
PATCH 80/189 i40e: Fix channel addition in reset flow
In reply to Sasha LevinFrom: Amritha Nambiar <[email protected]>
[ Upstream commit bbf0bdd41fbf71a008325bdcf0df63ab088bf532 ]
Fix recreating the channel VSIs during the reset flow to reconfigure the Tx rings and the queue context associated with the channel VSI. Also update the next_base_queue for the VSI while rebuilding the channel VSIs after a reset.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_main.c +11 -0
@@ -9077,6 +9077,17 @@ static int i40e_rebuild_channels(struct i40e_vsi *vsi) vsi->uplink_seid);return ret; } +/* Reconfigure TX queues using QTX_CTL register */ + ret =i40e_channel_config_tx_ring (vsi->back, vsi, ch); +if (ret) { +dev_info (&vsi->back->pdev->dev, +"failed to configure TX rings for channel %u\n" , + ch->seid); +return ret; + } +/* update 'next_base_queue' */ + vsi->next_base_queue = vsi->next_base_queue + + ch->num_queue_pairs;if (ch->max_tx_rate) {u64 credits = ch->max_tx_rate;
Signature · 1 line
2.15.1
PATCH 145/189 ACPI / scan: Use acpi_bus_get_status() to initialize ACPI_TYPE_DEVICE devs
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 63347db0affadcbccd5613116ea8431c70139b3e ]
The acpi_get_bus_status wrapper for acpi_bus_get_status_handle has some code to handle certain device quirks, in some cases we also need this quirk handling for the initial _STA call.
Specifically on some devices calling _STA before all _DEP dependencies are met results in errors like these:
[ 0.123579] ACPI Error: No handler for Region [ECRM] (00000000ba9edc4c)
[GenericSerialBus] (20170831/evregion-166)
[ 0.123601] ACPI Error: Region GenericSerialBus (ID=9) has no handler
(20170831/exfldio-299)
[ 0.123618] ACPI Error: Method parse/execution failed
\_SB.I2C1.BAT1._STA, AE_NOT_EXIST (20170831/psparse-550)acpi_get_bus_status already has code to avoid this, so by using it we also silence these errors from the initial _STA call.
Note that in order for the acpi_get_bus_status handling for this to work, we initialize dep_unmet to 1 until acpi_device_dep_initialize gets called, this means that battery devices will be instantiated with an initial status of 0. This is not a problem, acpi_bus_attach will get called soon after the instantiation anyways and it will update the status as first point of order.
--- drivers/acpi/scan.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/acpi/scan.c +17 -3
@@ -1565,6 +1565,8 @@ void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,device_initialize (&device->dev);dev_set_uevent_suppress (&device->dev, true);acpi_init_coherency (device); +/* Assume there are unmet deps until acpi_device_dep_initialize() runs */ + device->dep_unmet =1 ; }void acpi_device_add_finalize (struct acpi_device *device)
@@ -1588,6 +1590,14 @@ static int acpi_add_single_object(struct acpi_device **child, }acpi_init_device_object (device, handle, type, sta); +/* +* For ACPI_BUS_TYPE_DEVICE getting the status is delayed till here so +* that we can call acpi_bus_get_status() and use its quirk handling. +* Note this must be done before the get power-/wakeup_dev-flags calls. +*/ +if (type ==ACPI_BUS_TYPE_DEVICE ) +acpi_bus_get_status (device); +acpi_bus_get_power_flags (device);acpi_bus_get_wakeup_device_flags (device);
@@ -1660,9 +1670,11 @@ static int acpi_bus_type_and_status(acpi_handle handle, int *type,return -ENODEV ; *type =ACPI_BUS_TYPE_DEVICE ; - status =acpi_bus_get_status_handle (handle, sta); -if (ACPI_FAILURE (status)) - *sta =0 ; +/* +* acpi_add_single_object updates this once we've an acpi_device +* so that acpi_bus_get_status' quirk handling can be used. +*/ + *sta =0 ;break ;case ACPI_TYPE_PROCESSOR : *type =ACPI_BUS_TYPE_PROCESSOR ;
@@ -1760,6 +1772,8 @@ static void acpi_device_dep_initialize(struct acpi_device *adev)acpi_status status;int i; + adev->dep_unmet =0 ; +if (!acpi_has_method (adev->handle,"_DEP" ))return ;
Signature · 1 line
2.15.1
PATCH 82/189 KVM: s390: vsie: use READ_ONCE to access some SCB fields
In reply to Sasha LevinFrom: David Hildenbrand <[email protected]>
[ Upstream commit b3ecd4aa8632a86428605ab73393d14779019d82 ]
Another VCPU might try to modify the SCB while we are creating the shadow SCB. In general this is no problem - unless the compiler decides to not load values once, but e.g. twice.
For us, this is only relevant when checking/working with such values. E.g. the prefix value, the mso, state of transactional execution and addresses of satellite blocks.
E.g. if we blindly forward values (e.g. general purpose registers or execution controls after masking), we don't care.
Leaving unpin_blocks() untouched for now, will handle it separately.
The worst thing right now that I can see would be a missed prefix un/remap (mso, prefix, tx) or using wrong guest addresses. Nothing critical, but let's try to avoid unpredictable behavior.
Message-Id: <[email protected]>
--- arch/s390/kvm/vsie.c | 50 +++++++++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 19 deletions(-)
arch/s390/kvm/vsie.c +31 -19
@@ -28,7 +28,11 @@ struct vsie_page {* the same offset as that in struct sie_page! */ struct mcck_volatile_info mcck_info;/* 0x0200 */ -/* the pinned originial scb */ +/* +* The pinned original scb. Be aware that other VCPUs can modify +* it while we read from it. Values that are used for conditions or +* are reused conditionally, should be accessed via READ_ONCE. +*/ struct kvm_s390_sie_block *scb_o;/* 0x0218 */ /* the shadow gmap in use by the vsie_page */ struct gmap *gmap;/* 0x0220 */
@@ -140,12 +144,13 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) {struct kvm_s390_sie_block *scb_s = &vsie_page->scb_s;struct kvm_s390_sie_block *scb_o = vsie_page->scb_o; -u32 crycb_addr = scb_o->crycbd &0x7ffffff8U ; +const uint32_t crycbd_o =READ_ONCE (scb_o->crycbd); +const u32 crycb_addr = crycbd_o &0x7ffffff8U ;unsigned long *b1, *b2;u8 ecb3_flags; scb_s->crycbd =0 ; -if (!(scb_o->crycbd & vcpu->arch.sie_block->crycbd &CRYCB_FORMAT1 )) +if (!(crycbd_o & vcpu->arch.sie_block->crycbd &CRYCB_FORMAT1 ))return 0 ;/* format-1 is supported with message-security-assist extension 3 */ if (!test_kvm_facility (vcpu->kvm,76 ))
@@ -183,12 +188,15 @@ static void prepare_ibc(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) {struct kvm_s390_sie_block *scb_s = &vsie_page->scb_s;struct kvm_s390_sie_block *scb_o = vsie_page->scb_o; +/* READ_ONCE does not work on bitfields - use a temporary variable */ +const uint32_t __new_ibc = scb_o->ibc; +const uint32_t new_ibc =READ_ONCE (__new_ibc) &0x0fffU ;__u64 min_ibc = (sclp.ibc >>16 ) &0x0fffU ; scb_s->ibc =0 ;/* ibc installed in g2 and requested for g3 */ -if (vcpu->kvm->arch.model.ibc && (scb_o->ibc &0x0fffU )) { - scb_s->ibc = scb_o->ibc &0x0fffU ; +if (vcpu->kvm->arch.model.ibc && new_ibc) { + scb_s->ibc = new_ibc;/* takte care of the minimum ibc level of the machine */ if (scb_s->ibc < min_ibc) scb_s->ibc = min_ibc;
@@ -259,6 +267,10 @@ static int shadow_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) {struct kvm_s390_sie_block *scb_o = vsie_page->scb_o;struct kvm_s390_sie_block *scb_s = &vsie_page->scb_s; +/* READ_ONCE does not work on bitfields - use a temporary variable */ +const uint32_t __new_prefix = scb_o->prefix; +const uint32_t new_prefix =READ_ONCE (__new_prefix); +const bool wants_tx =READ_ONCE (scb_o->ecb) &ECB_TE ;bool had_tx = scb_s->ecb &ECB_TE ;unsigned long new_mso =0 ;int rc;
@@ -306,14 +318,14 @@ static int shadow_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) scb_s->icpua = scb_o->icpua;if (!(atomic_read (&scb_s->cpuflags) &CPUSTAT_SM )) - new_mso = scb_o->mso &0xfffffffffff00000UL ; + new_mso =READ_ONCE (scb_o->mso) &0xfffffffffff00000UL ;/* if the hva of the prefix changes, we have to remap the prefix */ -if (scb_s->mso != new_mso || scb_s->prefix != scb_o->prefix) +if (scb_s->mso != new_mso || scb_s->prefix != new_prefix)prefix_unmapped (vsie_page);/* SIE will do mso/msl validity and exception checks for us */ scb_s->msl = scb_o->msl &0xfffffffffff00000UL ; scb_s->mso = new_mso; - scb_s->prefix = scb_o->prefix; + scb_s->prefix = new_prefix;/* We have to definetly flush the tlb if this scb never ran */ if (scb_s->ihcpu !=0xffffU )
@@ -325,11 +337,11 @@ static int shadow_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)if (test_kvm_cpu_feat (vcpu->kvm,KVM_S390_VM_CPU_FEAT_ESOP )) scb_s->ecb |= scb_o->ecb &ECB_HOSTPROTINT ;/* transactional execution */ -if (test_kvm_facility (vcpu->kvm,73 )) { +if (test_kvm_facility (vcpu->kvm,73 ) && wants_tx) {/* remap the prefix is tx is toggled on */ -if ((scb_o->ecb &ECB_TE ) && !had_tx) +if (!had_tx)prefix_unmapped (vsie_page); - scb_s->ecb |= scb_o->ecb &ECB_TE ; + scb_s->ecb |=ECB_TE ; }/* branch prediction */ if (test_kvm_facility (vcpu->kvm,82 ))
@@ -539,9 +551,9 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)gpa_t gpa;int rc =0 ; - gpa = scb_o->scaol & ~0xfUL ; + gpa =READ_ONCE (scb_o->scaol) & ~0xfUL ;if (test_kvm_cpu_feat (vcpu->kvm,KVM_S390_VM_CPU_FEAT_64BSCAO )) - gpa |= (u64 ) scb_o->scaoh <<32 ; + gpa |= (u64 )READ_ONCE (scb_o->scaoh) <<32 ;if (gpa) {if (!(gpa & ~0x1fffUL )) rc =set_validity_icpt (scb_s,0x0038U );
@@ -561,7 +573,7 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) scb_s->scaol = (u32 )(u64 )hpa; } - gpa = scb_o->itdba & ~0xffUL ; + gpa =READ_ONCE (scb_o->itdba) & ~0xffUL ;if (gpa && (scb_s->ecb &ECB_TE )) {if (!(gpa & ~0x1fffU )) { rc =set_validity_icpt (scb_s,0x0080U );
@@ -576,7 +588,7 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) scb_s->itdba = hpa; } - gpa = scb_o->gvrd & ~0x1ffUL ; + gpa =READ_ONCE (scb_o->gvrd) & ~0x1ffUL ;if (gpa && (scb_s->eca &ECA_VX ) && !(scb_s->ecd &ECD_HOSTREGMGMT )) {if (!(gpa & ~0x1fffUL )) { rc =set_validity_icpt (scb_s,0x1310U );
@@ -594,7 +606,7 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) scb_s->gvrd = hpa; } - gpa = scb_o->riccbd & ~0x3fUL ; + gpa =READ_ONCE (scb_o->riccbd) & ~0x3fUL ;if (gpa && (scb_s->ecb3 &ECB3_RI )) {if (!(gpa & ~0x1fffUL )) { rc =set_validity_icpt (scb_s,0x0043U );
@@ -612,8 +624,8 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)if ((scb_s->ecb &ECB_GS ) && !(scb_s->ecd &ECD_HOSTREGMGMT )) {unsigned long sdnxc; - gpa = scb_o->sdnxo & ~0xfUL ; - sdnxc = scb_o->sdnxo &0xfUL ; + gpa =READ_ONCE (scb_o->sdnxo) & ~0xfUL ; + sdnxc =READ_ONCE (scb_o->sdnxo) &0xfUL ;if (!gpa || !(gpa & ~0x1fffUL )) { rc =set_validity_icpt (scb_s,0x10b0U ); goto unpin;
@@ -778,7 +790,7 @@ static void retry_vsie_icpt(struct vsie_page *vsie_page)static int handle_stfle (struct kvm_vcpu *vcpu,struct vsie_page *vsie_page) {struct kvm_s390_sie_block *scb_s = &vsie_page->scb_s; -__u32 fac = vsie_page->scb_o->fac &0x7ffffff8U ; +__u32 fac =READ_ONCE (vsie_page->scb_o->fac) &0x7ffffff8U ;if (fac &&test_kvm_facility (vcpu->kvm,7 )) {retry_vsie_icpt (vsie_page);
Signature · 1 line
2.15.1
PATCH 83/189 KVM: s390: vsie: store guest addresses of satellite blocks in vsie_page
In reply to Sasha LevinFrom: David Hildenbrand <[email protected]>
[ Upstream commit 15e5020e575d0c1a4eddd99bf7ffdc1f34a3b17d ]
This way, the values cannot change, even if another VCPU might try to mess with the nested SCB currently getting executed by another VCPU.
We now always use the same gpa for pinning and unpinning a page (for unpinning, it is only relevant to mark the guest page dirty for migration).
Message-Id: <[email protected]>
--- arch/s390/kvm/vsie.c | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-)
arch/s390/kvm/vsie.c +22 -15
@@ -38,7 +38,13 @@ struct vsie_page {struct gmap *gmap;/* 0x0220 */ /* address of the last reported fault to guest2 */ unsigned long fault_addr;/* 0x0228 */ -__u8 reserved[0x0700 -0x0230 ];/* 0x0230 */ +/* calculated guest addresses of satellite control blocks */ +gpa_t sca_gpa;/* 0x0230 */ +gpa_t itdba_gpa;/* 0x0238 */ +gpa_t gvrd_gpa;/* 0x0240 */ +gpa_t riccbd_gpa;/* 0x0248 */ +gpa_t sdnx_gpa;/* 0x0250 */ +__u8 reserved[0x0700 -0x0258 ];/* 0x0258 */ struct kvm_s390_crypto_cb crycb;/* 0x0700 */ __u8 fac[S390_ARCH_FAC_LIST_SIZE_BYTE ];/* 0x0800 */ };
@@ -485,46 +491,42 @@ static void unpin_guest_page(struct kvm *kvm, gpa_t gpa, hpa_t hpa)/* unpin all blocks previously pinned by pin_blocks(), marking them dirty */ static void unpin_blocks (struct kvm_vcpu *vcpu,struct vsie_page *vsie_page) { -struct kvm_s390_sie_block *scb_o = vsie_page->scb_o;struct kvm_s390_sie_block *scb_s = &vsie_page->scb_s;hpa_t hpa; -gpa_t gpa; hpa = (u64 ) scb_s->scaoh <<32 | scb_s->scaol;if (hpa) { - gpa = scb_o->scaol & ~0xfUL ; -if (test_kvm_cpu_feat (vcpu->kvm,KVM_S390_VM_CPU_FEAT_64BSCAO )) - gpa |= (u64 ) scb_o->scaoh <<32 ; -unpin_guest_page (vcpu->kvm, gpa, hpa); +unpin_guest_page (vcpu->kvm, vsie_page->sca_gpa, hpa); + vsie_page->sca_gpa =0 ; scb_s->scaol =0 ; scb_s->scaoh =0 ; } hpa = scb_s->itdba;if (hpa) { - gpa = scb_o->itdba & ~0xffUL ; -unpin_guest_page (vcpu->kvm, gpa, hpa); +unpin_guest_page (vcpu->kvm, vsie_page->itdba_gpa, hpa); + vsie_page->itdba_gpa =0 ; scb_s->itdba =0 ; } hpa = scb_s->gvrd;if (hpa) { - gpa = scb_o->gvrd & ~0x1ffUL ; -unpin_guest_page (vcpu->kvm, gpa, hpa); +unpin_guest_page (vcpu->kvm, vsie_page->gvrd_gpa, hpa); + vsie_page->gvrd_gpa =0 ; scb_s->gvrd =0 ; } hpa = scb_s->riccbd;if (hpa) { - gpa = scb_o->riccbd & ~0x3fUL ; -unpin_guest_page (vcpu->kvm, gpa, hpa); +unpin_guest_page (vcpu->kvm, vsie_page->riccbd_gpa, hpa); + vsie_page->riccbd_gpa =0 ; scb_s->riccbd =0 ; } hpa = scb_s->sdnxo;if (hpa) { - gpa = scb_o->sdnxo; -unpin_guest_page (vcpu->kvm, gpa, hpa); +unpin_guest_page (vcpu->kvm, vsie_page->sdnx_gpa, hpa); + vsie_page->sdnx_gpa =0 ; scb_s->sdnxo =0 ; } }
@@ -569,6 +571,7 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) }if (rc) goto unpin; + vsie_page->sca_gpa = gpa; scb_s->scaoh = (u32)((u64 )hpa >>32 ); scb_s->scaol = (u32 )(u64 )hpa; }
@@ -585,6 +588,7 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) rc =set_validity_icpt (scb_s,0x0080U ); goto unpin; } + vsie_page->itdba_gpa = gpa; scb_s->itdba = hpa; }
@@ -603,6 +607,7 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) rc =set_validity_icpt (scb_s,0x1310U ); goto unpin; } + vsie_page->gvrd_gpa = gpa; scb_s->gvrd = hpa; }
@@ -619,6 +624,7 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) goto unpin; }/* Validity 0x0044 will be checked by SIE */ + vsie_page->riccbd_gpa = gpa; scb_s->riccbd = hpa; }if ((scb_s->ecb &ECB_GS ) && !(scb_s->ecd &ECD_HOSTREGMGMT )) {
@@ -646,6 +652,7 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) rc =set_validity_icpt (scb_s,0x10b0U ); goto unpin; } + vsie_page->sdnx_gpa = gpa; scb_s->sdnxo = hpa | sdnxc; }return 0 ;
Signature · 1 line
2.15.1
PATCH 84/189 blk-mq-debugfs: don't allow write on attributes with seq_operations set
In reply to Sasha LevinFrom: Eryu Guan <[email protected]>
[ Upstream commit 6b136a24b05c81a24e0b648a4bd938bcd0c4f69e ]
Attributes that only implement .seq_ops are read-only, any write to them should be rejected. But currently kernel would crash when writing to such debugfs entries, e.g.
chmod +w /sys/kernel/debug/block/<dev>/requeue_list echo 0 > /sys/kernel/debug/block/<dev>/requeue_list chmod -w /sys/kernel/debug/block/<dev>/requeue_list
Fix it by returning -EPERM in blk_mq_debugfs_write() when writing to such attributes.
--- block/blk-mq-debugfs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
block/blk-mq-debugfs.c +5 -1
@@ -703,7 +703,11 @@ static ssize_t blk_mq_debugfs_write(struct file *file, const char __user *buf,const struct blk_mq_debugfs_attr *attr = m->private;void *data =d_inode (file->f_path.dentry->d_parent)->i_private; -if (!attr->write) +/* +* Attributes that only implement .seq_ops are read-only and 'attr' is +* the same with 'data' in this case. +*/ +if (attr == data || !attr->write)return -EPERM ;return attr->write (data, buf, count, ppos);
Signature · 1 line
2.15.1
PATCH 85/189 ASoC: rockchip: Use dummy_dai for rt5514 dsp dailink
In reply to Sasha LevinFrom: Jeffy Chen <[email protected]>
[ Upstream commit fde7f9dbc71365230eeb8c8ea97ce9b552c8e5bd ]
The rt5514 dsp captures pcm data through spi directly, so we should not use rockchip-i2s as it's cpu dai like other codecs.
Use dummy_dai for rt5514 dsp dailink to make voice wakeup work again.
--- sound/soc/rockchip/rk3399_gru_sound.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
sound/soc/rockchip/rk3399_gru_sound.c +16 -3
@@ -367,7 +367,8 @@ static const struct snd_soc_dai_link rockchip_dais[] = { [DAILINK_RT5514_DSP ] = { .name ="RT5514 DSP" , .stream_name ="Wake on Voice" , - .codec_dai_name ="rt5514-dsp-cpu-dai" , + .codec_name ="snd-soc-dummy" , + .codec_dai_name ="snd-soc-dummy-dai" , }, };
@@ -528,7 +529,18 @@ static int rockchip_sound_of_parse_dais(struct device *dev,if (index <0 )continue ; - np_cpu = (index ==DAILINK_CDNDP ) ? np_cpu1 : np_cpu0; +switch (index) { +case DAILINK_CDNDP : + np_cpu = np_cpu1; +break ; +case DAILINK_RT5514_DSP : + np_cpu = np_codec; +break ; +default : + np_cpu = np_cpu0; +break ; + } +if (!np_cpu) {dev_err (dev,"Missing 'rockchip,cpu' for %s\n" , rockchip_dais[index].name);
@@ -538,7 +550,8 @@ static int rockchip_sound_of_parse_dais(struct device *dev, dai = &card->dai_link[card->num_links++]; *dai = rockchip_dais[index]; - dai->codec_of_node = np_codec; +if (!dai->codec_name) + dai->codec_of_node = np_codec; dai->platform_of_node = np_cpu; dai->cpu_of_node = np_cpu;
Signature · 1 line
2.15.1
PATCH 88/189 fm10k: fix "failed to kill vid" message for VF
In reply to Sasha LevinFrom: Ngai-Mint Kwan <[email protected]>
[ Upstream commit cf315ea596ec26d7aa542a9ce354990875a920c0 ]
When a VF is under PF VLAN assignment:
ip link set <pf> vf <#> vlan <vid>
This will remove all previous entries in the VLAN table including those generated by VLAN interfaces created on the VF. The issue arises when the VF is under PF VLAN assignment and one or more of these VLAN interfaces of the VF are deleted. When deleting these VLAN interfaces, the following message will be generated in "dmesg":
failed to kill vid 0081/<vid> for device <vf>
This is due to the fact that "ndo_vlan_rx_kill_vid" exits with an error. The handler for this ndo is "fm10k_update_vid". Any calls to this function while under PF VLAN management will exit prematurely and, thus, it will generate the failure message.
Additionally, since "fm10k_update_vid" exits prematurely, none of the VLAN update is performed. So, even though the actual VLAN interfaces of the VF will be deleted, the active_vlans bitmask is not cleared. When the VF is no longer under PF VLAN assignment, the driver mistakenly restores the previous entries of the VLAN table based on an unsynchronized list of active VLANs.
The solution to this issue involves checking the VLAN update action type before exiting "fm10k_update_vid". If the VLAN update action type is to "add", this action will not be permitted while the VF is under PF VLAN assignment and the VLAN update is abandoned like before.
However, if the VLAN update action type is to "kill", then we need to also clear the active_vlans bitmask. However, we don't need to actually queue any messages to the PF, because the MAC and VLAN tables have already been cleared, and the PF would silently ignore these requests anyways.
--- drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +12 -2
@@ -934,8 +934,12 @@ static int fm10k_update_vid(struct net_device *netdev, u16 vid, bool set)if (vid >=VLAN_N_VID )return -EINVAL ; -/* Verify we have permission to add VLANs */ -if (hw->mac.vlan_override) +/* Verify that we have permission to add VLANs. If this is a request +* to remove a VLAN, we still want to allow the user to remove the +* VLAN device. In that case, we need to clear the bit in the +* active_vlans bitmask. +*/ +if (set && hw->mac.vlan_override)return -EACCES ;/* update active_vlans bitmask */
@@ -954,6 +958,12 @@ static int fm10k_update_vid(struct net_device *netdev, u16 vid, bool set) rx_ring->vid &= ~FM10K_VLAN_CLEAR ; } +/* If our VLAN has been overridden, there is no reason to send VLAN +* removal requests as they will be silently ignored. +*/ +if (hw->mac.vlan_override) +return 0 ; +/* Do not remove default VLAN ID related entries from VLAN and MAC * tables */
Signature · 1 line
2.15.1
PATCH 155/189 RDS: IB: Fix null pointer issue
In reply to Sasha LevinFrom: Guanglei Li <[email protected]>
[ Upstream commit 2c0aa08631b86a4678dbc93b9caa5248014b4458 ]
Scenario:
1. Port down and do fail over
2. Ap do rds_bind syscall
PID: 47039 TASK: ffff89887e2fe640 CPU: 47 COMMAND: "kworker/u:6"
#0 [ffff898e35f159f0] machine_kexec at ffffffff8103abf9 #1 [ffff898e35f15a60] crash_kexec at ffffffff810b96e3 #2 [ffff898e35f15b30] oops_end at ffffffff8150f518
#3 [ffff898e35f15b60] no_context at ffffffff8104854c
#4 [ffff898e35f15ba0] __bad_area_nosemaphore at ffffffff81048675 #5 [ffff898e35f15bf0] bad_area_nosemaphore at ffffffff810487d3 #6 [ffff898e35f15c00] do_page_fault at ffffffff815120b8 #7 [ffff898e35f15d10] page_fault at ffffffff8150ea95
[exception RIP: unknown or invalid address]
RIP: 0000000000000000 RSP: ffff898e35f15dc8 RFLAGS: 00010282
RAX: 00000000fffffffe RBX: ffff889b77f6fc00 RCX:ffffffff81c99d88
RDX: 0000000000000000 RSI: ffff896019ee08e8 RDI:ffff889b77f6fc00
RBP: ffff898e35f15df0 R8: ffff896019ee08c8 R9:0000000000000000
R10: 0000000000000400 R11: 0000000000000000 R12:ffff896019ee08c0
R13: ffff889b77f6fe68 R14: ffffffff81c99d80 R15: ffffffffa022a1e0
ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018 #8 [ffff898e35f15dc8] cma_ndev_work_handler at ffffffffa022a228 [rdma_cm] #9 [ffff898e35f15df8] process_one_work at ffffffff8108a7c6 #10 [ffff898e35f15e58] worker_thread at ffffffff8108bda0
#11 [ffff898e35f15ee8] kthread at ffffffff81090fe6
PID: 45659 TASK: ffff880d313d2500 CPU: 31 COMMAND: "oracle_45659_ap"
#0 [ffff881024ccfc98] __schedule at ffffffff8150bac4
#1 [ffff881024ccfd40] schedule at ffffffff8150c2cf
#2 [ffff881024ccfd50] __mutex_lock_slowpath at ffffffff8150cee7 #3 [ffff881024ccfdc0] mutex_lock at ffffffff8150cdeb
#4 [ffff881024ccfde0] rdma_destroy_id at ffffffffa022a027 [rdma_cm] #5 [ffff881024ccfe10] rds_ib_laddr_check at ffffffffa0357857 [rds_rdma] #6 [ffff881024ccfe50] rds_trans_get_preferred at ffffffffa0324c2a [rds] #7 [ffff881024ccfe80] rds_bind at ffffffffa031d690 [rds]
#8 [ffff881024ccfeb0] sys_bind at ffffffff8142a670
PID: 45659 PID: 47039rds_ib_laddr_check
/* create id_priv with a null event_handler */ rdma_create_id
rdma_bind_addr
cma_acquire_dev
/* add id_priv to cma_dev->id_list */
cma_attach_to_dev
cma_ndev_work_handler
/* event_hanlder is null */
id_priv->id.event_handler--- net/rds/ib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/rds/ib.c +2 -1
@@ -347,7 +347,8 @@ static int rds_ib_laddr_check(struct net *net, __be32 addr)/* Create a CMA ID and try to bind it. This catches both * IB and iWARP capable NICs. */ - cm_id =rdma_create_id (&init_net,NULL ,NULL ,RDMA_PS_TCP ,IB_QPT_RC ); + cm_id =rdma_create_id (&init_net, rds_rdma_cm_event_handler, +NULL ,RDMA_PS_TCP ,IB_QPT_RC );if (IS_ERR (cm_id))return PTR_ERR (cm_id);
Signature · 1 line
2.15.1
PATCH 161/189 bcache: fix for allocator and register thread race
In reply to Sasha LevinFrom: Tang Junhui <[email protected]>
[ Upstream commit 682811b3ce1a5a4e20d700939a9042f01dbc66c4 ]
After long time running of random small IO writing, I reboot the machine, and after the machine power on, I found bcache got stuck, the stack is:
[root@ceph153 ~]# cat /proc/2510/task/*/stack
[<ffffffffa06b2455>] closure_sync+0x25/0x90 [bcache] [<ffffffffa06b6be8>] bch_journal+0x118/0x2b0 [bcache] [<ffffffffa06b6dc7>] bch_journal_meta+0x47/0x70 [bcache] [<ffffffffa06be8f7>] bch_prio_write+0x237/0x340 [bcache] [<ffffffffa06a8018>] bch_allocator_thread+0x3c8/0x3d0 [bcache] [<ffffffff810a631f>] kthread+0xcf/0xe0 [<ffffffff8164c318>] ret_from_fork+0x58/0x90 [<ffffffffffffffff>] 0xffffffffffffffff [root@ceph153 ~]# cat /proc/2038/task/*/stack [<ffffffffa06b1abd>] __bch_btree_map_nodes+0x12d/0x150 [bcache] [<ffffffffa06b1bd1>] bch_btree_insert+0xf1/0x170 [bcache] [<ffffffffa06b637f>] bch_journal_replay+0x13f/0x230 [bcache] [<ffffffffa06c75fe>] run_cache_set+0x79a/0x7c2 [bcache] [<ffffffffa06c0cf8>] register_bcache+0xd48/0x1310 [bcache] [<ffffffff812f702f>] kobj_attr_store+0xf/0x20 [<ffffffff8125b216>] sysfs_write_file+0xc6/0x140 [<ffffffff811dfbfd>] vfs_write+0xbd/0x1e0 [<ffffffff811e069f>] SyS_write+0x7f/0xe0 [<ffffffff8164c3c9>] system_call_fastpath+0x16/0x1
The stack shows the register thread and allocator thread were getting stuck when registering cache device.
I reboot the machine several times, the issue always exsit in this machine.
I debug the code, and found the call trace as bellow:register_bcache()
==>run_cache_set()
==>bch_journal_replay()
==>bch_btree_insert()
==>__bch_btree_map_nodes()
==>btree_insert_fn()
==>btree_split() //node need split
==>btree_check_reserve()In btree_check_reserve(), It will check if there is enough buckets of RESERVE_BTREE type, since allocator thread did not work yet, so no buckets of RESERVE_BTREE type allocated, so the register thread waits on c->btree_cache_wait, and goes to sleep.
Then the allocator thread initialized, the call trace is bellow:bch_allocator_thread()
==>bch_prio_write()
==>bch_journal_meta()
==>bch_journal()
==>journal_wait_for_write()In journal_wait_for_write(), It will check if journal is full by journal_full(), but the long time random small IO writing causes the exhaustion of journal buckets(journal.blocks_free=0), In order to release the journal buckets,
the allocator calls btree_flush_write() to flush keys to btree nodes, and waits on c->journal.wait until btree nodes writing over or there has already some journal buckets space, then the allocator thread goes to sleep. but in btree_flush_write(), since bch_journal_replay() is not finished, so no btree nodes have journal (condition "if (btree_current_write(b)->journal)" never satisfied), so we got no btree node to flush, no journal bucket released, and allocator sleep all the times.
Through the above analysis, we can see that:
1) Register thread wait for allocator thread to allocate buckets of RESERVE_BTREE type;
2) Alloctor thread wait for register thread to replay journal, so it can flush btree nodes and get journal bucket.
then they are all got stuck by waiting for each other.
Hua Rui provided a patch for me, by allocating some buckets of RESERVE_BTREE type in advance, so the register thread can get bucket when btree node splitting and no need to waiting for the allocator thread. I tested it, it has effect, and register thread run a step forward, but finally are still got stuck, the reason is only 8 bucket of RESERVE_BTREE type were allocated, and in bch_journal_replay(), after 2 btree nodes splitting, only 4 bucket of RESERVE_BTREE type left, then btree_check_reserve() is not satisfied anymore, so it goes to sleep again, and in the same time, alloctor thread did not flush enough btree nodes to release a journal bucket, so they all got stuck again.
So we need to allocate more buckets of RESERVE_BTREE type in advance, but how much is enough? By experience and test, I think it should be as much as journal buckets. Then I modify the code as this patch, and test in the machine, and it works.
This patch modified base on Hua Rui’s patch, and allocate more buckets of RESERVE_BTREE type in advance to avoid register thread and allocate thread going to wait for each other.
[patch v2] ca->sb.njournal_buckets would be 0 in the first time after cache creation, and no journal exists, so just 8 btree buckets is OK.
--- drivers/md/bcache/btree.c | 9 ++++++--- drivers/md/bcache/super.c | 13 ++++++++++++- 2 files changed, 18 insertions(+), 4 deletions(-)
drivers/md/bcache/btree.c +6 -3
@@ -1871,14 +1871,17 @@ void bch_initial_gc_finish(struct cache_set *c)*/ for_each_cache (ca, c, i) {for_each_bucket (b, ca) { -if (fifo_full (&ca->free[RESERVE_PRIO ])) +if (fifo_full (&ca->free[RESERVE_PRIO ]) && +fifo_full (&ca->free[RESERVE_BTREE ]))break ;if (bch_can_invalidate_bucket (ca, b) && !GC_MARK (b)) {__bch_invalidate_one_bucket (ca, b); -fifo_push (&ca->free[RESERVE_PRIO ], - b - ca->buckets); +if (!fifo_push (&ca->free[RESERVE_PRIO ], + b - ca->buckets)) +fifo_push (&ca->free[RESERVE_BTREE ], + b - ca->buckets); } } }
drivers/md/bcache/super.c +12 -1
@@ -1833,6 +1833,7 @@ void bch_cache_release(struct kobject *kobj)static int cache_alloc (struct cache *ca) {size_t free; +size_t btree_buckets;struct bucket *b;__module_get (THIS_MODULE );
@@ -1840,9 +1841,19 @@ static int cache_alloc(struct cache *ca)bio_init (&ca->journal.bio, ca->journal.bio.bi_inline_vecs,8 ); +/* +* when ca->sb.njournal_buckets is not zero, journal exists, +* and in bch_journal_replay(), tree node may split, +* so bucket of RESERVE_BTREE type is needed, +* the worst situation is all journal buckets are valid journal, +* and all the keys need to replay, +* so the number of RESERVE_BTREE type buckets should be as much +* as journal buckets +*/ + btree_buckets = ca->sb.njournal_buckets ?:8 ; free =roundup_pow_of_two (ca->sb.nbuckets) >>10 ; - if (!init_fifo(&ca->free[RESERVE_BTREE], 8, GFP_KERNEL) || + if (!init_fifo(&ca->free[RESERVE_BTREE], btree_buckets, GFP_KERNEL) || !init_fifo_exact(&ca->free[RESERVE_PRIO], prio_buckets(ca), GFP_KERNEL) || !init_fifo(&ca->free[RESERVE_MOVINGGC], free, GFP_KERNEL) || !init_fifo(&ca->free[RESERVE_NONE], free, GFP_KERNEL) ||
Signature · 1 line
2.15.1
PATCH 166/189 cpufreq: intel_pstate: Enable HWP during system resume on CPU0
In reply to Sasha LevinFrom: Chen Yu <[email protected]>
[ Upstream commit 70f6bf2a3b7e40c3f802b0ea837762a8bc6c1430 ]
When maxcpus=1 is in the kernel command line, the BP is responsible for re-enabling the HWP - because currently only the APs invoke intel_pstate_hwp_enable() during their online process - which might put the system into unstable state after resume.
Fix this by enabling the HWP explicitly on BP during resume.
--- drivers/cpufreq/intel_pstate.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/cpufreq/intel_pstate.c +5 -0
@@ -779,6 +779,8 @@ static int intel_pstate_hwp_save_state(struct cpufreq_policy *policy)return 0 ; } +static void intel_pstate_hwp_enable (struct cpudata *cpudata); +static int intel_pstate_resume (struct cpufreq_policy *policy) {if (!hwp_active)
@@ -786,6 +788,9 @@ static int intel_pstate_resume(struct cpufreq_policy *policy)mutex_lock (&intel_pstate_limits_lock); +if (policy->cpu ==0 ) +intel_pstate_hwp_enable (all_cpu_data[policy->cpu]); + all_cpu_data[policy->cpu]->epp_policy =0 ;intel_pstate_hwp_set (policy->cpu);
Signature · 1 line
2.15.1
PATCH 167/189 selftests/ftrace: Add some missing glob checks
In reply to Sasha LevinFrom: "Steven Rostedt (VMware)" <[email protected]>
[ Upstream commit 97fe22adf33f06519bfdf7dad33bcd562e366c8f ]
Al Viro discovered a bug in the glob ftrace filtering code where "*a*b" is treated the same as "a*b", and functions that would be selected by "*a*b" but not "a*b" are not selected with "*a*b".
Add tests for patterns "*a*b" and "a*b*" to the glob selftest.
--- tools/testing/selftests/ftrace/test.d/ftrace/func-filter-glob.tc | 6 ++++++ 1 file changed, 6 insertions(+)
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-glob.tc +6 -0
@@ -29,6 +29,12 @@ ftrace_filter_check '*schedule*' '^.*schedule.*$' # filter by *, end match ftrace_filter_check 'schedule*' '^schedule.*$' +# filter by *mid*end +ftrace_filter_check '*aw*lock' '.*aw.*lock$' + +# filter by start*mid* +ftrace_filter_check 'mutex*try*' '^mutex.*try.*' + # Advanced full-glob matching feature is recently supported. # Skip the tests if we are sure the kernel does not support it. if grep -q 'accepts: .* glob-matching-pattern' README ; then
Signature · 1 line
2.15.1
PATCH 169/189 rxrpc: Don't put crypto buffers on the stack
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit 8c2f826dc36314059ac146c78d3bf8056b626446 ]
Don't put buffers of data to be handed to crypto on the stack as this may cause an assertion failure in the kernel (see below). Fix this by using an kmalloc'd buffer instead.
kernel BUG at ./include/linux/scatterlist.h:147!
...
RIP: 0010:rxkad_encrypt_response.isra.6+0x191/0x1b0 [rxrpc] RSP: 0018:ffffbe2fc06cfca8 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffff989277d59900 RCX: 0000000000000028 RDX: 0000259dc06cfd88 RSI: 0000000000000025 RDI: ffffbe30406cfd88 RBP: ffffbe2fc06cfd60 R08: ffffbe2fc06cfd08 R09: ffffbe2fc06cfd08 R10: 0000000000000000 R11: 0000000000000000 R12: 1ffff7c5f80d9f95 R13: ffffbe2fc06cfd88 R14: ffff98927a3f7aa0 R15: ffffbe2fc06cfd08 FS: 0000000000000000(0000) GS:ffff98927fc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000055b1ff28f0f8 CR3: 000000001b412003 CR4: 00000000003606f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: rxkad_respond_to_challenge+0x297/0x330 [rxrpc] rxrpc_process_connection+0xd1/0x690 [rxrpc] ? process_one_work+0x1c3/0x680 ? __lock_is_held+0x59/0xa0 process_one_work+0x249/0x680 worker_thread+0x3a/0x390 ? process_one_work+0x680/0x680 kthread+0x121/0x140 ? kthread_create_worker_on_cpu+0x70/0x70 ret_from_fork+0x3a/0x50
--- net/rxrpc/conn_event.c | 1 + net/rxrpc/rxkad.c | 92 ++++++++++++++++++++++++++++---------------------- 2 files changed, 52 insertions(+), 41 deletions(-)
net/rxrpc/conn_event.c +1 -0
@@ -460,6 +460,7 @@ void rxrpc_process_connection(struct work_struct *work)case -EKEYEXPIRED :case -EKEYREJECTED : goto protocol_error; +case -ENOMEM :case -EAGAIN : goto requeue_and_leave;case -ECONNABORTED :
net/rxrpc/rxkad.c +51 -41
174 lines not on this page · raw message
Signature · 1 line
2.15.1
PATCH 173/189 tools/libbpf: handle issues with bpf ELF objects containing .eh_frames
In reply to Sasha LevinFrom: Jesper Dangaard Brouer <[email protected]>
[ Upstream commit e3d91b0ca523d53158f435a3e13df7f0cb360ea2 ]
V3: More generic skipping of relo-section (suggested by Daniel)
If clang >= 4.0.1 is missing the option '-target bpf', it will cause llc/llvm to create two ELF sections for "Exception Frames", with section names '.eh_frame' and '.rel.eh_frame'.
The BPF ELF loader library libbpf fails when loading files with these sections. The other in-kernel BPF ELF loader in samples/bpf/bpf_load.c, handle this gracefully. And iproute2 loader also seems to work with these "eh" sections.
The issue in libbpf is caused by bpf_object__elf_collect() skipping some sections, and later when performing relocation it will be pointing to a skipped section, as these sections cannot be found by bpf_object__find_prog_by_idx() in bpf_object__collect_reloc().
This is a general issue that also occurs for other sections, like debug sections which are also skipped and can have relo section.
As suggested by Daniel. To avoid keeping state about all skipped sections, instead perform a direct qlookup in the ELF object. Lookup the section that the relo-section points to and check if it contains executable machine instructions (denoted by the sh_flags SHF_EXECINSTR). Use this check to also skip irrelevant relo-sections.
Note, for samples/bpf/ the '-target bpf' parameter to clang cannot be used due to incompatibility with asm embedded headers, that some of the samples include. This is explained in more details by Yonghong Song in bpf_devel_QA.
--- tools/lib/bpf/libbpf.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
tools/lib/bpf/libbpf.c +26 -0
@@ -726,6 +726,24 @@ bpf_object__init_maps(struct bpf_object *obj)return 0 ; } +static bool section_have_execinstr (struct bpf_object *obj,int idx) +{ +Elf_Scn *scn; +GElf_Shdr sh; + + scn =elf_getscn (obj->efile.elf, idx); +if (!scn) +return false; + +if (gelf_getshdr (scn, &sh) != &sh) +return false; + +if (sh.sh_flags &SHF_EXECINSTR ) +return true; + +return false; +} +static int bpf_object__elf_collect (struct bpf_object *obj) {Elf *elf = obj->efile.elf;
@@ -807,6 +825,14 @@ static int bpf_object__elf_collect(struct bpf_object *obj) }else if (sh.sh_type ==SHT_REL ) {void *reloc = obj->efile.reloc;int nr_reloc = obj->efile.nr_reloc +1 ; +int sec = sh.sh_info;/* points to other section */ + +/* Only do relo for section with exec instructions */ +if (!section_have_execinstr (obj, sec)) { +pr_debug ("skip relo %s(%d) for section(%d)\n" , + name, idx, sec); +continue ; + } reloc =realloc (reloc,sizeof (*obj->efile.reloc) * nr_reloc);
Signature · 1 line
2.15.1
PATCH 176/189 SUNRPC: Don't call __UDPX_INC_STATS() from a preemptible context
In reply to Sasha LevinFrom: Trond Myklebust <[email protected]>
[ Upstream commit 0afa6b4412988019db14c6bfb8c6cbdf120ca9ad ]
Calling __UDPX_INC_STATS() from a preemptible context leads to a warning of the form:
BUG: using __this_cpu_add() in preemptible [00000000] code: kworker/u5:0/31 caller is xs_udp_data_receive_workfn+0x194/0x270 CPU: 1 PID: 31 Comm: kworker/u5:0 Not tainted 4.15.0-rc8-00076-g90ea9f1 #2 Workqueue: xprtiod xs_udp_data_receive_workfn Call Trace: dump_stack+0x85/0xc1 check_preemption_disabled+0xce/0xe0 xs_udp_data_receive_workfn+0x194/0x270 process_one_work+0x318/0x620 worker_thread+0x20a/0x390 ? process_one_work+0x620/0x620 kthread+0x120/0x130 ? __kthread_bind_mask+0x60/0x60 ret_from_fork+0x24/0x30
Since we're taking a spinlock in those functions anyway, let's fix the issue by moving the call so that it occurs under the spinlock.
--- net/sunrpc/xprtsock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/sunrpc/xprtsock.c +2 -2
@@ -1070,18 +1070,18 @@ static void xs_udp_data_read_skb(struct rpc_xprt *xprt,/* Suck it into the iovec, verify checksum if not done by hw. */ if (csum_partial_copy_to_xdr (&rovr->rq_private_buf, skb)) { -__UDPX_INC_STATS (sk,UDP_MIB_INERRORS );spin_lock (&xprt->recv_lock); +__UDPX_INC_STATS (sk,UDP_MIB_INERRORS ); goto out_unpin; } -__UDPX_INC_STATS (sk,UDP_MIB_INDATAGRAMS );spin_lock_bh (&xprt->transport_lock);xprt_adjust_cwnd (xprt, task, copied);spin_unlock_bh (&xprt->transport_lock);spin_lock (&xprt->recv_lock);xprt_complete_rqst (task, copied); +__UDPX_INC_STATS (sk,UDP_MIB_INDATAGRAMS ); out_unpin:xprt_unpin_rqst (rovr); out_unlock:
Signature · 1 line
2.15.1
PATCH 178/189 bpf: fix rlimit in reuseport net selftest
In reply to Sasha LevinFrom: Daniel Borkmann <[email protected]>
[ Upstream commit 941ff6f11c020913f5cddf543a9ec63475d7c082 ]
Fix two issues in the reuseport_bpf selftests that were reported by Linaro CI:
[...]
+ ./reuseport_bpf
---- IPv4 UDP ----
Testing EBPF mod 10...
Reprograming, testing mod 5...
./reuseport_bpf: ebpf error. log:
0: (bf) r6 = r1
1: (20) r0 = *(u32 *)skb[0]
2: (97) r0 %= 10
3: (95) exit
processed 4 insns
: Operation not permitted
+ echo FAIL
[...]
---- IPv4 TCP ----
Testing EBPF mod 10...
./reuseport_bpf: failed to bind send socket: Address already in use
+ echo FAIL
[...]
For the former adjust rlimit since this was the cause of failure for loading the BPF prog, and for the latter add SO_REUSEADDR.
--- tools/testing/selftests/net/reuseport_bpf.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
tools/testing/selftests/net/reuseport_bpf.c +20 -1
@@ -21,6 +21,7 @@#include <sys/epoll.h> #include <sys/types.h> #include <sys/socket.h> +#include <sys/resource.h> #include <unistd.h> #ifndef ARRAY_SIZE
@@ -190,11 +191,14 @@ static void send_from(struct test_params p, uint16_t sport, char *buf,struct sockaddr *const saddr =new_any_sockaddr (p.send_family, sport);struct sockaddr *const daddr =new_loopback_sockaddr (p.send_family, p.recv_port); -const int fd =socket (p.send_family, p.protocol,0 ); +const int fd =socket (p.send_family, p.protocol,0 ), one =1 ;if (fd <0 )error (1 , errno,"failed to create send socket" ); +if (setsockopt (fd,SOL_SOCKET ,SO_REUSEADDR , &one,sizeof (one))) +error (1 , errno,"failed to set reuseaddr" ); +if (bind (fd, saddr,sockaddr_size ()))error (1 , errno,"failed to bind send socket" );
@@ -433,6 +437,21 @@ void enable_fastopen(void) } } +static struct rlimit rlim_old, rlim_new; + +static __attribute__((constructor))void main_ctor (void ) +{ +getrlimit (RLIMIT_MEMLOCK , &rlim_old); + rlim_new.rlim_cur = rlim_old.rlim_cur + (1UL <<20 ); + rlim_new.rlim_max = rlim_old.rlim_max + (1UL <<20 ); +setrlimit (RLIMIT_MEMLOCK , &rlim_new); +} + +static __attribute__((destructor))void main_dtor (void ) +{ +setrlimit (RLIMIT_MEMLOCK , &rlim_old); +} +int main (void ) {fprintf (stderr,"---- IPv4 UDP ----\n" );
Signature · 1 line
2.15.1
PATCH 180/189 PM / wakeirq: Fix unbalanced IRQ enable for wakeirq
In reply to Sasha LevinFrom: Tony Lindgren <[email protected]>
[ Upstream commit 69728051f5bf15efaf6edfbcfe1b5a49a2437918 ]
If a device is runtime PM suspended when we enter suspend and has a dedicated wake IRQ, we can get the following warning:
WARNING: CPU: 0 PID: 108 at kernel/irq/manage.c:526 enable_irq+0x40/0x94 [ 102.087860] Unbalanced enable for IRQ 147
...
(enable_irq) from [<c06117a8>] (dev_pm_arm_wake_irq+0x4c/0x60) (dev_pm_arm_wake_irq) from [<c0618360>]
(device_wakeup_arm_wake_irqs+0x58/0x9c)
(device_wakeup_arm_wake_irqs) from [<c0615948>] (dpm_suspend_noirq+0x10/0x48)
(dpm_suspend_noirq) from [<c01ac7ac>] (suspend_devices_and_enter+0x30c/0xf14) (suspend_devices_and_enter) from [<c01adf20>] (enter_state+0xad4/0xbd8)
(enter_state) from [<c01ad3ec>] (pm_suspend+0x38/0x98) (pm_suspend) from [<c01ab3e8>] (state_store+0x68/0xc8)
This is because the dedicated wake IRQ for the device may have been already enabled earlier by dev_pm_enable_wake_irq_check(). Fix the issue by checking for runtime PM suspended status.
This issue can be easily reproduced by setting serial console log level to zero, letting the serial console idle, and suspend the system from an ssh terminal. On resume, dmesg will have the warning above.
The reason why I have not run into this issue earlier has been that I typically run my PM test cases from on a serial console instead over ssh.
--- drivers/base/power/wakeirq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/base/power/wakeirq.c +4 -2
@@ -323,7 +323,8 @@ void dev_pm_arm_wake_irq(struct wake_irq *wirq)return ;if (device_may_wakeup (wirq->dev)) { -if (wirq->status &WAKE_IRQ_DEDICATED_ALLOCATED ) +if (wirq->status &WAKE_IRQ_DEDICATED_ALLOCATED && + !pm_runtime_status_suspended (wirq->dev))enable_irq (wirq->irq);enable_irq_wake (wirq->irq);
@@ -345,7 +346,8 @@ void dev_pm_disarm_wake_irq(struct wake_irq *wirq)if (device_may_wakeup (wirq->dev)) {disable_irq_wake (wirq->irq); -if (wirq->status &WAKE_IRQ_DEDICATED_ALLOCATED ) +if (wirq->status &WAKE_IRQ_DEDICATED_ALLOCATED && + !pm_runtime_status_suspended (wirq->dev))disable_irq_nosync (wirq->irq); } }
Signature · 1 line
2.15.1
PATCH 183/189 x86/platform/UV: Fix GAM Range Table entries less than 1GB
In reply to Sasha LevinFrom: "[email protected]" <[email protected]>
[ Upstream commit c25d99d20ba69824a1e2cc118e04b877cd427afc ]
The latest UV platforms include the new ApachePass NVDIMMs into the UV address space. This has introduced address ranges in the Global Address Map Table that are less than the previous lowest range, which was 2GB. Fix the address calculation so it accommodates address ranges from bytes to exabytes.
--- arch/x86/kernel/apic/x2apic_uv_x.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
arch/x86/kernel/apic/x2apic_uv_x.c +12 -3
@@ -1174,16 +1174,25 @@ static void __init decode_gam_rng_tbl(unsigned long ptr) uv_gre_table = gre;for (; gre->type !=UV_GAM_RANGE_TYPE_UNUSED ; gre++) { +unsigned long size = ((unsigned long )(gre->limit - lgre) + <<UV_GAM_RANGE_SHFT ); +int order =0 ; +char suffix[] =" KMGTPE" ; + +while (size >9999 && order <sizeof (suffix)) { + size /=1024 ; + order++; + } +if (!index) {pr_info ("UV: GAM Range Table...\n" );pr_info ("UV: # %20s %14s %5s %4s %5s %3s %2s\n" ,"Range" ,"" ,"Size" ,"Type" ,"NASID" ,"SID" ,"PN" ); } -pr_info ("UV: %2d: 0x%014lx-0x%014lx %5luG %3d %04x %02x %02x\n" , +pr_info ("UV: %2d: 0x%014lx-0x%014lx %5lu%c %3d %04x %02x %02x\n" , index++, (unsigned long )lgre <<UV_GAM_RANGE_SHFT , (unsigned long )gre->limit <<UV_GAM_RANGE_SHFT , - ((unsigned long )(gre->limit - lgre)) >> - (30 -UV_GAM_RANGE_SHFT ),/* 64M -> 1G */ + size, suffix[order], gre->type, gre->nasid, gre->sockid, gre->pnode); lgre = gre->limit;
Signature · 1 line
2.15.1
PATCH 91/189 lkdtm: fix handle_irq_event symbol for INT_HW_IRQ_EN
In reply to Sasha LevinFrom: Ivan Delalande <[email protected]>
[ Upstream commit 5be2a5011c039506e2862650c928acfb2e3d7b9c ]
Function handle_IRQ_event was retired in v2.6.39 and replaced with handle_irq_event but nobody changed it in lkdtm so INT_HW_IRQ_EN has been broken for a while.
--- drivers/misc/lkdtm_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/lkdtm_core.c +1 -1
@@ -96,7 +96,7 @@ static struct crashpoint crashpoints[] = { CRASHPOINT("DIRECT", NULL),#ifdef CONFIG_KPROBES CRASHPOINT ("INT_HARDWARE_ENTRY" ,"do_IRQ" ), -CRASHPOINT ("INT_HW_IRQ_EN" ,"handle_IRQ_event" ), +CRASHPOINT ("INT_HW_IRQ_EN" ,"handle_irq_event" ),CRASHPOINT ("INT_TASKLET_ENTRY" ,"tasklet_action" ),CRASHPOINT ("FS_DEVRW" ,"ll_rw_block" ), CRASHPOINT("MEM_SWAPOUT", "shrink_inactive_list"),
Signature · 1 line
2.15.1
PATCH 187/189 irqchip/gic-v3: Ignore disabled ITS nodes
In reply to Sasha LevinFrom: Stephen Boyd <[email protected]>
[ Upstream commit 95a2562590c2f64a0398183f978d5cf3db6d0284 ]
On some platforms there's an ITS available but it's not enabled because reading or writing the registers is denied by the firmware. In fact, reading or writing them will cause the system to reset. We could remove the node from DT in such a case, but it's better to skip nodes that are marked as "disabled" in DT so that we can describe the hardware that exists and use the status property to indicate how the firmware has configured things.
--- drivers/irqchip/irq-gic-v3-its-pci-msi.c | 2 ++ drivers/irqchip/irq-gic-v3-its-platform-msi.c | 2 ++ drivers/irqchip/irq-gic-v3-its.c | 2 ++ drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 2 ++ 4 files changed, 8 insertions(+)
drivers/irqchip/irq-gic-v3-its-pci-msi.c +2 -0
@@ -132,6 +132,8 @@ static int __init its_pci_of_msi_init(void)for (np =of_find_matching_node (NULL , its_device_id); np; np =of_find_matching_node (np, its_device_id)) { +if (!of_device_is_available (np)) +continue ;if (!of_property_read_bool (np,"msi-controller" ))continue ;
drivers/irqchip/irq-gic-v3-its-platform-msi.c +2 -0
@@ -154,6 +154,8 @@ static void __init its_pmsi_of_init(void)for (np =of_find_matching_node (NULL , its_device_id); np; np =of_find_matching_node (np, its_device_id)) { +if (!of_device_is_available (np)) +continue ;if (!of_property_read_bool (np,"msi-controller" ))continue ;
drivers/irqchip/irq-gic-v3-its.c +2 -0
@@ -3313,6 +3313,8 @@ static int __init its_of_probe(struct device_node *node)for (np =of_find_matching_node (node, its_device_id); np; np =of_find_matching_node (np, its_device_id)) { +if (!of_device_is_available (np)) +continue ;if (!of_property_read_bool (np,"msi-controller" )) {pr_warn ("%pOF: no msi-controller property, ITS ignored\n" , np);
drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c +2 -0
@@ -75,6 +75,8 @@ int __init its_fsl_mc_msi_init(void)for (np =of_find_matching_node (NULL , its_device_id); np; np =of_find_matching_node (np, its_device_id)) { +if (!of_device_is_available (np)) +continue ;if (!of_property_read_bool (np,"msi-controller" ))continue ;
Signature · 1 line
2.15.1
PATCH 94/189 crypto: artpec6 - remove select on non-existing CRYPTO_SHA384
In reply to Sasha LevinFrom: Corentin LABBE <[email protected]>
[ Upstream commit 980b4c95e78e4113cb7b9f430f121dab1c814b6c ]
Since CRYPTO_SHA384 does not exists, Kconfig should not select it. Anyway, all SHA384 stuff is in CRYPTO_SHA512 which is already selected.
--- drivers/crypto/Kconfig | 1 - 1 file changed, 1 deletion(-)
drivers/crypto/Kconfig +0 -1
@@ -723,7 +723,6 @@ config CRYPTO_DEV_ARTPEC6 select CRYPTO_HASH select CRYPTO_SHA1 select CRYPTO_SHA256 - select CRYPTO_SHA384 select CRYPTO_SHA512 help Enables the driver for the on-chip crypto accelerator
Signature · 1 line
2.15.1
PATCH 95/189 RDMA/uverbs: Use an unambiguous errno for method not supported
In reply to Sasha LevinFrom: Jason Gunthorpe <[email protected]>
[ Upstream commit 3624a8f02568f08aef299d3b117f2226f621177d ]
Returning EOPNOTSUPP is problematic because it can also be returned by the method function, and we use it in quite a few places in drivers these days.
Instead, dedicate EPROTONOSUPPORT to indicate that the ioctl framework is enabled but the requested object and method are not supported by the kernel. No other case will return this code, and it lets userspace know to fall back to write().
grep says we do not use it today in drivers/infiniband subsystem.
--- drivers/infiniband/core/uverbs_ioctl.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/infiniband/core/uverbs_ioctl.c +13 -6
@@ -243,16 +243,13 @@ static long ib_uverbs_cmd_verbs(struct ib_device *ib_dev,size_t ctx_size;uintptr_t data[UVERBS_OPTIMIZE_USING_STACK_SZ /sizeof (uintptr_t )]; -if (hdr->reserved) -return -EINVAL ; - object_spec =uverbs_get_object (ib_dev, hdr->object_id);if (!object_spec) -return -EOPNOTSUPP ; +return -EPROTONOSUPPORT ; method_spec =uverbs_get_method (object_spec, hdr->method_id);if (!method_spec) -return -EOPNOTSUPP ; +return -EPROTONOSUPPORT ;if ((method_spec->flags &UVERBS_ACTION_FLAG_CREATE_ROOT ) ^ !file->ucontext)return -EINVAL ;
@@ -305,6 +302,16 @@ static long ib_uverbs_cmd_verbs(struct ib_device *ib_dev, err =uverbs_handle_method (buf, ctx->uattrs, hdr->num_attrs, ib_dev, file, method_spec, ctx->uverbs_attr_bundle); + +/* +* EPROTONOSUPPORT is ONLY to be returned if the ioctl framework can +* not invoke the method because the request is not supported. No +* other cases should return this code. +*/ +if (unlikely (err == -EPROTONOSUPPORT )) { +WARN_ON_ONCE (err == -EPROTONOSUPPORT ); + err = -EINVAL ; + } out:if (ctx != (void *)data)kfree (ctx);
@@ -341,7 +348,7 @@ long ib_uverbs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) }if (hdr.reserved) { - err = -EOPNOTSUPP ; + err = -EPROTONOSUPPORT ; goto out; }
Signature · 1 line
2.15.1
PATCH 97/189 ixgbe: don't set RXDCTL.RLPML for 82599
In reply to Sasha LevinFrom: Emil Tantilov <[email protected]>
[ Upstream commit 2bafa8fac19a31ca72ae1a3e48df35f73661dbed ]
commit 2de6aa3a666e ("ixgbe: Add support for padding packet")
Uses RXDCTL.RLPML to limit the maximum frame size on Rx when using build_skb. Unfortunately that register does not work on 82599.
Added an explicit check to avoid setting this register on 82599 MAC.
Extended the comment related to the setting of RXDCTL.RLPML to better explain its purpose.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +6 -2
@@ -4120,11 +4120,15 @@ void ixgbe_configure_rx_ring(struct ixgbe_adapter *adapter, rxdctl &= ~0x3FFFFF ; rxdctl |=0x080420 ;#if (PAGE_SIZE <8192 ) - } else { + /* RXDCTL.RLPML does not work on 82599 */ + }else if (hw->mac.type != ixgbe_mac_82599EB) { rxdctl &= ~(IXGBE_RXDCTL_RLPMLMASK |IXGBE_RXDCTL_RLPML_EN ); -/* Limit the maximum frame size so we don't overrun the skb */ +/* Limit the maximum frame size so we don't overrun the skb. +* This can happen in SRIOV mode when the MTU of the VF is +* higher than the MTU of the PF. +*/ if (ring_uses_build_skb (ring) && !test_bit (__IXGBE_RX_3K_BUFFER, &ring->state)) rxdctl |= IXGBE_MAX_2K_FRAME_BUILD_SKB |
Signature · 1 line
2.15.1
PATCH 98/189 i40e: program fragmented IPv4 filter input set
In reply to Sasha LevinFrom: Jacob Keller <[email protected]>
[ Upstream commit 02b4016bfe43d2d5ed043be7ffa56cda6a4d1100 ]
When implementing support for IP_USER_FLOW filters, we correctly programmed a filter for both the non fragmented IPv4/Other filter, as well as the fragmented IPv4 filters. However, we did not properly program the input set for fragmented IPv4 PCTYPE. This meant that the filters would almost certainly not match, unless the user specified all of the flow types.
Add support to program the fragmented IPv4 filter input set. Since we always program these filters together, we'll assume that the two input sets must match, and will thus always program the input sets to the same value.
--- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 10 ++++++++++ drivers/net/ethernet/intel/i40e/i40e_main.c | 3 +++ 2 files changed, 13 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +10 -0
@@ -3800,6 +3800,16 @@ static int i40e_check_fdir_input_set(struct i40e_vsi *vsi,i40e_write_fd_input_set (pf, index, new_mask); +/* IP_USER_FLOW filters match both IPv4/Other and IPv4/Fragmented +* frames. If we're programming the input set for IPv4/Other, we also +* need to program the IPv4/Fragmented input set. Since we don't have +* separate support, we'll always assume and enforce that the two flow +* types must have matching input sets. +*/ +if (index ==I40E_FILTER_PCTYPE_NONF_IPV4_OTHER ) +i40e_write_fd_input_set (pf,I40E_FILTER_PCTYPE_FRAG_IPV4 , + new_mask); +/* Add the new offset and update table, if necessary */ if (new_flex_offset) { err = i40e_add_flex_offset(&pf->l4_flex_pit_list, src_offset,
drivers/net/ethernet/intel/i40e/i40e_main.c +3 -0
@@ -7744,6 +7744,9 @@ static void i40e_fdir_filter_exit(struct i40e_pf *pf)/* Reprogram the default input set for Other/IPv4 */ i40e_write_fd_input_set (pf,I40E_FILTER_PCTYPE_NONF_IPV4_OTHER ,I40E_L3_SRC_MASK |I40E_L3_DST_MASK ); + +i40e_write_fd_input_set (pf,I40E_FILTER_PCTYPE_FRAG_IPV4 , +I40E_L3_SRC_MASK |I40E_L3_DST_MASK ); }/**
Signature · 1 line
2.15.1
PATCH 99/189 i40e: fix reported mask for ntuple filters
In reply to Sasha LevinFrom: Jacob Keller <[email protected]>
[ Upstream commit 40339af33c703bacb336493157d43c86a8bf2fed ]
In commit 36777d9fa24c ("i40e: check current configured input set when adding ntuple filters") some code was added to report the input set mask for a given filter when reporting it to the user.
This code is necessary so that the reported filter correctly displays that it is or is not masking certain fields.
Unfortunately the code was incorrect. Development error accidentally swapped the mask values for the IPv4 addresses with the L4 port numbers. The port numbers are only 16bits wide while IPv4 addresses are 32 bits. Unfortunately we assigned only 16 bits to the IPv4 address masks. Additionally we assigned 32bit value 0xFFFFFFF to the TCP port numbers. This second part does not matter as the value would be truncated to 16bits regardless, but it is unnecessary.
Fix the reported masks to properly report that the entire field is masked.
--- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +4 -4
@@ -2740,16 +2740,16 @@ static int i40e_get_ethtool_fdir_entry(struct i40e_pf *pf, no_input_set:if (input_set &I40E_L3_SRC_MASK ) - fsp->m_u.tcp_ip4_spec.ip4src =htonl (0xFFFF ); + fsp->m_u.tcp_ip4_spec.ip4src =htonl (0xFFFFFFFF );if (input_set &I40E_L3_DST_MASK ) - fsp->m_u.tcp_ip4_spec.ip4dst =htonl (0xFFFF ); + fsp->m_u.tcp_ip4_spec.ip4dst =htonl (0xFFFFFFFF );if (input_set &I40E_L4_SRC_MASK ) - fsp->m_u.tcp_ip4_spec.psrc =htons (0xFFFFFFFF ); + fsp->m_u.tcp_ip4_spec.psrc =htons (0xFFFF );if (input_set &I40E_L4_DST_MASK ) - fsp->m_u.tcp_ip4_spec.pdst =htons (0xFFFFFFFF ); + fsp->m_u.tcp_ip4_spec.pdst =htons (0xFFFF );if (rule->dest_ctl ==I40E_FILTER_PROGRAM_DESC_DEST_DROP_PACKET ) fsp->ring_cookie =RX_CLS_FLOW_DISC ;
Signature · 1 line
2.15.1
PATCH 100/189 samples/bpf: Partially fixes the bpf.o build
In reply to Sasha LevinFrom: Mickaël Salaün <[email protected]>
[ Upstream commit c25ef6a5e62fa212d298ce24995ce239f29b5f96 ]
Do not build lib/bpf/bpf.o with this Makefile but use the one from the library directory. This avoid making a buggy bpf.o file (e.g. missing symbols).
This patch is useful if some code (e.g. Landlock tests) needs both the bpf.o (from tools/lib/bpf) and the bpf_load.o (from samples/bpf).
--- samples/bpf/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
samples/bpf/Makefile +4 -1
@@ -192,13 +192,16 @@ CLANG_ARCH_ARGS = -target $(ARCH) endif # Trick to allow make to be run from this directory -all: +all: $(LIBBPF) $(MAKE) -C ../../ $(CURDIR)/ clean: $(MAKE) -C ../../ M=$(CURDIR) clean @rm -f *~ +$(LIBBPF): FORCE + $(MAKE) -C $(dir $@) $(notdir $@) + $(obj)/syscall_nrs.s: $(src)/syscall_nrs.c $(call if_changed_dep,cc_s_c)
Signature · 1 line
2.15.1
PATCH 102/189 powerpc/numa: Ensure nodes initialized for hotplug
In reply to Sasha LevinFrom: Michael Bringmann <[email protected]>
[ Upstream commit ea05ba7c559c8e5a5946c3a94a2a266e9a6680a6 ]
This patch fixes some problems encountered at runtime with configurations that support memory-less nodes, or that hot-add CPUs into nodes that are memoryless during system execution after boot. The problems of interest include:
* Nodes known to powerpc to be memoryless at boot, but to have CPUs in them are allowed to be 'possible' and 'online'. Memory allocations for those nodes are taken from another node that does have memory until and if memory is hot-added to the node.
* Nodes which have no resources assigned at boot, but which may still be referenced subsequently by affinity or associativity attributes, are kept in the list of 'possible' nodes for powerpc. Hot-add of memory or CPUs to the system can reference these nodes and bring them online instead of redirecting the references to one of the set of nodes known to have memory at boot.
Note that this software operates under the context of CPU hotplug. We are not doing memory hotplug in this code, but rather updating the kernel's CPU topology (i.e. arch_update_cpu_topology / numa_update_cpu_topology). We are initializing a node that may be used by CPUs or memory before it can be referenced as invalid by a CPU hotplug operation. CPU hotplug operations are protected by a range of APIs including cpu_maps_update_begin/cpu_maps_update_done, cpus_read/write_lock / cpus_read/write_unlock, device locks, and more. Memory hotplug operations, including try_online_node, are protected by mem_hotplug_begin/mem_hotplug_done, device locks, and more. In the case of CPUs being hot-added to a previously memoryless node, the try_online_node operation occurs wholly within the CPU locks with no overlap. Using HMC hot-add/hot-remove operations, we have been able to add and remove CPUs to any possible node without failures. HMC operations involve a degree self-serialization, though.
--- arch/powerpc/mm/numa.c | 47 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 10 deletions(-)
arch/powerpc/mm/numa.c +37 -10
@@ -546,7 +546,7 @@ static int numa_setup_cpu(unsigned long lcpu) nid =of_node_to_nid_single (cpu); out_present: -if (nid <0 || !node_online (nid)) +if (nid <0 || !node_possible (nid)) nid = first_online_node;map_cpu_to_node (lcpu, nid);
@@ -905,10 +905,8 @@ static void __init find_possible_nodes(void) goto out;for (i =0 ; i < numnodes; i++) { -if (!node_possible (i)) { -setup_node_data (i,0 ,0 ); +if (!node_possible (i))node_set (i, node_possible_map); - } } out:
@@ -1304,6 +1302,40 @@ static long vphn_get_associativity(unsigned long cpu,return rc; } +static inline int find_and_online_cpu_nid (int cpu) +{ +__be32 associativity[VPHN_ASSOC_BUFSIZE ] = {0 }; +int new_nid; + +/* Use associativity from first thread for all siblings */ +vphn_get_associativity (cpu, associativity); + new_nid =associativity_to_nid (associativity); +if (new_nid <0 || !node_possible (new_nid)) + new_nid = first_online_node; + +if (NODE_DATA (new_nid) ==NULL ) { +#ifdef CONFIG_MEMORY_HOTPLUG +/* +* Need to ensure that NODE_DATA is initialized for a node from +* available memory (see memblock_alloc_try_nid). If unable to +* init the node, then default to nearest node that has memory +* installed. +*/ +if (try_online_node (new_nid)) + new_nid = first_online_node; +#else +/* +* Default to using the nearest node that has memory installed. +* Otherwise, it would be necessary to patch the kernel MM code +* to deal with more memoryless-node error conditions. +*/ + new_nid = first_online_node; +#endif + } + +return new_nid; +} +/* * Update the CPU maps and sysfs entries for a single CPU when its NUMA * characteristics change. This function doesn't perform any locking and is
@@ -1371,7 +1403,6 @@ int numa_update_cpu_topology(bool cpus_locked) {unsigned int cpu, sibling, changed =0 ;struct topology_update_data *updates, *ud; -__be32 associativity[VPHN_ASSOC_BUFSIZE ] = {0 };cpumask_t updated_cpus;struct device *dev;int weight, new_nid, i =0 ;
@@ -1409,11 +1440,7 @@ int numa_update_cpu_topology(bool cpus_locked)continue ; } -/* Use associativity from first thread for all siblings */ -vphn_get_associativity (cpu, associativity); - new_nid =associativity_to_nid (associativity); -if (new_nid <0 || !node_online (new_nid)) - new_nid = first_online_node; + new_nid =find_and_online_cpu_nid (cpu);if (new_nid == numa_cpu_lookup_table[cpu]) { cpumask_andnot(&cpu_associativity_changes_mask,
Signature · 1 line
2.15.1
PATCH 103/189 RDMA/mlx5: Avoid memory leak in case of XRCD dealloc failure
In reply to Sasha LevinFrom: Leon Romanovsky <[email protected]>
[ Upstream commit b081808a66345ba725b77ecd8d759bee874cd937 ]
Failure in XRCD FW deallocation command leaves memory leaked and returns error to the user which he can't do anything about it.
This patch changes behavior to always free memory and always return success to the user.
--- drivers/infiniband/hw/mlx5/qp.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/infiniband/hw/mlx5/qp.c +1 -4
@@ -4694,13 +4694,10 @@ int mlx5_ib_dealloc_xrcd(struct ib_xrcd *xrcd)int err; err =mlx5_core_xrcd_dealloc (dev->mdev, xrcdn); -if (err) { +if (err)mlx5_ib_warn (dev,"failed to dealloc xrcdn 0x%x\n" , xrcdn); -return err; - }kfree (xrcd); -return 0 ; }
Signature · 1 line
2.15.1
PATCH 111/189 netfilter: x_tables: fix pointer leaks to userspace
In reply to Sasha LevinFrom: Dmitry Vyukov <[email protected]>
[ Upstream commit 1e98ffea5a8935ec040ab72299e349cb44b8defd ]
Several netfilter matches and targets put kernel pointers into info objects, but don't set usersize in descriptors. This leads to kernel pointer leaks if a match/target is set and then read back to userspace.
Properly set usersize for these matches/targets.
Found with manual code inspection.
--- net/netfilter/xt_IDLETIMER.c | 1 + net/netfilter/xt_LED.c | 1 + net/netfilter/xt_limit.c | 3 +-- net/netfilter/xt_nfacct.c | 1 + net/netfilter/xt_statistic.c | 1 + 5 files changed, 5 insertions(+), 2 deletions(-)
net/netfilter/xt_IDLETIMER.c +1 -0
@@ -255,6 +255,7 @@ static struct xt_target idletimer_tg __read_mostly = { .family = NFPROTO_UNSPEC, .target = idletimer_tg_target, .targetsize = sizeof(struct idletimer_tg_info), + .usersize = offsetof(struct idletimer_tg_info, timer), .checkentry = idletimer_tg_checkentry, .destroy = idletimer_tg_destroy, .me = THIS_MODULE,
net/netfilter/xt_LED.c +1 -0
@@ -198,6 +198,7 @@ static struct xt_target led_tg_reg __read_mostly = { .family = NFPROTO_UNSPEC, .target = led_tg, .targetsize = sizeof(struct xt_led_info), + .usersize = offsetof(struct xt_led_info, internal_data), .checkentry = led_tg_check, .destroy = led_tg_destroy, .me = THIS_MODULE,
net/netfilter/xt_limit.c +1 -2
@@ -193,9 +193,8 @@ static struct xt_match limit_mt_reg __read_mostly = { .compatsize = sizeof(struct compat_xt_rateinfo), .compat_from_user = limit_mt_compat_from_user, .compat_to_user = limit_mt_compat_to_user, -#else - .usersize = offsetof(struct xt_rateinfo, prev), #endif + .usersize = offsetof(struct xt_rateinfo, prev), .me = THIS_MODULE, };
net/netfilter/xt_nfacct.c +1 -0
@@ -62,6 +62,7 @@ static struct xt_match nfacct_mt_reg __read_mostly = { .match = nfacct_mt, .destroy = nfacct_mt_destroy, .matchsize = sizeof(struct xt_nfacct_match_info), + .usersize = offsetof(struct xt_nfacct_match_info, nfacct), .me = THIS_MODULE, };
net/netfilter/xt_statistic.c +1 -0
@@ -84,6 +84,7 @@ static struct xt_match xt_statistic_mt_reg __read_mostly = { .checkentry = statistic_mt_check, .destroy = statistic_mt_destroy, .matchsize = sizeof(struct xt_statistic_info), + .usersize = offsetof(struct xt_statistic_info, master), .me = THIS_MODULE, };
Signature · 1 line
2.15.1
PATCH 105/189 ntb_transport: Fix bug with max_mw_size parameter
In reply to Sasha LevinFrom: Logan Gunthorpe <[email protected]>
[ Upstream commit cbd27448faff4843ac4b66cc71445a10623ff48d ]
When using the max_mw_size parameter of ntb_transport to limit the size of the Memory windows, communication cannot be established and the queues freeze.
This is because the mw_size that's reported to the peer is correctly limited but the size used locally is not. So the MW is initialized with a buffer smaller than the window but the TX side is using the full window. This means the TX side will be writing to a region of the window that points nowhere.
This is easily fixed by applying the same limit to tx_size in ntb_transport_init_queue().
--- drivers/ntb/ntb_transport.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/ntb/ntb_transport.c +3 -0
@@ -1003,6 +1003,9 @@ static int ntb_transport_init_queue(struct ntb_transport_ctx *nt, mw_base = nt->mw_vec[mw_num].phys_addr; mw_size = nt->mw_vec[mw_num].phys_size; +if (max_mw_size && mw_size > max_mw_size) + mw_size = max_mw_size; + tx_size = (unsigned int )mw_size / num_qps_mw; qp_offset = tx_size * (qp_num / mw_count);
Signature · 1 line
2.15.1
PATCH 107/189 gianfar: prevent integer wrapping in the rx handler
In reply to Sasha LevinFrom: Andy Spencer <[email protected]>
[ Upstream commit 202a0a70e445caee1d0ec7aae814e64b1189fa4d ]
When the frame check sequence (FCS) is split across the last two frames of a fragmented packet, part of the FCS gets counted twice, once when subtracting the FCS, and again when subtracting the previously received data.
For example, if 1602 bytes are received, and the first fragment contains the first 1600 bytes (including the first two bytes of the FCS), and the second fragment contains the last two bytes of the FCS:
'skb->len == 1600' from the first fragment
size = lstatus & BD_LENGTH_MASK; # 1602
size -= ETH_FCS_LEN; # 1598
size -= skb->len; # -2
Since the size is unsigned, it wraps around and causes a BUG later in the packet handling, as shown below:
kernel BUG at ./include/linux/skbuff.h:2068!
Oops: Exception in kernel mode, sig: 5 [#1] ... NIP [c021ec60] skb_pull+0x24/0x44 LR [c01e2fbc] gfar_clean_rx_ring+0x498/0x690 Call Trace: [df7edeb0] [c01e2c1c] gfar_clean_rx_ring+0xf8/0x690 (unreliable) [df7edf20] [c01e33a8] gfar_poll_rx_sq+0x3c/0x9c [df7edf40] [c023352c] net_rx_action+0x21c/0x274 [df7edf90] [c0329000] __do_softirq+0xd8/0x240 [df7edff0] [c000c108] call_do_irq+0x24/0x3c [c0597e90] [c00041dc] do_IRQ+0x64/0xc4 [c0597eb0] [c000d920] ret_from_except+0x0/0x18 --- interrupt: 501 at arch_cpu_idle+0x24/0x5c
Change the size to a signed integer and then trim off any part of the FCS that was received prior to the last fragment.
--- drivers/net/ethernet/freescale/gianfar.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/ethernet/freescale/gianfar.c +7 -2
@@ -2932,7 +2932,7 @@ static irqreturn_t gfar_transmit(int irq, void *grp_id)static bool gfar_add_rx_frag (struct gfar_rx_buff *rxb,u32 lstatus,struct sk_buff *skb,bool first) { -unsigned int size = lstatus &BD_LENGTH_MASK ; +int size = lstatus &BD_LENGTH_MASK ;struct page *page = rxb->page;bool last = !!(lstatus &BD_LFLAG (RXBD_LAST ));
@@ -2947,11 +2947,16 @@ static bool gfar_add_rx_frag(struct gfar_rx_buff *rxb, u32 lstatus,if (last) size -= skb->len; -/* in case the last fragment consisted only of the FCS */ +/* Add the last fragment if it contains something other than +* the FCS, otherwise drop it and trim off any part of the FCS +* that was already received. +*/ if (size >0 )skb_add_rx_frag (skb,skb_shinfo (skb)->nr_frags, page, rxb->page_offset +RXBUF_ALIGNMENT , size,GFAR_RXB_TRUESIZE ); +else if (size <0 ) +pskb_trim (skb, skb->len + size); }/* try reuse page */
Signature · 1 line
2.15.1
PATCH 112/189 tcp_nv: fix potential integer overflow in tcpnv_acked
In reply to Sasha LevinFrom: "Gustavo A. R. Silva" <[email protected]>
[ Upstream commit e4823fbd229bfbba368b40cdadb8f4eeb20604cc ]
Add suffix ULL to constant 80000 in order to avoid a potential integer overflow and give the compiler complete information about the proper arithmetic to use. Notice that this constant is used in a context that expects an expression of type u64.
The current cast to u64 effectively applies to the whole expression as an argument of type u64 to be passed to div64_u64, but it does not prevent it from being evaluated using 32-bit arithmetic instead of 64-bit arithmetic.
Also, once the expression is properly evaluated using 64-bit arithmentic, there is no need for the parentheses and the external cast to u64.
Addresses-Coverity-ID: 1357588 ("Unintentional integer overflow")
--- net/ipv4/tcp_nv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_nv.c +1 -1
@@ -364,7 +364,7 @@ static void tcpnv_acked(struct sock *sk, const struct ack_sample *sample)*/ cwnd_by_slope = (u32 )div64_u64 (((u64 )ca->nv_rtt_max_rate) * ca->nv_min_rtt, - (u64)(80000 * tp->mss_cache)); +80000ULL * tp->mss_cache); max_win = cwnd_by_slope + nv_pad;/* If cwnd > max_win, decrease cwnd
Signature · 1 line
2.15.1
PATCH 108/189 ibmvnic: Wait for device response when changing MAC
In reply to Sasha LevinFrom: Thomas Falcon <[email protected]>
[ Upstream commit f813614f531114db796ad66ced75c5dc8db7aa3a ]
Wait for a response from the VNIC server before exiting after setting the MAC address. The resolves an issue with bonding a VNIC client in ALB or TLB modes. The bonding driver was changing the MAC address more rapidly than the device could respond, causing the following errors.
"bond0: the hw address of slave eth2 is in use by the bond; couldn't find a slave with a free hw address to give it (this should not have happened)"
If the function waits until the change is finalized, these errors are avoided.
--- drivers/net/ethernet/ibm/ibmvnic.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +14 -7
@@ -1543,15 +1543,19 @@ static int __ibmvnic_set_mac(struct net_device *netdev, struct sockaddr *p) crq.change_mac_addr.first =IBMVNIC_CRQ_CMD ; crq.change_mac_addr.cmd =CHANGE_MAC_ADDR ;ether_addr_copy (&crq.change_mac_addr.mac_addr[0 ], addr->sa_data); + +init_completion (&adapter->fw_done);ibmvnic_send_crq (adapter, &crq); +wait_for_completion (&adapter->fw_done);/* netdev->dev_addr is changed in handle_change_mac_rsp function */ -return 0 ; +return adapter->fw_done_rc ? -EIO :0 ; }static int ibmvnic_set_mac (struct net_device *netdev,void *p) {struct ibmvnic_adapter *adapter =netdev_priv (netdev);struct sockaddr *addr = p; +int rc;if (adapter->state ==VNIC_PROBED ) {memcpy (&adapter->desired.mac, addr,sizeof (struct sockaddr ));
@@ -1559,9 +1563,9 @@ static int ibmvnic_set_mac(struct net_device *netdev, void *p)return 0 ; } -__ibmvnic_set_mac (netdev, addr); + rc =__ibmvnic_set_mac (netdev, addr); -return 0 ; +return rc; }/**
@@ -3558,8 +3562,8 @@ static void handle_error_indication(union ibmvnic_crq *crq,ibmvnic_reset (adapter,VNIC_RESET_NON_FATAL ); } -static void handle_change_mac_rsp (union ibmvnic_crq *crq, -struct ibmvnic_adapter *adapter) +static int handle_change_mac_rsp (union ibmvnic_crq *crq, +struct ibmvnic_adapter *adapter) {struct net_device *netdev = adapter->netdev;struct device *dev = &adapter->vdev->dev;
@@ -3568,10 +3572,13 @@ static void handle_change_mac_rsp(union ibmvnic_crq *crq, rc = crq->change_mac_addr_rsp.rc.code;if (rc) {dev_err (dev,"Error %ld in CHANGE_MAC_ADDR_RSP\n" , rc); -return ; + goto out; }memcpy (netdev->dev_addr, &crq->change_mac_addr_rsp.mac_addr[0 ],ETH_ALEN ); +out: +complete (&adapter->fw_done); +return rc; } static void handle_request_cap_rsp(union ibmvnic_crq *crq,
@@ -4031,7 +4038,7 @@ static void ibmvnic_handle_crq(union ibmvnic_crq *crq,break ;case CHANGE_MAC_ADDR_RSP :netdev_dbg (netdev,"Got MAC address change Response\n" ); -handle_change_mac_rsp (crq, adapter); + adapter->fw_done_rc =handle_change_mac_rsp (crq, adapter);break ;case ERROR_INDICATION :netdev_dbg (netdev,"Got Error Indication\n" );
Signature · 1 line
2.15.1
PATCH 114/189 x86/kvm/vmx: do not use vm-exit instruction length for fast MMIO when running nested
In reply to Sasha LevinFrom: Vitaly Kuznetsov <[email protected]>
[ Upstream commit d391f1207067268261add0485f0f34503539c5b0 ]
I was investigating an issue with seabios >= 1.10 which stopped working for nested KVM on Hyper-V. The problem appears to be in handle_ept_violation() function: when we do fast mmio we need to skip the instruction so we do kvm_skip_emulated_instruction(). This, however, depends on VM_EXIT_INSTRUCTION_LEN field being set correctly in VMCS. However, this is not the case.
Intel's manual doesn't mandate VM_EXIT_INSTRUCTION_LEN to be set when EPT MISCONFIG occurs. While on real hardware it was observed to be set, some hypervisors follow the spec and don't set it; we end up advancing IP with some random value.
I checked with Microsoft and they confirmed they don't fill VM_EXIT_INSTRUCTION_LEN on EPT MISCONFIG.
Fix the issue by doing instruction skip through emulator when running nested.
--- arch/x86/kvm/vmx.c | 16 +++++++++++++++- arch/x86/kvm/x86.c | 3 ++- 2 files changed, 17 insertions(+), 2 deletions(-)
arch/x86/kvm/vmx.c +15 -1
@@ -6769,7 +6769,21 @@ static int handle_ept_misconfig(struct kvm_vcpu *vcpu)if (!is_guest_mode (vcpu) && !kvm_io_bus_write (vcpu,KVM_FAST_MMIO_BUS , gpa,0 ,NULL )) {trace_kvm_fast_mmio (gpa); -return kvm_skip_emulated_instruction (vcpu); +/* +* Doing kvm_skip_emulated_instruction() depends on undefined +* behavior: Intel's manual doesn't mandate +* VM_EXIT_INSTRUCTION_LEN to be set in VMCS when EPT MISCONFIG +* occurs and while on real hardware it was observed to be set, +* other hypervisors (namely Hyper-V) don't set it, we end up +* advancing IP with some random value. Disable fast mmio when +* running nested and keep it for real hardware in hope that +* VM_EXIT_INSTRUCTION_LEN will always be set correctly. +*/ +if (!static_cpu_has (X86_FEATURE_HYPERVISOR )) +return kvm_skip_emulated_instruction (vcpu); +else +return x86_emulate_instruction (vcpu, gpa,EMULTYPE_SKIP , +NULL ,0 ) ==EMULATE_DONE ; } ret =kvm_mmu_page_fault (vcpu, gpa,PFERR_RSVD_MASK ,NULL ,0 );
arch/x86/kvm/x86.c +2 -1
@@ -5711,7 +5711,8 @@ int x86_emulate_instruction(struct kvm_vcpu *vcpu,* handle watchpoints yet, those would be handled in * the emulate_ops. */ -if (kvm_vcpu_check_breakpoint (vcpu, &r)) +if (!(emulation_type &EMULTYPE_SKIP ) && +kvm_vcpu_check_breakpoint (vcpu, &r))return r; ctxt->interruptibility =0 ;
Signature · 1 line
2.15.1
PATCH 117/189 ocfs2/acl: use 'ip_xattr_sem' to protect getting extended attribute
In reply to Sasha LevinFrom: piaojun <[email protected]>
[ Upstream commit 16c8d569f5704a84164f30ff01b29879f3438065 ]
The race between *set_acl and *get_acl will cause getting incomplete xattr data as below:
processA processB
ocfs2_set_acl
ocfs2_xattr_set
__ocfs2_xattr_set_handle
ocfs2_get_acl_nolock
ocfs2_xattr_get_nolock:
processB may get incomplete xattr data if processA hasn't set_acl done.
So we should use 'ip_xattr_sem' to protect getting extended attribute in ocfs2_get_acl_nolock(), as other processes could be changing it concurrently.
--- fs/ocfs2/acl.c | 6 ++++++ fs/ocfs2/xattr.c | 2 ++ 2 files changed, 8 insertions(+)
fs/ocfs2/acl.c +6 -0
@@ -311,7 +311,9 @@ struct posix_acl *ocfs2_iop_get_acl(struct inode *inode, int type)if (had_lock <0 )return ERR_PTR (had_lock); +down_read (&OCFS2_I (inode)->ip_xattr_sem); acl =ocfs2_get_acl_nolock (inode, type, di_bh); +up_read (&OCFS2_I (inode)->ip_xattr_sem);ocfs2_inode_unlock_tracker (inode,0 , &oh, had_lock);brelse (di_bh);
@@ -330,7 +332,9 @@ int ocfs2_acl_chmod(struct inode *inode, struct buffer_head *bh)if (!(osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL ))return 0 ; +down_read (&OCFS2_I (inode)->ip_xattr_sem); acl =ocfs2_get_acl_nolock (inode,ACL_TYPE_ACCESS , bh); +up_read (&OCFS2_I (inode)->ip_xattr_sem);if (IS_ERR (acl) || !acl)return PTR_ERR (acl); ret =__posix_acl_chmod (&acl,GFP_KERNEL , inode->i_mode);
@@ -361,8 +365,10 @@ int ocfs2_init_acl(handle_t *handle,if (!S_ISLNK (inode->i_mode)) {if (osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL ) { +down_read (&OCFS2_I (dir)->ip_xattr_sem); acl =ocfs2_get_acl_nolock (dir,ACL_TYPE_DEFAULT , dir_bh); +up_read (&OCFS2_I (dir)->ip_xattr_sem);if (IS_ERR (acl))return PTR_ERR (acl); }
fs/ocfs2/xattr.c +2 -0
@@ -638,9 +638,11 @@ int ocfs2_calc_xattr_init(struct inode *dir, si->value_len);if (osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL ) { +down_read (&OCFS2_I (dir)->ip_xattr_sem); acl_len =ocfs2_xattr_get_nolock (dir, dir_bh,OCFS2_XATTR_INDEX_POSIX_ACL_DEFAULT ,"" ,NULL ,0 ); +up_read (&OCFS2_I (dir)->ip_xattr_sem);if (acl_len >0 ) { a_size =ocfs2_xattr_entry_real_size (0 , acl_len);if (S_ISDIR (mode))
Signature · 1 line
2.15.1
PATCH 118/189 ocfs2: return error when we attempt to access a dirty bh in jbd2
In reply to Sasha LevinFrom: piaojun <[email protected]>
[ Upstream commit d984187e3a1ad7d12447a7ab2c43ce3717a2b5b3 ]
We should not reuse the dirty bh in jbd2 directly due to the following situation:
1. When removing extent rec, we will dirty the bhs of extent rec and truncate log at the same time, and hand them over to jbd2.
2. The bhs are submitted to jbd2 area successfully.
3. The write-back thread of device help flush the bhs to disk but encounter write error due to abnormal storage link.
4. After a while the storage link become normal. Truncate log flush worker triggered by the next space reclaiming found the dirty bh of truncate log and clear its 'BH_Write_EIO' and then set it uptodate in __ocfs2_journal_access():
ocfs2_truncate_log_worker
ocfs2_flush_truncate_log
__ocfs2_flush_truncate_log
ocfs2_replay_truncate_records
ocfs2_journal_access_di
__ocfs2_journal_access // here we clear io_error and set 'tl_bh' uptodata.
5. Then jbd2 will flush the bh of truncate log to disk, but the bh of extent rec is still in error state, and unfortunately nobody will take care of it.
6. At last the space of extent rec was not reduced, but truncate log flush worker have given it back to globalalloc. That will cause duplicate cluster problem which could be identified by fsck.ocfs2.
Sadly we can hardly revert this but set fs read-only in case of ruining atomicity and consistency of space reclaim.
--- fs/ocfs2/journal.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)
fs/ocfs2/journal.c +12 -11
@@ -666,23 +666,24 @@ static int __ocfs2_journal_access(handle_t *handle,/* we can safely remove this assertion after testing. */ if (!buffer_uptodate (bh)) {mlog (ML_ERROR ,"giving me a buffer that's not uptodate!\n" ); -mlog (ML_ERROR ,"b_blocknr=%llu\n" , - (unsigned long long )bh->b_blocknr); +mlog (ML_ERROR ,"b_blocknr=%llu, b_state=0x%lx\n" , + (unsigned long long )bh->b_blocknr, bh->b_state);lock_buffer (bh);/* -* A previous attempt to write this buffer head failed. -* Nothing we can do but to retry the write and hope for -* the best. +* A previous transaction with a couple of buffer heads fail +* to checkpoint, so all the bhs are marked as BH_Write_EIO. +* For current transaction, the bh is just among those error +* bhs which previous transaction handle. We can't just clear +* its BH_Write_EIO and reuse directly, since other bhs are +* not written to disk yet and that will cause metadata +* inconsistency. So we should set fs read-only to avoid +* further damage. */ if (buffer_write_io_error (bh) && !buffer_uptodate (bh)) { -clear_buffer_write_io_error (bh); -set_buffer_uptodate (bh); - } - -if (!buffer_uptodate (bh)) {unlock_buffer (bh); -return -EIO ; +return ocfs2_error (osb->sb,"A previous attempt to " +"write this buffer head failed\n" ); }unlock_buffer (bh); }
Signature · 1 line
2.15.1
PATCH 119/189 mm/mempolicy: fix the check of nodemask from user
In reply to Sasha LevinFrom: Yisheng Xie <[email protected]>
[ Upstream commit 56521e7a02b7b84a5e72691a1fb15570e6055545 ]
As Xiaojun reported the ltp of migrate_pages01 will fail on arm64 system which has 4 nodes[0...3], all have memory and CONFIG_NODES_SHIFT=2:
migrate_pages01 0 TINFO : test_invalid_nodes migrate_pages01 14 TFAIL : migrate_pages_common.c:45: unexpected failure - returned value = 0, expected: -1 migrate_pages01 15 TFAIL : migrate_pages_common.c:55: call succeeded unexpectedly
In this case the test_invalid_nodes of migrate_pages01 will call:SYSC_migrate_pages as:
migrate_pages(0, , {0x0000000000000001}, 64, , {0x0000000000000010}, 64) = 0
The new nodes specifies one or more node IDs that are greater than the maximum supported node ID, however, the errno is not set to EINVAL as expected.
As man pages of set_mempolicy[1], mbind[2], and migrate_pages[3] mentioned, when nodemask specifies one or more node IDs that are greater than the maximum supported node ID, the errno should set to EINVAL. However, get_nodes only check whether the part of bits [BITS_PER_LONG*BITS_TO_LONGS(MAX_NUMNODES), maxnode) is zero or not, and remain [MAX_NUMNODES, BITS_PER_LONG*BITS_TO_LONGS(MAX_NUMNODES) unchecked.
This patch is to check the bits of [MAX_NUMNODES, maxnode) in get_nodes to let migrate_pages set the errno to EINVAL when nodemask specifies one or more node IDs that are greater than the maximum supported node ID, which follows the manpage's guide.
[1] http://man7.org/linux/man-pages/man2/set_mempolicy.2.html
[2] http://man7.org/linux/man-pages/man2/mbind.2.html
[3] http://man7.org/linux/man-pages/man2/migrate_pages.2.html
--- mm/mempolicy.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)
mm/mempolicy.c +20 -3
@@ -1263,6 +1263,7 @@ static int get_nodes(nodemask_t *nodes, const unsigned long __user *nmask, unsigned long maxnode) {unsigned long k; +unsigned long t;unsigned long nlongs;unsigned long endmask;
@@ -1279,13 +1280,19 @@ static int get_nodes(nodemask_t *nodes, const unsigned long __user *nmask,else endmask = (1UL << (maxnode %BITS_PER_LONG )) -1 ; -/* When the user specified more nodes than supported just check -if the non supported part is all zero. */ +/* +* When the user specified more nodes than supported just check +* if the non supported part is all zero. +* +* If maxnode have more longs than MAX_NUMNODES, check +* the bits in that area first. And then go through to +* check the rest bits which equal or bigger than MAX_NUMNODES. +* Otherwise, just check bits [MAX_NUMNODES, maxnode). +*/ if (nlongs >BITS_TO_LONGS (MAX_NUMNODES )) {if (nlongs >PAGE_SIZE /sizeof (long ))return -EINVAL ;for (k =BITS_TO_LONGS (MAX_NUMNODES ); k < nlongs; k++) { -unsigned long t;if (get_user (t, nmask + k))return -EFAULT ;if (k == nlongs -1 ) {
@@ -1298,6 +1305,16 @@ static int get_nodes(nodemask_t *nodes, const unsigned long __user *nmask, endmask = ~0UL ; } +if (maxnode >MAX_NUMNODES &&MAX_NUMNODES %BITS_PER_LONG !=0 ) { +unsigned long valid_mask = endmask; + + valid_mask &= ~((1UL << (MAX_NUMNODES %BITS_PER_LONG )) -1 ); +if (get_user (t, nmask + nlongs -1 )) +return -EFAULT ; +if (t & valid_mask) +return -EINVAL ; + } +if (copy_from_user (nodes_addr (*nodes), nmask, nlongs*sizeof (unsigned long )))return -EFAULT ;nodes_addr (*nodes)[nlongs-1 ] &= endmask;
Signature · 1 line
2.15.1
PATCH 120/189 mm/mempolicy: add nodes_empty check in SYSC_migrate_pages
In reply to Sasha LevinFrom: Yisheng Xie <[email protected]>
[ Upstream commit 0486a38bcc4749808edbc848f1bcf232042770fc ]
As in manpage of migrate_pages, the errno should be set to EINVAL when none of the node IDs specified by new_nodes are on-line and allowed by the process's current cpuset context, or none of the specified nodes contain memory. However, when test by following case:
new_nodes = 0; old_nodes = 0xf; ret = migrate_pages(pid, old_nodes, new_nodes, MAX);
The ret will be 0 and no errno is set. As the new_nodes is empty, we should expect EINVAL as documented.
To fix the case like above, this patch check whether target nodes AND current task_nodes is empty, and then check whether AND node_states[N_MEMORY] is empty.
--- mm/mempolicy.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
mm/mempolicy.c +7 -3
@@ -1435,10 +1435,14 @@ SYSCALL_DEFINE4(migrate_pages, pid_t, pid, unsigned long, maxnode, goto out_put; } -if (!nodes_subset (*new, node_states[N_MEMORY ])) { - err = -EINVAL ; + task_nodes =cpuset_mems_allowed (current); +nodes_and (*new, *new, task_nodes); +if (nodes_empty (*new)) + goto out_put; + +nodes_and (*new, *new, node_states[N_MEMORY ]); +if (nodes_empty (*new)) goto out_put; - } err =security_task_movememory (task);if (err)
Signature · 1 line
2.15.1
PATCH 121/189 asm-generic: provide generic_pmdp_establish()
In reply to Sasha LevinFrom: "Kirill A. Shutemov" <[email protected]>
[ Upstream commit c58f0bb77ed8bf93dfdde762b01cb67eebbdfc29 ]
Patch series "Do not lose dirty bit on THP pages", v4.
Vlastimil noted that pmdp_invalidate() is not atomic and we can lose dirty and access bits if CPU sets them after pmdp dereference, but before set_pmd_at().
The bug can lead to data loss, but the race window is tiny and I haven't seen any reports that suggested that it happens in reality. So I don't think it worth sending it to stable.
Unfortunately, there's no way to address the issue in a generic way. We need to fix all architectures that support THP one-by-one.
All architectures that have THP supported have to provide atomic pmdp_invalidate() that returns previous value.
If generic implementation of pmdp_invalidate() is used, architecture needs to provide atomic pmdp_estabish().
pmdp_estabish() is not used out-side generic implementation of pmdp_invalidate() so far, but I think this can change in the future.
This patch (of 12):
This is an implementation of pmdp_establish() that is only suitable for an architecture that doesn't have hardware dirty/accessed bits. In this case we can't race with CPU which sets these bits and non-atomic approach is fine.
--- include/asm-generic/pgtable.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
include/asm-generic/pgtable.h +15 -0
@@ -309,6 +309,21 @@ extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,extern pgtable_t pgtable_trans_huge_withdraw (struct mm_struct *mm,pmd_t *pmdp);#endif +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +/* +* This is an implementation of pmdp_establish() that is only suitable for an +* architecture that doesn't have hardware dirty/accessed bits. In this case we +* can't race with CPU which sets these bits and non-atomic aproach is fine. +*/ +static inline pmd_t generic_pmdp_establish (struct vm_area_struct *vma, +unsigned long address,pmd_t *pmdp,pmd_t pmd) +{ +pmd_t old_pmd = *pmdp; +set_pmd_at (vma->vm_mm, address, pmdp, pmd); +return old_pmd; +} +#endif +#ifndef __HAVE_ARCH_PMDP_INVALIDATEextern void pmdp_invalidate (struct vm_area_struct *vma,unsigned long address,pmd_t *pmdp);
Signature · 1 line
2.15.1
PATCH 123/189 mm: thp: use down_read_trylock() in khugepaged to avoid long block
In reply to Sasha LevinFrom: Yang Shi <[email protected]>
[ Upstream commit 3b454ad35043dfbd3b5d2bb92b0991d6342afb44 ]
In the current design, khugepaged needs to acquire mmap_sem before scanning an mm. But in some corner cases, khugepaged may scan a process which is modifying its memory mapping, so khugepaged blocks in uninterruptible state. But the process might hold the mmap_sem for a long time when modifying a huge memory space and it may trigger the below khugepaged hung issue:
INFO: task khugepaged:270 blocked for more than 120 seconds.
Tainted: G E 4.9.65-006.ali3000.alios7.x86_64 #1
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
khugepaged D 0 270 2 0x00000000
ffff883f3deae4c0 0000000000000000 ffff883f610596c0 ffff883f7d359440
ffff883f63818000 ffffc90019adfc78 ffffffff817079a5 d67e5aa8c1860a64
0000000000000246 ffff883f7d359440 ffffc90019adfc88 ffff883f610596c0
Call Trace:
schedule+0x36/0x80
rwsem_down_read_failed+0xf0/0x150
call_rwsem_down_read_failed+0x18/0x30
down_read+0x20/0x40
khugepaged+0x476/0x11d0
kthread+0xe6/0x100
ret_from_fork+0x25/0x30So it sounds pointless to just block khugepaged waiting for the semaphore so replace down_read() with down_read_trylock() to move to scan the next mm quickly instead of just blocking on the semaphore so that other processes can get more chances to install THP. Then khugepaged can come back to scan the skipped mm when it has finished the current round full_scan.
And it appears that the change can improve khugepaged efficiency a little bit.
Below is the test result when running LTP on a 24 cores 4GB memory 2 nodes NUMA VM:
pristine w/ trylock full_scan 197 187 pages_collapsed 21 26 thp_fault_alloc 40818 44466 thp_fault_fallback 18413 16679 thp_collapse_alloc 21 150 thp_collapse_alloc_failed 14 16 thp_file_alloc 369 369
--- mm/khugepaged.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
mm/khugepaged.c +8 -4
@@ -1679,10 +1679,14 @@ static unsigned int khugepaged_scan_mm_slot(unsigned int pages,spin_unlock (&khugepaged_mm_lock); mm = mm_slot->mm; -down_read (&mm->mmap_sem); -if (unlikely (khugepaged_test_exit (mm))) - vma =NULL ; -else +/* +* Don't wait for semaphore (to avoid long wait times). Just move to +* the next mm on the list. +*/ + vma =NULL ; +if (unlikely (!down_read_trylock (&mm->mmap_sem))) + goto breakouterloop_mmap_sem; +if (likely (!khugepaged_test_exit (mm))) vma =find_vma (mm, khugepaged_scan.address); progress++;
Signature · 1 line
2.15.1
PATCH 124/189 mm: pin address_space before dereferencing it while isolating an LRU page
In reply to Sasha LevinFrom: Mel Gorman <[email protected]>
[ Upstream commit 69d763fc6d3aee787a3e8c8c35092b4f4960fa5d ]
Minchan Kim asked the following question -- what locks protects address_space destroying when race happens between inode trauncation and __isolate_lru_page? Jan Kara clarified by describing the race as follows
CPU1 CPU2
truncate(inode) __isolate_lru_page()
...
truncate_inode_page(mapping, page);
delete_from_page_cache(page)
spin_lock_irqsave(&mapping->tree_lock, flags);
__delete_from_page_cache(page, NULL)
page_cache_tree_delete(..)
... mapping = page_mapping(page);
page->mapping = NULL;
...
spin_unlock_irqrestore(&mapping->tree_lock, flags);
page_cache_free_page(mapping, page)
put_page(page)
if (put_page_testzero(page)) -> false- inode now has no pages and can be freed including embedded address_space
if (mapping && !mapping->a_ops->migratepage)
- we've dereferenced mapping which is potentially already free.
The race is theoretically possible but unlikely. Before the delete_from_page_cache, truncate_cleanup_page is called so the page is likely to be !PageDirty or PageWriteback which gets skipped by the only caller that checks the mappping in __isolate_lru_page. Even if the race occurs, a substantial amount of work has to happen during a tiny window with no preemption but it could potentially be done using a virtual machine to artifically slow one CPU or halt it during the critical window.
This patch should eliminate the race with truncation by try-locking the page before derefencing mapping and aborting if the lock was not acquired. There was a suggestion from Huang Ying to use RCU as a side-effect to prevent mapping being freed. However, I do not like the solution as it's an unconventional means of preserving a mapping and it's not a context where rcu_read_lock is obviously protecting rcu data.
--- mm/vmscan.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
mm/vmscan.c +12 -2
@@ -1436,14 +1436,24 @@ int __isolate_lru_page(struct page *page, isolate_mode_t mode)if (PageDirty (page)) {struct address_space *mapping; +bool migrate_dirty;/* * Only pages without mappings or that have a * ->migratepage callback are possible to migrate -* without blocking +* without blocking. However, we can be racing with +* truncation so it's necessary to lock the page +* to stabilise the mapping as truncation holds +* the page lock until after the page is removed +* from the page cache. */ +if (!trylock_page (page)) +return ret; + mapping =page_mapping (page); -if (mapping && !mapping->a_ops->migratepage) + migrate_dirty = mapping && mapping->a_ops->migratepage; +unlock_page (page); +if (!migrate_dirty)return ret; } }
Signature · 1 line
2.15.1
PATCH 127/189 ibmvnic: fix firmware version when no firmware level has been provided by the VIOS server
In reply to Sasha LevinFrom: Desnes Augusto Nunes do Rosario <[email protected]>
[ Upstream commit a107311d7fdf6b826f3737c4a90fd0e0046e7a3a ]
Older versions of VIOS servers do not send the firmware level in the VPD buffer for the ibmvnic driver. Thus, not only the current message is mis- leading but the firmware version in the ethtool will be NULL. Therefore, this patch fixes the firmware string and its warning.
--- drivers/net/ethernet/ibm/ibmvnic.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/ibm/ibmvnic.c +5 -1
@@ -3294,7 +3294,11 @@ static void handle_vpd_rsp(union ibmvnic_crq *crq,*/ substr =strnstr (adapter->vpd->buff,"RM" , adapter->vpd->len);if (!substr) { -dev_info (dev,"No FW level provided by VPD\n" ); +dev_info (dev,"Warning - No FW level has been provided in the VPD buffer by the VIOS Server\n" ); + ptr =strncpy ((char *)adapter->fw_version,"N/A" , +3 *sizeof (char )); +if (!ptr) +dev_err (dev,"Failed to inform that firmware version is unavailable to the adapter\n" ); goto complete; }
Signature · 1 line
2.15.1
PATCH 131/189 IB/hfi1: Fix for potential refcount leak in hfi1_open_file()
In reply to Sasha LevinFrom: Alex Estrin <[email protected]>
[ Upstream commit 2b1e7fe16124e86ee9242aeeee859c79a843e3a2 ]
The dd refcount is speculatively incremented prior to allocating the fd memory with kzalloc(). If that kzalloc() failed the dd refcount leaks.
Increment refcount on kzalloc success.
--- drivers/infiniband/hw/hfi1/file_ops.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/infiniband/hw/hfi1/file_ops.c +1 -3
@@ -196,9 +196,6 @@ static int hfi1_file_open(struct inode *inode, struct file *fp)if (!atomic_inc_not_zero (&dd->user_refcount))return -ENXIO ; -/* Just take a ref now. Not all opens result in a context assign */ -kobject_get (&dd->kobj); -/* The real work is performed later in assign_ctxt() */ fd =kzalloc (sizeof (*fd),GFP_KERNEL );
@@ -208,6 +205,7 @@ static int hfi1_file_open(struct inode *inode, struct file *fp) fd->mm = current->mm;mmgrab (fd->mm); fd->dd = dd; +kobject_get (&fd->dd->kobj); fp->private_data = fd; }else { fp->private_data =NULL ;
Signature · 1 line
2.15.1
PATCH 128/189 blk-mq: fix discard merge with scheduler attached
In reply to Sasha LevinFrom: Jens Axboe <[email protected]>
[ Upstream commit 445251d0f4d329aa061f323546cd6388a3bb7ab5 ]
I ran into an issue on my laptop that triggered a bug on the discard path:
WARNING: CPU: 2 PID: 207 at drivers/nvme/host/core.c:527 nvme_setup_cmd+0x3d3/0x430 Modules linked in: rfcomm fuse ctr ccm bnep arc4 binfmt_misc snd_hda_codec_hdmi nls_iso8859_1 nls_cp437 vfat snd_hda_codec_conexant fat snd_hda_codec_generic iwlmvm snd_hda_intel snd_hda_codec snd_hwdep mac80211 snd_hda_core snd_pcm snd_seq_midi snd_seq_midi_event snd_rawmidi snd_seq x86_pkg_temp_thermal intel_powerclamp kvm_intel uvcvideo iwlwifi btusb snd_seq_device videobuf2_vmalloc btintel videobuf2_memops kvm snd_timer videobuf2_v4l2 bluetooth irqbypass videobuf2_core aesni_intel aes_x86_64 crypto_simd cryptd snd glue_helper videodev cfg80211 ecdh_generic soundcore hid_generic usbhid hid i915 psmouse e1000e ptp pps_core xhci_pci xhci_hcd intel_gtt CPU: 2 PID: 207 Comm: jbd2/nvme0n1p7- Tainted: G U 4.15.0+ #176 Hardware name: LENOVO 20FBCTO1WW/20FBCTO1WW, BIOS N1FET59W (1.33 ) 12/19/2017 RIP: 0010:nvme_setup_cmd+0x3d3/0x430 RSP: 0018:ffff880423e9f838 EFLAGS: 00010217 RAX: 0000000000000000 RBX: ffff880423e9f8c8 RCX: 0000000000010000 RDX: ffff88022b200010 RSI: 0000000000000002 RDI: 00000000327f0000 RBP: ffff880421251400 R08: ffff88022b200000 R09: 0000000000000009 R10: 0000000000000000 R11: 0000000000000000 R12: 000000000000ffff R13: ffff88042341e280 R14: 000000000000ffff R15: ffff880421251440 FS: 0000000000000000(0000) GS:ffff880441500000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000055b684795030 CR3: 0000000002e09006 CR4: 00000000001606e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: nvme_queue_rq+0x40/0xa00 ? __sbitmap_queue_get+0x24/0x90 ? blk_mq_get_tag+0xa3/0x250 ? wait_woken+0x80/0x80 ? blk_mq_get_driver_tag+0x97/0xf0 blk_mq_dispatch_rq_list+0x7b/0x4a0 ? deadline_remove_request+0x49/0xb0 blk_mq_do_dispatch_sched+0x4f/0xc0 blk_mq_sched_dispatch_requests+0x106/0x170 __blk_mq_run_hw_queue+0x53/0xa0 __blk_mq_delay_run_hw_queue+0x83/0xa0 blk_mq_run_hw_queue+0x6c/0xd0 blk_mq_sched_insert_request+0x96/0x140 __blk_mq_try_issue_directly+0x3d/0x190 blk_mq_try_issue_directly+0x30/0x70 blk_mq_make_request+0x1a4/0x6a0 generic_make_request+0xfd/0x2f0 ? submit_bio+0x5c/0x110 submit_bio+0x5c/0x110 ? __blkdev_issue_discard+0x152/0x200 submit_bio_wait+0x43/0x60 ext4_process_freed_data+0x1cd/0x440 ? account_page_dirtied+0xe2/0x1a0 ext4_journal_commit_callback+0x4a/0xc0 jbd2_journal_commit_transaction+0x17e2/0x19e0 ? kjournald2+0xb0/0x250 kjournald2+0xb0/0x250 ? wait_woken+0x80/0x80 ? commit_timeout+0x10/0x10 kthread+0x111/0x130 ? kthread_create_worker_on_cpu+0x50/0x50 ? do_group_exit+0x3a/0xa0 ret_from_fork+0x1f/0x30 Code: 73 89 c1 83 ce 10 c1 e1 10 09 ca 83 f8 04 0f 87 0f ff ff ff 8b 4d 20 48 8b 7d 00 c1 e9 09 48 01 8c c7 00 08 00 00 e9 f8 fe ff ff <0f> ff 4c 89 c7 41 bc 0a 00 00 00 e8 0d 78 d6 ff e9 a1 fc ff ff ---[ end trace 50d361cc444506c8 ]--- print_req_error: I/O error, dev nvme0n1, sector 847167488
Decoding the assembly, the request claims to have 0xffff segments, while nvme counts two. This turns out to be because we don't check for a data carrying request on the mq scheduler path, and since blk_phys_contig_segment() returns true for a non-data request, we decrement the initial segment count of 0 and end up with 0xffff in the unsigned short.
There are a few issues here:
1) We should initialize the segment count for a discard to 1.
2) The discard merging is currently using the data limits for segments and sectors.
Fix this up by having attempt_merge() correctly identify the request, and by initializing the segment count correctly for discards.
This can only be triggered with mq-deadline on discard capable devices right now, which isn't a common configuration.
--- block/blk-core.c | 2 ++ block/blk-merge.c | 29 ++++++++++++++++++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-)
block/blk-core.c +2 -0
@@ -3260,6 +3260,8 @@ void blk_rq_bio_prep(struct request_queue *q, struct request *rq, {if (bio_has_data (bio)) rq->nr_phys_segments =bio_phys_segments (q, bio); +else if (bio_op (bio) ==REQ_OP_DISCARD ) + rq->nr_phys_segments =1 ; rq->__data_len = bio->bi_iter.bi_size; rq->bio = rq->biotail = bio;
block/blk-merge.c +26 -3
@@ -551,6 +551,24 @@ static bool req_no_special_merge(struct request *req)return !q->mq_ops && req->special; } +static bool req_attempt_discard_merge (struct request_queue *q,struct request *req, +struct request *next) +{ +unsigned short segments =blk_rq_nr_discard_segments (req); + +if (segments >=queue_max_discard_segments (q)) + goto no_merge; +if (blk_rq_sectors (req) +bio_sectors (next->bio) > +blk_rq_get_max_sectors (req,blk_rq_pos (req))) + goto no_merge; + + req->nr_phys_segments = segments +blk_rq_nr_discard_segments (next); +return true; +no_merge: +req_set_nomerge (q, req); +return false; +} +static int ll_merge_requests_fn (struct request_queue *q,struct request *req,struct request *next) {
@@ -684,9 +702,13 @@ static struct request *attempt_merge(struct request_queue *q,* If we are allowed to merge, then append bio list * from next to rq and release next. merge_requests_fn * will have updated segment counts, update sector -* counts here. +* counts here. Handle DISCARDs separately, as they +* have separate settings. */ -if (!ll_merge_requests_fn (q, req, next)) +if (req_op (req) ==REQ_OP_DISCARD ) { +if (!req_attempt_discard_merge (q, req, next)) +return NULL ; + }else if (!ll_merge_requests_fn (q, req, next))return NULL ;/*
@@ -716,7 +738,8 @@ static struct request *attempt_merge(struct request_queue *q, req->__data_len +=blk_rq_bytes (next); -elv_merge_requests (q, req, next); +if (req_op (req) !=REQ_OP_DISCARD ) +elv_merge_requests (q, req, next);/* * 'next' is going away, so update stats accordingly
Signature · 1 line
2.15.1
PATCH 132/189 IB/hfi1: Show fault stats in both TX and RX directions
In reply to Sasha LevinFrom: Mitko Haralanov <[email protected]>
[ Upstream commit b5de809ef6f6c32cfbbf0da14ed11b0fdc0888f8 ]
The routine which shows the fault stats checks the counters to determine whether to show any stats based on the number of transmitted pkts/bytes for a particular opcode.
Unfortunately, it only checked the receive counters. As a result, if any packet faults have happened for packets egressing the HFI, those stats would not be shown.
In order to fix this, the routine is amended to also check the TX counters. With this change the pkt/byte counts are the sum of both TX and RX counts for the opcode.
--- drivers/infiniband/hw/hfi1/debugfs.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/infiniband/hw/hfi1/debugfs.c +8 -1
@@ -1,5 +1,5 @@/* -* Copyright(c) 2015-2017 Intel Corporation. +* Copyright(c) 2015-2018 Intel Corporation. * * This file is provided under a dual BSD/GPLv2 license. When using or * redistributing this file, you may do so under either license.
@@ -1201,6 +1201,13 @@ static int _fault_stats_seq_show(struct seq_file *s, void *v) }hfi1_rcd_put (rcd); } +for_each_possible_cpu (j) { +struct hfi1_opcode_stats_perctx *sp = +per_cpu_ptr (dd->tx_opstats, j); + + n_packets += sp->stats[i].n_packets; + n_bytes += sp->stats[i].n_bytes; + }if (!n_packets && !n_bytes)return SEQ_SKIP ; if (!ibd->fault_opcode->n_rxfaults[i] &&
Signature · 1 line
2.15.1
PATCH 133/189 IB/ipoib: Fix for potential no-carrier state
In reply to Sasha LevinFrom: Alex Estrin <[email protected]>
[ Upstream commit 1029361084d18cc270f64dfd39529fafa10cfe01 ]
On reboot SM can program port pkey table before ipoib registered its event handler, which could result in missing pkey event and leave root interface with initial pkey value from index 0.
Since OPA port starts with invalid pkey in index 0, root interface will fail to initialize and stay down with no-carrier flag.
For IB ipoib interface may end up with pkey different from value opensm put in pkey table idx 0, resulting in connectivity issues (different mcast groups, for example).
Close the window by calling event handler after registration to make sure ipoib pkey is in sync with port pkey table.
--- drivers/infiniband/ulp/ipoib/ipoib_main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/infiniband/ulp/ipoib/ipoib_main.c +3 -0
@@ -2287,6 +2287,9 @@ static struct net_device *ipoib_add_port(const char *format, priv->ca, ipoib_event);ib_register_event_handler (&priv->event_handler); +/* call event handler to ensure pkey in sync */ +queue_work (ipoib_workqueue, &priv->flush_heavy); + result =register_netdev (priv->dev);if (result) { printk(KERN_WARNING "%s: couldn't register ipoib port %d; error %d\n",
Signature · 1 line
2.15.1
PATCH 134/189 IB/core: Map iWarp AH type to undefined in rdma_ah_find_type
In reply to Sasha LevinFrom: Don Hiatt <[email protected]>
[ Upstream commit 87daac68f77a3e21a1113f816e6a7be0b38bdde8 ]
iWarp devices do not support the creation of address handles so return AH_ATTR_TYPE_UNDEFINED for all iWarp devices.
While we are here reduce the size of port_num to u8 and add a comment.
--- include/rdma/ib_verbs.h | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
include/rdma/ib_verbs.h +14 -6
@@ -878,6 +878,7 @@ struct ib_mr_status { __attribute_const__ enum ib_rate mult_to_ib_rate(int mult);enum rdma_ah_attr_type { +RDMA_AH_ATTR_TYPE_UNDEFINED ,RDMA_AH_ATTR_TYPE_IB ,RDMA_AH_ATTR_TYPE_ROCE ,RDMA_AH_ATTR_TYPE_OPA ,
@@ -3789,17 +3790,24 @@ static inline void rdma_ah_set_grh(struct rdma_ah_attr *attr, grh->traffic_class = traffic_class; } -/*Get AH type */ +/** +* rdma_ah_find_type - Return address handle type. +* +* @dev: Device to be checked +* @port_num: Port number +*/ static inline enum rdma_ah_attr_type rdma_ah_find_type (struct ib_device *dev, -u32 port_num) +u8 port_num) {if (rdma_protocol_roce (dev, port_num))return RDMA_AH_ATTR_TYPE_ROCE ; -else if ((rdma_protocol_ib (dev, port_num)) && - (rdma_cap_opa_ah (dev, port_num))) -return RDMA_AH_ATTR_TYPE_OPA ; -else +if (rdma_protocol_ib (dev, port_num)) { +if (rdma_cap_opa_ah (dev, port_num)) +return RDMA_AH_ATTR_TYPE_OPA ;return RDMA_AH_ATTR_TYPE_IB ; + } + +return RDMA_AH_ATTR_TYPE_UNDEFINED ; }/**
Signature · 1 line
2.15.1
PATCH 135/189 drm/nouveau/pmu/fuc: don't use movw directly anymore
In reply to Sasha LevinFrom: Karol Herbst <[email protected]>
[ Upstream commit fe9748b7b41cee11f8db57fb8b20bc540a33102a ]
Fixes failure to compile with recent envyas as a result of the 'movw' alias being removed for v5.
A bit of history:
v3 only has a 16-bit sign-extended immediate mov op. In order to set the high bits, there's a separate 'sethi' op. envyas validates that the value passed to mov(imm) is between -0x8000 and 0x7fff. In order to simplify macros that load both the low and high word, a 'movw' alias was added which takes an unsigned 16-bit immediate. However the actual hardware op still sign extends.
v5 has a full 32-bit immediate mov op. The v3 16-bit immediate mov op is gone (loads 0 into the dst reg). However due to a bug in envyas, the movw alias still existed, and selected the no-longer-present v3 16-bit immediate mov op. As a result usage of movw on v5 is the same as mov with a 0x0 argument.
The proper fix throughout is to only ever use the 'movw' alias in combination with 'sethi'. Anything else should get the sign-extended validation to ensure that the intended value ends up in the destination register.
Changes in fuc3 binaries is the result of a different encoding being selected for a mov with an 8-bit value.
v2: added commit message written by Ilia, thanks for that!
v3: messed up rebasing, now it should apply
--- .../drm/nouveau/nvkm/subdev/pmu/fuc/gf100.fuc3.h | 746 +++++++-------- .../drm/nouveau/nvkm/subdev/pmu/fuc/gk208.fuc5.h | 802 ++++++++-------- .../drm/nouveau/nvkm/subdev/pmu/fuc/gt215.fuc3.h | 1006 ++++++++++---------- .../gpu/drm/nouveau/nvkm/subdev/pmu/fuc/memx.fuc | 30 +- 4 files changed, 1292 insertions(+), 1292 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gf100.fuc3.h +373 -373
@@ -47,8 +47,8 @@ static uint32_t gf100_pmu_data[] = {0x00000000 ,0x00000000 ,0x584d454d , -0x00000756 , -0x00000748 , +0x00000754 , +0x00000746 ,0x00000000 ,0x00000000 , 0x00000000,
@@ -69,8 +69,8 @@ static uint32_t gf100_pmu_data[] = {0x00000000 ,0x00000000 ,0x46524550 , -0x0000075a ,0x00000758 , +0x00000756 ,0x00000000 ,0x00000000 , 0x00000000,
@@ -91,8 +91,8 @@ static uint32_t gf100_pmu_data[] = {0x00000000 ,0x00000000 ,0x5f433249 , -0x00000b8a , -0x00000a2d , +0x00000b88 , +0x00000a2b ,0x00000000 ,0x00000000 , 0x00000000,
@@ -113,8 +113,8 @@ static uint32_t gf100_pmu_data[] = {0x00000000 ,0x00000000 ,0x54534554 , -0x00000bb3 , -0x00000b8c , +0x00000bb1 , +0x00000b8a ,0x00000000 ,0x00000000 , 0x00000000,
@@ -135,8 +135,8 @@ static uint32_t gf100_pmu_data[] = {0x00000000 ,0x00000000 ,0x454c4449 , -0x00000bbf ,0x00000bbd , +0x00000bbb ,0x00000000 ,0x00000000 , 0x00000000,
@@ -237,19 +237,19 @@ static uint32_t gf100_pmu_data[] = {0x000005d3 ,0x00000003 ,0x00000002 , -0x0000069d , +0x0000069b ,0x00040004 ,0x00000000 , -0x000006b9 , +0x000006b7 ,0x00010005 ,0x00000000 , -0x000006d6 , +0x000006d4 ,0x00010006 ,0x00000000 ,0x0000065b ,0x00000007 ,0x00000000 , -0x000006e1 , +0x000006df ,/* 0x03c4: memx_func_tail */ /* 0x03c4: memx_ts_start */ 0x00000000,
@@ -1373,432 +1373,432 @@ static uint32_t gf100_pmu_code[] = {/* 0x065b: memx_func_wait_vblank */ 0x9800f840 ,0x66b00016 , -0x130bf400 , +0x120bf400 ,0xf40166b0 ,0x0ef4060b ,/* 0x066d: memx_func_wait_vblank_head1 */ -0x2077f12e , -0x070ef400 , -/* 0x0674: memx_func_wait_vblank_head0 */ -0x000877f1 , -/* 0x0678: memx_func_wait_vblank_0 */ -0x07c467f1 , -0xcf0664b6 , -0x67fd0066 , -0xf31bf404 , -/* 0x0688: memx_func_wait_vblank_1 */ -0x07c467f1 , -0xcf0664b6 , -0x67fd0066 , -0xf30bf404 , -/* 0x0698: memx_func_wait_vblank_fini */ -0xf80410b6 , -/* 0x069d: memx_func_wr32 */ -0x00169800 , -0xb6011598 , -0x60f90810 , -0xd0fc50f9 , -0x21f4e0fc , -0x0242b640 , -0xf8e91bf4 , -/* 0x06b9: memx_func_wait */ -0x2c87f000 , -0xcf0684b6 , -0x1e980088 , -0x011d9800 , -0x98021c98 , -0x10b6031b , -0xa321f410 , -/* 0x06d6: memx_func_delay */ -0x1e9800f8 , -0x0410b600 , -0xf87e21f4 , -/* 0x06e1: memx_func_train */ -/* 0x06e3: memx_exec */ -0xf900f800 , -0xb9d0f9e0 , -0xb2b902c1 , -/* 0x06ed: memx_exec_next */ -0x00139802 , -0xe70410b6 , -0xe701f034 , -0xb601e033 , -0x30f00132 , -0xde35980c , -0x12b855f9 , -0xe41ef406 , -0x98f10b98 , -0xcbbbf20c , -0xc4b7f102 , -0x06b4b607 , -0xfc00bbcf , -0xf5e0fcd0 , -0xf8033621 , -/* 0x0729: memx_info */ -0x01c67000 , -/* 0x072f: memx_info_data */ -0xf10e0bf4 , -0xf103ccc7 , -0xf40800b7 , -/* 0x073a: memx_info_train */ -0xc7f10b0e , -0xb7f10bcc , -/* 0x0742: memx_info_send */ -0x21f50100 , -0x00f80336 , -/* 0x0748: memx_recv */ -0xf401d6b0 , -0xd6b0980b , -0xd80bf400 , -/* 0x0756: memx_init */ -0x00f800f8 , -/* 0x0758: perf_recv */ -/* 0x075a: perf_init */ +0x2077f02c , +/* 0x0673: memx_func_wait_vblank_head0 */ +0xf0060ef4 , +/* 0x0676: memx_func_wait_vblank_0 */ +0x67f10877 , +0x64b607c4 , +0x0066cf06 , +0xf40467fd , +/* 0x0686: memx_func_wait_vblank_1 */ +0x67f1f31b , +0x64b607c4 , +0x0066cf06 , +0xf40467fd , +/* 0x0696: memx_func_wait_vblank_fini */ +0x10b6f30b , +/* 0x069b: memx_func_wr32 */ +0x9800f804 , +0x15980016 , +0x0810b601 , +0x50f960f9 , +0xe0fcd0fc , +0xb64021f4 , +0x1bf40242 , +/* 0x06b7: memx_func_wait */ +0xf000f8e9 , +0x84b62c87 , +0x0088cf06 , +0x98001e98 , +0x1c98011d , +0x031b9802 , +0xf41010b6 , +0x00f8a321 , +/* 0x06d4: memx_func_delay */ +0xb6001e98 , +0x21f40410 , +/* 0x06df: memx_func_train */ +0xf800f87e , +/* 0x06e1: memx_exec */ +0xf9e0f900 , +0x02c1b9d0 , +/* 0x06eb: memx_exec_next */ +0x9802b2b9 , +0x10b60013 , +0xf034e704 , +0xe033e701 , +0x0132b601 , +0x980c30f0 , +0x55f9de35 , +0xf40612b8 , +0x0b98e41e , +0xf20c98f1 , +0xf102cbbb , +0xb607c4b7 , +0xbbcf06b4 , +0xfcd0fc00 , +0x3621f5e0 , +/* 0x0727: memx_info */ +0x7000f803 , +0x0bf401c6 , +/* 0x072d: memx_info_data */ +0xccc7f10e , +0x00b7f103 , +0x0b0ef408 , +/* 0x0738: memx_info_train */ +0x0bccc7f1 , +0x0100b7f1 , +/* 0x0740: memx_info_send */ +0x033621f5 , +/* 0x0746: memx_recv */ +0xd6b000f8 , +0x980bf401 , +0xf400d6b0 , +0x00f8d80b , +/* 0x0754: memx_init */ +/* 0x0756: perf_recv */ 0x00f800f8 , -/* 0x075c: i2c_drive_scl */ -0xf40036b0 , -0x07f1110b , -0x04b607e0 , -0x0001d006 , -0x00f804bd , -/* 0x0770: i2c_drive_scl_lo */ -0x07e407f1 , -0xd00604b6 , -0x04bd0001 , -/* 0x077e: i2c_drive_sda */ +/* 0x0758: perf_init */ +/* 0x075a: i2c_drive_scl */ 0x36b000f8 ,0x110bf400 ,0x07e007f1 ,0xd00604b6 , -0x04bd0002 , -/* 0x0792: i2c_drive_sda_lo */ +0x04bd0001 , +/* 0x076e: i2c_drive_scl_lo */ 0x07f100f8 ,0x04b607e4 , +0x0001d006 , +0x00f804bd , +/* 0x077c: i2c_drive_sda */ +0xf40036b0 , +0x07f1110b , +0x04b607e0 ,0x0002d006 ,0x00f804bd , -/* 0x07a0: i2c_sense_scl */ -0xf10132f4 , -0xb607c437 , -0x33cf0634 , -0x0431fd00 , -0xf4060bf4 , -/* 0x07b6: i2c_sense_scl_done */ -0x00f80131 , -/* 0x07b8: i2c_sense_sda */ -0xf10132f4 , -0xb607c437 , -0x33cf0634 , -0x0432fd00 , -0xf4060bf4 , -/* 0x07ce: i2c_sense_sda_done */ -0x00f80131 , -/* 0x07d0: i2c_raise_scl */ -0x47f140f9 , -0x37f00898 , -0x5c21f501 , -/* 0x07dd: i2c_raise_scl_wait */ -0xe8e7f107 , -0x7e21f403 , -0x07a021f5 , -0xb60901f4 , -0x1bf40142 , -/* 0x07f1: i2c_raise_scl_done */ -0xf840fcef , -/* 0x07f5: i2c_start */ -0xa021f500 , -0x0d11f407 , -0x07b821f5 , -0xf40611f4 , -/* 0x0806: i2c_start_rep */ -0x37f0300e , -0x5c21f500 , -0x0137f007 , -0x077e21f5 , -0xb60076bb , -0x50f90465 , -0xbb046594 , -0x50bd0256 , -0xfc0475fd , -0xd021f550 , -0x0464b607 , -/* 0x0833: i2c_start_send */ -0xf01f11f4 , +/* 0x0790: i2c_drive_sda_lo */ +0x07e407f1 , +0xd00604b6 , +0x04bd0002 , +/* 0x079e: i2c_sense_scl */ +0x32f400f8 , +0xc437f101 , +0x0634b607 , +0xfd0033cf , +0x0bf40431 , +0x0131f406 , +/* 0x07b4: i2c_sense_scl_done */ +/* 0x07b6: i2c_sense_sda */ +0x32f400f8 , +0xc437f101 , +0x0634b607 , +0xfd0033cf , +0x0bf40432 , +0x0131f406 , +/* 0x07cc: i2c_sense_sda_done */ +/* 0x07ce: i2c_raise_scl */ +0x40f900f8 , +0x089847f1 , +0xf50137f0 , +/* 0x07db: i2c_raise_scl_wait */ +0xf1075a21 , +0xf403e8e7 , +0x21f57e21 , +0x01f4079e , +0x0142b609 , +/* 0x07ef: i2c_raise_scl_done */ +0xfcef1bf4 , +/* 0x07f3: i2c_start */ +0xf500f840 , +0xf4079e21 , +0x21f50d11 , +0x11f407b6 , +0x300ef406 , +/* 0x0804: i2c_start_rep */ +0xf50037f0 , +0xf0075a21 , +0x21f50137 , +0x76bb077c , +0x0465b600 , +0x659450f9 , +0x0256bb04 , +0x75fd50bd , +0xf550fc04 , +0xb607ce21 , +0x11f40464 , +/* 0x0831: i2c_start_send */ +0x0037f01f , +0x077c21f5 , +0x1388e7f1 , +0xf07e21f4 ,0x21f50037 , -0xe7f1077e , +0xe7f1075a ,0x21f41388 , -0x0037f07e , -0x075c21f5 , -0x1388e7f1 , -/* 0x084f: i2c_start_out */ -0xf87e21f4 , -/* 0x0851: i2c_stop */ -0x0037f000 , -0x075c21f5 , -0xf50037f0 , -0xf1077e21 , -0xf403e8e7 , -0x37f07e21 , -0x5c21f501 , -0x88e7f107 , -0x7e21f413 , +/* 0x084d: i2c_start_out */ +/* 0x084f: i2c_stop */ +0xf000f87e , +0x21f50037 , +0x37f0075a , +0x7c21f500 , +0xe8e7f107 , +0x7e21f403 ,0xf50137f0 , -0xf1077e21 , +0xf1075a21 ,0xf41388e7 , -0x00f87e21 , -/* 0x0884: i2c_bitw */ -0x077e21f5 , -0x03e8e7f1 , -0xbb7e21f4 , -0x65b60076 , -0x9450f904 , -0x56bb0465 , -0xfd50bd02 , -0x50fc0475 , -0x07d021f5 , -0xf40464b6 , -0xe7f11811 , -0x21f41388 , -0x0037f07e , -0x075c21f5 , -0x1388e7f1 , -/* 0x08c3: i2c_bitw_out */ -0xf87e21f4 , -/* 0x08c5: i2c_bitr */ -0x0137f000 , -0x077e21f5 , -0x03e8e7f1 , -0xbb7e21f4 , -0x65b60076 , -0x9450f904 , -0x56bb0465 , -0xfd50bd02 , -0x50fc0475 , -0x07d021f5 , -0xf40464b6 , -0x21f51b11 , -0x37f007b8 , -0x5c21f500 , +0x37f07e21 , +0x7c21f501 ,0x88e7f107 ,0x7e21f413 , -0xf4013cf0 , -/* 0x090a: i2c_bitr_done */ -0x00f80131 , -/* 0x090c: i2c_get_byte */ -0xf00057f0 , -/* 0x0912: i2c_get_byte_next */ -0x54b60847 , -0x0076bb01 , +/* 0x0882: i2c_bitw */ +0x21f500f8 , +0xe7f1077c , +0x21f403e8 , +0x0076bb7e ,0xf90465b6 ,0x04659450 ,0xbd0256bb ,0x0475fd50 ,0x21f550fc , -0x64b608c5 , -0x2b11f404 , -0xb60553fd , -0x1bf40142 , -0x0137f0d8 , -0xb60076bb , -0x50f90465 , -0xbb046594 , -0x50bd0256 , -0xfc0475fd , -0x8421f550 , -0x0464b608 , -/* 0x095c: i2c_get_byte_done */ -/* 0x095e: i2c_put_byte */ -0x47f000f8 , -/* 0x0961: i2c_put_byte_next */ -0x0142b608 , -0xbb3854ff , +0x64b607ce , +0x1811f404 , +0x1388e7f1 , +0xf07e21f4 , +0x21f50037 , +0xe7f1075a , +0x21f41388 , +/* 0x08c1: i2c_bitw_out */ +/* 0x08c3: i2c_bitr */ +0xf000f87e , +0x21f50137 , +0xe7f1077c , +0x21f403e8 , +0x0076bb7e , +0xf90465b6 , +0x04659450 , +0xbd0256bb , +0x0475fd50 , +0x21f550fc , +0x64b607ce , +0x1b11f404 , +0x07b621f5 , +0xf50037f0 , +0xf1075a21 , +0xf41388e7 , +0x3cf07e21 , +0x0131f401 , +/* 0x0908: i2c_bitr_done */ +/* 0x090a: i2c_get_byte */ +0x57f000f8 , +0x0847f000 , +/* 0x0910: i2c_get_byte_next */ +0xbb0154b6 ,0x65b60076 ,0x9450f904 ,0x56bb0465 ,0xfd50bd02 ,0x50fc0475 , -0x088421f5 , +0x08c321f5 ,0xf40464b6 , -0x46b03411 , -0xd81bf400 , -0xb60076bb , -0x50f90465 , -0xbb046594 , -0x50bd0256 , -0xfc0475fd , -0xc521f550 , -0x0464b608 , -0xbb0f11f4 , -0x36b00076 , -0x061bf401 , -/* 0x09b7: i2c_put_byte_done */ -0xf80132f4 , -/* 0x09b9: i2c_addr */ -0x0076bb00 , +0x53fd2b11 , +0x0142b605 , +0xf0d81bf4 , +0x76bb0137 , +0x0465b600 , +0x659450f9 , +0x0256bb04 , +0x75fd50bd , +0xf550fc04 , +0xb6088221 , +/* 0x095a: i2c_get_byte_done */ +0x00f80464 , +/* 0x095c: i2c_put_byte */ +/* 0x095f: i2c_put_byte_next */ +0xb60847f0 , +0x54ff0142 , +0x0076bb38 ,0xf90465b6 ,0x04659450 ,0xbd0256bb ,0x0475fd50 ,0x21f550fc , -0x64b607f5 , -0x2911f404 , -0x012ec3e7 , -0xfd0134b6 , -0x76bb0553 , +0x64b60882 , +0x3411f404 , +0xf40046b0 , +0x76bbd81b ,0x0465b600 ,0x659450f9 ,0x0256bb04 ,0x75fd50bd ,0xf550fc04 , -0xb6095e21 , -/* 0x09fe: i2c_addr_done */ -0x00f80464 , -/* 0x0a00: i2c_acquire_addr */ -0xb6f8cec7 , -0xe0b702e4 , -0xee980d1c , -/* 0x0a0f: i2c_acquire */ -0xf500f800 , -0xf40a0021 , -0xd9f00421 , -0x4021f403 , -/* 0x0a1e: i2c_release */ -0x21f500f8 , -0x21f40a00 , -0x03daf004 , -0xf84021f4 , -/* 0x0a2d: i2c_recv */ -0x0132f400 , -0xb6f8c1c7 , -0x16b00214 , -0x3a1ff528 , -0xf413a001 , -0x0032980c , -0x0ccc13a0 , -0xf4003198 , -0xd0f90231 , -0xd0f9e0f9 , -0x000067f1 , -0x100063f1 , -0xbb016792 , +0xb608c321 , +0x11f40464 , +0x0076bb0f , +0xf40136b0 , +0x32f4061b , +/* 0x09b5: i2c_put_byte_done */ +/* 0x09b7: i2c_addr */ +0xbb00f801 ,0x65b60076 ,0x9450f904 ,0x56bb0465 ,0xfd50bd02 ,0x50fc0475 , -0x0a0f21f5 , -0xfc0464b6 , -0x00d6b0d0 , -0x00b31bf5 , -0xbb0057f0 , -0x65b60076 , -0x9450f904 , -0x56bb0465 , -0xfd50bd02 , -0x50fc0475 , -0x09b921f5 , -0xf50464b6 , -0xc700d011 , -0x76bbe0c5 , -0x0465b600 , -0x659450f9 , -0x0256bb04 , -0x75fd50bd , -0xf550fc04 , -0xb6095e21 , -0x11f50464 , -0x57f000ad , +0x07f321f5 , +0xf40464b6 , +0xc3e72911 , +0x34b6012e , +0x0553fd01 , +0xb60076bb , +0x50f90465 , +0xbb046594 , +0x50bd0256 , +0xfc0475fd , +0x5c21f550 , +0x0464b609 , +/* 0x09fc: i2c_addr_done */ +/* 0x09fe: i2c_acquire_addr */ +0xcec700f8 , +0x02e4b6f8 , +0x0d1ce0b7 , +0xf800ee98 , +/* 0x0a0d: i2c_acquire */ +0xfe21f500 , +0x0421f409 , +0xf403d9f0 , +0x00f84021 , +/* 0x0a1c: i2c_release */ +0x09fe21f5 , +0xf00421f4 , +0x21f403da , +/* 0x0a2b: i2c_recv */ +0xf400f840 , +0xc1c70132 , +0x0214b6f8 , +0xf52816b0 , +0xa0013a1f , +0x980cf413 , +0x13a00032 , +0x31980ccc , +0x0231f400 , +0xe0f9d0f9 , +0x67f1d0f9 , +0x63f10000 , +0x67921000 ,0x0076bb01 ,0xf90465b6 ,0x04659450 ,0xbd0256bb ,0x0475fd50 ,0x21f550fc , -0x64b609b9 , -0x8a11f504 , +0x64b60a0d , +0xb0d0fc04 , +0x1bf500d6 , +0x57f000b3 ,0x0076bb00 ,0xf90465b6 ,0x04659450 ,0xbd0256bb ,0x0475fd50 ,0x21f550fc , -0x64b6090c , -0x6a11f404 , -0xbbe05bcb , +0x64b609b7 , +0xd011f504 , +0xe0c5c700 , +0xb60076bb , +0x50f90465 , +0xbb046594 , +0x50bd0256 , +0xfc0475fd , +0x5c21f550 , +0x0464b609 , +0x00ad11f5 , +0xbb0157f0 ,0x65b60076 ,0x9450f904 ,0x56bb0465 ,0xfd50bd02 ,0x50fc0475 , -0x085121f5 , -0xb90464b6 , -0x74bd025b , -/* 0x0b33: i2c_recv_not_rd08 */ -0xb0430ef4 , -0x1bf401d6 , -0x0057f03d , -0x09b921f5 , -0xc73311f4 , -0x21f5e0c5 , -0x11f4095e , -0x0057f029 , -0x09b921f5 , -0xc71f11f4 , -0x21f5e0b5 , -0x11f4095e , -0x5121f515 , -0xc774bd08 , -0x1bf408c5 , -0x0232f409 , -/* 0x0b73: i2c_recv_not_wr08 */ -/* 0x0b73: i2c_recv_done */ -0xc7030ef4 , -0x21f5f8ce , -0xe0fc0a1e , -0x12f4d0fc , -0x027cb90a , -0x033621f5 , -/* 0x0b88: i2c_recv_exit */ -/* 0x0b8a: i2c_init */ -0x00f800f8 , -/* 0x0b8c: test_recv */ -0x05d817f1 , +0x09b721f5 , +0xf50464b6 , +0xbb008a11 , +0x65b60076 , +0x9450f904 , +0x56bb0465 , +0xfd50bd02 , +0x50fc0475 , +0x090a21f5 , +0xf40464b6 , +0x5bcb6a11 , +0x0076bbe0 , +0xf90465b6 , +0x04659450 , +0xbd0256bb , +0x0475fd50 , +0x21f550fc , +0x64b6084f , +0x025bb904 , +0x0ef474bd , +/* 0x0b31: i2c_recv_not_rd08 */ +0x01d6b043 , +0xf03d1bf4 , +0x21f50057 , +0x11f409b7 , +0xe0c5c733 , +0x095c21f5 , +0xf02911f4 , +0x21f50057 , +0x11f409b7 , +0xe0b5c71f , +0x095c21f5 , +0xf51511f4 , +0xbd084f21 , +0x08c5c774 , +0xf4091bf4 , +0x0ef40232 , +/* 0x0b71: i2c_recv_not_wr08 */ +/* 0x0b71: i2c_recv_done */ +0xf8cec703 , +0x0a1c21f5 , +0xd0fce0fc , +0xb90a12f4 , +0x21f5027c , +/* 0x0b86: i2c_recv_exit */ +0x00f80336 , +/* 0x0b88: i2c_init */ +/* 0x0b8a: test_recv */ +0x17f100f8 , +0x14b605d8 , +0x0011cf06 , +0xf10110b6 , +0xb605d807 , +0x01d00604 , +0xf104bd00 , +0xf1d900e7 , +0xf5134fe3 , +0xf8025621 , +/* 0x0bb1: test_init */ +0x00e7f100 , +0x5621f508 , +/* 0x0bbb: idle_recv */ +0xf800f802 , +/* 0x0bbd: idle */ +0x0031f400 , +0x05d417f1 ,0xcf0614b6 ,0x10b60011 , -0xd807f101 , +0xd407f101 ,0x0604b605 ,0xbd0001d0 , -0x00e7f104 , -0x4fe3f1d9 , -0x5621f513 , -/* 0x0bb3: test_init */ -0xf100f802 , -0xf50800e7 , -0xf8025621 , -/* 0x0bbd: idle_recv */ -/* 0x0bbf: idle */ -0xf400f800 , -0x17f10031 , -0x14b605d4 , -0x0011cf06 , -0xf10110b6 , -0xb605d407 , -0x01d00604 , -/* 0x0bdb: idle_loop */ -0xf004bd00 , -0x32f45817 , -/* 0x0be1: idle_proc */ -/* 0x0be1: idle_proc_exec */ -0xb910f902 , -0x21f5021e , -0x10fc033f , -0xf40911f4 , -0x0ef40231 , -/* 0x0bf5: idle_proc_next */ -0x5810b6ef , -0xf4061fb8 , -0x02f4e61b , -0x0028f4dd , -0x00bb0ef4 , +/* 0x0bd9: idle_loop */ +0x5817f004 , +/* 0x0bdf: idle_proc */ +/* 0x0bdf: idle_proc_exec */ +0xf90232f4 , +0x021eb910 , +0x033f21f5 , +0x11f410fc , +0x0231f409 , +/* 0x0bf3: idle_proc_next */ +0xb6ef0ef4 , +0x1fb85810 , +0xe61bf406 , +0xf4dd02f4 , +0x0ef40028 , +0x000000bb ,0x00000000 ,0x00000000 , 0x00000000,
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gk208.fuc5.h +401 -401
917 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gt215.fuc3.h +503 -503
1,125 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/memx.fuc +15 -15
@@ -82,15 +82,15 @@ memx_train_tail: // $r0 - zero memx_func_enter: #if NVKM_PPWR_CHIPSET == GT215 - movw $r8 0x1610 + mov $r8 0x1610 nv_rd32($r7, $r8) imm32($r6, 0xfffffffc) and $r7 $r6 - movw $r6 0x2 + mov $r6 0x2 or $r7 $r6 nv_wr32($r8, $r7) #else - movw $r6 0x001620 + mov $r6 0x001620 imm32($r7, ~0x00000aa2); nv_rd32($r8, $r6) and $r8 $r7
@@ -101,7 +101,7 @@ memx_func_enter: and $r8 $r7 nv_wr32($r6, $r8) - movw $r6 0x0026f0 + mov $r6 0x0026f0 nv_rd32($r8, $r6) and $r8 $r7 nv_wr32($r6, $r8)
@@ -136,19 +136,19 @@ memx_func_leave: bra nz #memx_func_leave_wait #if NVKM_PPWR_CHIPSET == GT215 - movw $r8 0x1610 + mov $r8 0x1610 nv_rd32($r7, $r8) imm32($r6, 0xffffffcc) and $r7 $r6 nv_wr32($r8, $r7) #else - movw $r6 0x0026f0 + mov $r6 0x0026f0 imm32($r7, 0x00000001) nv_rd32($r8, $r6) or $r8 $r7 nv_wr32($r6, $r8) - movw $r6 0x001620 + mov $r6 0x001620 nv_rd32($r8, $r6) or $r8 $r7 nv_wr32($r6, $r8)
@@ -177,11 +177,11 @@ memx_func_wait_vblank: bra #memx_func_wait_vblank_fini memx_func_wait_vblank_head1: - movw $r7 0x20 + mov $r7 0x20 bra #memx_func_wait_vblank_0 memx_func_wait_vblank_head0: - movw $r7 0x8 + mov $r7 0x8 memx_func_wait_vblank_0: nv_iord($r6, NV_PPWR_INPUT)
@@ -273,13 +273,13 @@ memx_func_train: // $r5 - outer loop counter // $r6 - inner loop counter // $r7 - entry counter (#memx_train_head + $r7) - movw $r5 0x3 - movw $r7 0x0 + mov $r5 0x3 + mov $r7 0x0 // Read random memory to wake up... things imm32($r9, 0x700000) nv_rd32($r8,$r9) - movw $r14 0x2710 + mov $r14 0x2710 call(nsec) memx_func_train_loop_outer:
@@ -289,9 +289,9 @@ memx_func_train: nv_wr32($r9, $r8) push $r5 - movw $r6 0x0 + mov $r6 0x0 memx_func_train_loop_inner: - movw $r8 0x1111 + mov $r8 0x1111 mulu $r9 $r6 $r8 shl b32 $r8 $r9 0x10 or $r8 $r9
@@ -315,7 +315,7 @@ memx_func_train: // $r5 - inner inner loop counter // $r9 - result - movw $r5 0 + mov $r5 0 imm32($r9, 0x8300ffff)
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.15.1
Part of the diff is not shown here. View the raw message.
PATCH 137/189 netfilter: x_tables: make allocation less aggressive
In reply to Sasha LevinFrom: Michal Hocko <[email protected]>
[ Upstream commit 0537250fdc6c876ed4cbbe874c739aebef493ee2 ]
syzbot has noticed that xt_alloc_table_info can allocate a lot of memory. This is an admin only interface but an admin in a namespace is sufficient as well. eacd86ca3b03 ("net/netfilter/x_tables.c: use kvmalloc() in xt_alloc_table_info()") has changed the opencoded kmalloc->vmalloc fallback into kvmalloc. It has dropped __GFP_NORETRY on the way because vmalloc has simply never fully supported __GFP_NORETRY semantic. This is still the case because e.g. page tables backing the vmalloc area are hardcoded GFP_KERNEL.
Revert back to __GFP_NORETRY as a poors man defence against excessively large allocation request here. We will not rule out the OOM killer completely but __GFP_NORETRY should at least stop the large request in most cases.
--- net/netfilter/x_tables.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/netfilter/x_tables.c +6 -1
@@ -1008,7 +1008,12 @@ struct xt_table_info *xt_alloc_table_info(unsigned int size)if ((size >>PAGE_SHIFT ) +2 > totalram_pages)return NULL ; - info =kvmalloc (sz,GFP_KERNEL ); +/* __GFP_NORETRY is not fully supported by kvmalloc but it should +* work reasonably well if sz is too large and bail out rather +* than shoot all processes down before realizing there is nothing +* more to reclaim. +*/ + info =kvmalloc (sz,GFP_KERNEL | __GFP_NORETRY);if (!info)return NULL ;
Signature · 1 line
2.15.1
PATCH 142/189 firmware: dmi_scan: Fix handling of empty DMI strings
In reply to Sasha LevinFrom: Jean Delvare <[email protected]>
[ Upstream commit a7770ae194569e96a93c48aceb304edded9cc648 ]
The handling of empty DMI strings looks quite broken to me:
* Strings from 1 to 7 spaces are not considered empty.
* True empty DMI strings (string index set to 0) are not considered empty, and result in allocating a 0-char string.
* Strings with invalid index also result in allocating a 0-char string.
* Strings starting with 8 spaces are all considered empty, even if non-space characters follow (sounds like a weird thing to do, but I have actually seen occurrences of this in DMI tables before.)
* Strings which are considered empty are reported as 8 spaces, instead of being actually empty.
Some of these issues are the result of an off-by-one error in memcmp, the rest is incorrect by design.
So let's get it square: missing strings and strings made of only spaces, regardless of their length, should be treated as empty and no memory should be allocated for them. All other strings are non-empty and should be allocated.
--- drivers/firmware/dmi_scan.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-)
drivers/firmware/dmi_scan.c +9 -13
@@ -18,7 +18,7 @@ EXPORT_SYMBOL_GPL(dmi_kobj);* of and an antecedent to, SMBIOS, which stands for System * Management BIOS. See further: http://www.dmtf.org/standards */ -static const char dmi_empty_string[] =" " ; +static const char dmi_empty_string[] ="" ;static u32 dmi_ver__initdata ;static u32 dmi_len;
@@ -44,25 +44,21 @@ static int dmi_memdev_nr;static const char *__init dmi_string_nosave (const struct dmi_header *dm,u8 s) {const u8 *bp = ((u8 *) dm) + dm->length; +const u8 *nsp;if (s) { - s--; -while (s >0 && *bp) { +while (--s >0 && *bp) bp +=strlen (bp) +1 ; - s--; - } - -if (*bp !=0 ) { -size_t len =strlen (bp)+1 ; -size_t cmp_len = len >8 ?8 : len; -if (!memcmp (bp, dmi_empty_string, cmp_len)) -return dmi_empty_string; +/* Strings containing only spaces are considered empty */ + nsp = bp; +while (*nsp ==' ' ) + nsp++; +if (*nsp !='\0' )return bp; - } } -return "" ; +return dmi_empty_string; }static const char *__init dmi_string (const struct dmi_header *dm,u8 s)
Signature · 1 line
2.15.1