4.14.37-stable review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 2/183 btrfs: fix unaligned access in readdir
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Sterba <[email protected]>
commit 92d32170847bfff2dd08af2c016085779f2fd2a1 upstream.
The last update to readdir introduced a temporary buffer to store the emitted readdir data, but as there are file names of variable length, there's a lot of unaligned access.
This was observed on a sparc64 machine:
Kernel unaligned access at TPC[102f3080] btrfs_real_readdir+0x51c/0x718 [btrfs]
--- fs/btrfs/inode.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
fs/btrfs/inode.c +12 -8
@@ -42,6 +42,7 @@#include <linux/blkdev.h> #include <linux/posix_acl_xattr.h> #include <linux/uio.h> +#include <asm/unaligned.h> #include "ctree.h" #include "disk-io.h" #include "transaction.h"
@@ -5980,11 +5981,13 @@ static int btrfs_filldir(void *addr, intstruct dir_entry *entry = addr;char *name = (char *)(entry +1 ); - ctx->pos = entry->offset; -if (!dir_emit (ctx, name, entry->name_len, entry->ino, - entry->type)) + ctx->pos =get_unaligned (&entry->offset); +if (!dir_emit (ctx, name,get_unaligned (&entry->name_len), +get_unaligned (&entry->ino), +get_unaligned (&entry->type)))return 1 ; - addr +=sizeof (struct dir_entry ) + entry->name_len; + addr +=sizeof (struct dir_entry ) + +get_unaligned (&entry->name_len); ctx->pos++; }return 0 ;
@@ -6078,14 +6081,15 @@ again: } entry = addr; - entry->name_len = name_len; +put_unaligned (name_len, &entry->name_len); name_ptr = (char *)(entry +1 );read_extent_buffer (leaf, name_ptr, (unsigned long )(di +1 ), name_len); - entry->type = btrfs_filetype_table[btrfs_dir_type (leaf, di)]; +put_unaligned (btrfs_filetype_table[btrfs_dir_type (leaf, di)], + &entry->type);btrfs_dir_item_key_to_cpu (leaf, di, &location); - entry->ino = location.objectid; - entry->offset = found_key.offset; +put_unaligned (location.objectid, &entry->ino); +put_unaligned (found_key.offset, &entry->offset); entries++; addr +=sizeof (struct dir_entry ) + name_len; total_len +=sizeof (struct dir_entry ) + name_len;
Greg Kroah-Hartman
maintainerPATCH 3/183 x86/acpi: Prevent X2APIC id 0xffffffff from being accounted
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dou Liyang <[email protected]>
commit 10daf10ab154e31237a8c07242be3063fb6a9bf4 upstream.
RongQing reported that there are some X2APIC id 0xffffffff in his machine's ACPI MADT table, which makes the number of possible CPU inaccurate.
The reason is that the ACPI X2APIC parser has no sanity check for APIC ID 0xffffffff, which is an invalid id in all APIC types. See "Intel® 64 Architecture x2APIC Specification", Chapter 2.4.1.
Add a sanity check to acpi_parse_x2apic() which ignores the invalid id.
--- arch/x86/kernel/acpi/boot.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/x86/kernel/acpi/boot.c +4 -0
@@ -215,6 +215,10 @@ acpi_parse_x2apic(struct acpi_subtable_h apic_id = processor->local_apic_id; enabled = processor->lapic_flags &ACPI_MADT_ENABLED ; +/* Ignore invalid ID */ +if (apic_id ==0xffffffff ) +return 0 ; +/* * We need to register disabled CPU as well to permit * counting disabled CPUs. This allows us to size
Greg Kroah-Hartman
maintainerPATCH 4/183 clocksource/imx-tpm: Correct -ETIME return condition check
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anson Huang <[email protected]>
commit 7407188489c62a7b5694bc75a6db2b82af94c9a5 upstream.
The additional brakects added to tpm_set_next_event's return value computation causes (int) forced type conversion NOT taking effect, and the incorrect value return will cause various system timer issue, like RCU stall etc..
Remove the additional brackets to make sure tpm_set_next_event always returns correct value.
--- drivers/clocksource/timer-imx-tpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clocksource/timer-imx-tpm.c +1 -1
@@ -105,7 +105,7 @@ static int tpm_set_next_event(unsigned l* of writing CNT registers which may cause the min_delta event got * missed, so we need add a ETIME check here in case it happened. */ -return (int )((next - now) <=0 ) ? -ETIME :0 ; +return (int )(next - now) <=0 ? -ETIME :0 ; }static int tpm_set_state_oneshot (struct clock_event_device *evt)
Greg Kroah-Hartman
maintainerPATCH 5/183 x86/tsc: Prevent 32bit truncation in calc_hpet_ref()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiaoming Gao <[email protected]>
commit d3878e164dcd3925a237a20e879432400e369172 upstream.
The TSC calibration code uses HPET as reference. The conversion normalizes the delta of two HPET timestamps:
hpetref = ((tshpet1 - tshpet2) * HPET_PERIOD) / 1e6
and then divides the normalized delta of the corresponding TSC timestamps by the result to calulate the TSC frequency.
tscfreq = ((tstsc1 - tstsc2 ) * 1e6) / hpetref
This uses do_div() which takes an u32 as the divisor, which worked so far because the HPET frequency was low enough that 'hpetref' never exceeded 32bit.
On Skylake machines the HPET frequency increased so 'hpetref' can exceed 32bit. do_div() truncates the divisor, which causes the calibration to fail.
Use div64_u64() to avoid the problem.
[ tglx: Fixes whitespace mangled patch and rewrote changelog ]
--- arch/x86/kernel/tsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/tsc.c +1 -1
@@ -316,7 +316,7 @@ static unsigned long calc_hpet_ref(u64 d hpet2 -= hpet1; tmp = ((u64 )hpet2 *hpet_readl (HPET_PERIOD ));do_div (tmp,1000000 ); -do_div (deltatsc, tmp); + deltatsc =div64_u64 (deltatsc, tmp);return (unsigned long ) deltatsc; }
Greg Kroah-Hartman
maintainerPATCH 6/183 drm/vc4: Fix memory leak during BO teardown
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel J Blueman <[email protected]>
commit c0db1b677e1d584fab5d7ac76a32e1c0157542e0 upstream.
During BO teardown, an indirect list 'uniform_addr_offsets' wasn't being freed leading to leaking many 128B allocations. Fix the memory leak by releasing it at teardown time.
--- drivers/gpu/drm/vc4/vc4_bo.c | 2 ++ drivers/gpu/drm/vc4/vc4_validate_shaders.c | 1 + 2 files changed, 3 insertions(+)
drivers/gpu/drm/vc4/vc4_bo.c +2 -0
@@ -173,6 +173,7 @@ static void vc4_bo_destroy(struct vc4_bovc4_bo_set_label (obj,-1 );if (bo->validated_shader) { +kfree (bo->validated_shader->uniform_addr_offsets);kfree (bo->validated_shader->texture_samples);kfree (bo->validated_shader); bo->validated_shader =NULL ;
@@ -432,6 +433,7 @@ void vc4_free_object(struct drm_gem_obje }if (bo->validated_shader) { +kfree (bo->validated_shader->uniform_addr_offsets);kfree (bo->validated_shader->texture_samples);kfree (bo->validated_shader); bo->validated_shader =NULL ;
drivers/gpu/drm/vc4/vc4_validate_shaders.c +1 -0
@@ -942,6 +942,7 @@ vc4_validate_shader(struct drm_gem_cma_o fail:kfree (validation_state.branch_targets);if (validated_shader) { +kfree (validated_shader->uniform_addr_offsets);kfree (validated_shader->texture_samples);kfree (validated_shader); }
Greg Kroah-Hartman
maintainerPATCH 7/183 drm/i915/gvt: throw error on unhandled vfio ioctls
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gerd Hoffmann <[email protected]>
commit 9f591ae60e1be026901398ef99eede91237aa3a1 upstream.
On unknown/unhandled ioctls the driver should return an error, so userspace knows it tried to use something unsupported.
--- drivers/gpu/drm/i915/gvt/kvmgt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/gvt/kvmgt.c +1 -1
@@ -1153,7 +1153,7 @@ static long intel_vgpu_ioctl(struct mdevreturn 0 ; } -return 0 ; +return -ENOTTY ; } static ssize_t
Greg Kroah-Hartman
maintainerPATCH 8/183 drm/i915/audio: Fix audio detection issue on GLK
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gaurav K Singh <[email protected]>
commit b4615730530be85fc45ab4631c2ad6d8e2d0b97d upstream.
On Geminilake, sometimes audio card is not getting detected after reboot. This is a spurious issue happening on Geminilake. HW codec and HD audio controller link was going out of sync for which there was a fix in i915 driver but was not getting invoked for GLK. Extending this fix to GLK as well.
Tested by Du,Wenkai on GLK board.
Bspec: 21829
v2: Instead of checking GEN9_BC, BXT and GLK macros, use IS_GEN9 macro (Jani N)
--- drivers/gpu/drm/i915/intel_audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_audio.c +1 -1
@@ -704,7 +704,7 @@ static void i915_audio_component_codec_wstruct drm_i915_private *dev_priv =kdev_to_i915 (kdev);u32 tmp; -if (!IS_GEN9_BC (dev_priv)) +if (!IS_GEN9 (dev_priv))return ;i915_audio_component_get_power (kdev);
Greg Kroah-Hartman
maintainerPATCH 9/183 drm/i915: Do no use kfree() to free a kmem_cache_alloc() return value
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xidong Wang <[email protected]>
commit fcf1fadf4c65eea6c519c773d2d9901e8ad94f5f upstream.
Along the eb_lookup_vmas() error path, the return value from kmem_cache_alloc() was freed using kfree(). Fix it to use the proper kmem_cache_free() instead.
--- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_execbuffer.c +1 -1
@@ -722,7 +722,7 @@ static int eb_lookup_vmas(struct i915_ex err =radix_tree_insert (handles_vma, handle, vma);if (unlikely (err)) { -kfree (lut); +kmem_cache_free (eb->i915->luts, lut); goto err_obj; }
Greg Kroah-Hartman
maintainerPATCH 10/183 drm/i915: Fix LSPCON TMDS output buffer enabling from low-power state
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imre Deak <[email protected]>
commit 7eb2c4dd54ff841f2fe509a84973eb25fa20bda2 upstream.
LSPCON adapters in low-power state may ignore the first I2C write during TMDS output buffer enabling, resulting in a blank screen even with an otherwise enabled pipe. Fix this by reading back and validating the written value a few times.
The problem was noticed on GLK machines with an onboard LSPCON adapter after entering/exiting DC5 power state. Doing an I2C read of the adapter ID as the first transaction - instead of the I2C write to enable the TMDS buffers - returns the correct value. Based on this we assume that the transaction itself is sent properly, it's only the adapter that is not ready for some reason to accept this first write after waking from low-power state. In my case the second I2C write attempt always succeeded.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105854
--- drivers/gpu/drm/drm_dp_dual_mode_helper.c | 39 ++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 7 deletions(-)
drivers/gpu/drm/drm_dp_dual_mode_helper.c +32 -7
@@ -350,19 +350,44 @@ int drm_dp_dual_mode_set_tmds_output(enu {uint8_t tmds_oen = enable ?0 :DP_DUAL_MODE_TMDS_DISABLE ;ssize_t ret; +int retry;if (type <DRM_DP_DUAL_MODE_TYPE2_DVI )return 0 ; - ret =drm_dp_dual_mode_write (adapter,DP_DUAL_MODE_TMDS_OEN , - &tmds_oen,sizeof (tmds_oen)); -if (ret) { -DRM_DEBUG_KMS ("Failed to %s TMDS output buffers\n" , - enable ?"enable" :"disable" ); -return ret; +/* +* LSPCON adapters in low-power state may ignore the first write, so +* read back and verify the written value a few times. +*/ +for (retry =0 ; retry <3 ; retry++) { +uint8_t tmp; + + ret =drm_dp_dual_mode_write (adapter,DP_DUAL_MODE_TMDS_OEN , + &tmds_oen,sizeof (tmds_oen)); +if (ret) { +DRM_DEBUG_KMS ("Failed to %s TMDS output buffers (%d attempts)\n" , + enable ?"enable" :"disable" , + retry +1 ); +return ret; + } + + ret =drm_dp_dual_mode_read (adapter,DP_DUAL_MODE_TMDS_OEN , + &tmp,sizeof (tmp)); +if (ret) { +DRM_DEBUG_KMS ("I2C read failed during TMDS output buffer %s (%d attempts)\n" , + enable ?"enabling" :"disabling" , + retry +1 ); +return ret; + } + +if (tmp == tmds_oen) +return 0 ; } -return 0 ; +DRM_DEBUG_KMS ("I2C write value mismatch during TMDS output buffer %s\n" , + enable ?"enabling" :"disabling" ); + +return -EIO ; }EXPORT_SYMBOL (drm_dp_dual_mode_set_tmds_output);
Greg Kroah-Hartman
maintainerPATCH 11/183 drm/i915/bxt, glk: Increase PCODE timeouts during CDCLK freq changing
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imre Deak <[email protected]>
commit 5e1df40f40ee45a97bb1066c3d71f0ae920a9672 upstream.
Currently we see sporadic timeouts during CDCLK changing both on BXT and GLK as reported by the Bugzilla: ticket. It's easy to reproduce this by changing the frequency in a tight loop after blanking the display. The upper bound for the completion time is 800us based on my tests, so increase it from the current 500us to 2ms; with that I couldn't trigger the problem either on BXT or GLK.
Note that timeouts happened during both the change notification and the voltage level setting PCODE request. (For the latter one BSpec doesn't require us to wait for completion before further HW programming.)
This issue is similar to
commit 2c7d0602c815 ("drm/i915/gen9: Fix PCODE polling during CDCLK change notification")
but there the PCODE request does complete (as shown by the mbox busy flag), only the reply we get from PCODE indicates a failure. So there we keep resending the request until a success reply, here we just have to increase the timeout for the one PCODE request we send.
v2:
- s/snb_pcode_request/sandybridge_pcode_write_timeout/ (Ville)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103326
(Rebased for v4.14 stable tree due to upstream cdclk_state and pcu_lock change)
--- drivers/gpu/drm/i915/i915_drv.h | 6 +++++- drivers/gpu/drm/i915/intel_cdclk.c | 22 +++++++++++++++++----- drivers/gpu/drm/i915/intel_pm.c | 6 +++--- 3 files changed, 25 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +5 -1
@@ -3995,7 +3995,11 @@ extern void intel_display_print_error_st struct intel_display_error_state *error);int sandybridge_pcode_read (struct drm_i915_private *dev_priv,u32 mbox,u32 *val); -int sandybridge_pcode_write (struct drm_i915_private *dev_priv,u32 mbox,u32 val); +int sandybridge_pcode_write_timeout (struct drm_i915_private *dev_priv,u32 mbox, +u32 val,int timeout_us); +#define sandybridge_pcode_write (dev_priv, mbox, val) \ + sandybridge_pcode_write_timeout(dev_priv, mbox, val, 500) +int skl_pcode_request (struct drm_i915_private *dev_priv,u32 mbox,u32 request,u32 reply_mask,u32 reply,int timeout_base_ms);
drivers/gpu/drm/i915/intel_cdclk.c +17 -5
@@ -1289,10 +1289,15 @@ static void bxt_set_cdclk(struct drm_i91break ; } -/* Inform power controller of upcoming frequency change */ mutex_lock (&dev_priv->rps.hw_lock); - ret =sandybridge_pcode_write (dev_priv,HSW_PCODE_DE_WRITE_FREQ_REQ , -0x80000000 ); +/* +* Inform power controller of upcoming frequency change. BSpec +* requires us to wait up to 150usec, but that leads to timeouts; +* the 2ms used here is based on experiment. +*/ + ret =sandybridge_pcode_write_timeout (dev_priv, +HSW_PCODE_DE_WRITE_FREQ_REQ , +0x80000000 ,2000 );mutex_unlock (&dev_priv->rps.hw_lock);if (ret) {
@@ -1323,8 +1328,15 @@ static void bxt_set_cdclk(struct drm_i91I915_WRITE (CDCLK_CTL , val);mutex_lock (&dev_priv->rps.hw_lock); - ret =sandybridge_pcode_write (dev_priv,HSW_PCODE_DE_WRITE_FREQ_REQ , -DIV_ROUND_UP (cdclk,25000 )); +/* +* The timeout isn't specified, the 2ms used here is based on +* experiment. +* FIXME: Waiting for the request completion could be delayed until +* the next PCODE request based on BSpec. +*/ + ret =sandybridge_pcode_write_timeout (dev_priv, +HSW_PCODE_DE_WRITE_FREQ_REQ , +DIV_ROUND_UP (cdclk,25000 ),2000 );mutex_unlock (&dev_priv->rps.hw_lock);if (ret) {
drivers/gpu/drm/i915/intel_pm.c +3 -3
@@ -8941,8 +8941,8 @@ int sandybridge_pcode_read(struct drm_i9return 0 ; } -int sandybridge_pcode_write (struct drm_i915_private *dev_priv, -u32 mbox,u32 val) +int sandybridge_pcode_write_timeout (struct drm_i915_private *dev_priv, +u32 mbox,u32 val,int timeout_us) {int status;
@@ -8965,7 +8965,7 @@ int sandybridge_pcode_write(struct drm_iif (__intel_wait_for_register_fw (dev_priv,GEN6_PCODE_MAILBOX ,GEN6_PCODE_READY ,0 , -500 ,0 ,NULL )) { + timeout_us,0 ,NULL )) {DRM_ERROR ("timeout waiting for pcode write of 0x%08x to mbox %x to finish for %ps\n" , val, mbox,__builtin_return_address (0 ));return -ETIMEDOUT ;
Greg Kroah-Hartman
maintainerPATCH 12/183 usb: musb: fix enumeration after resume
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Kemnade <[email protected]>
commit 17539f2f4f0b7fa906b508765c8ada07a1e45f52 upstream.
On dm3730 there are enumeration problems after resume. Investigation led to the cause that the MUSB_POWER_SOFTCONN bit is not set. If it was set before suspend (because it was enabled via musb_pullup()), it is set in musb_restore_context() so the pullup is enabled. But then musb_start() is called which overwrites MUSB_POWER and therefore disables MUSB_POWER_SOFTCONN, so no pullup is enabled and the device is not enumerated.
So let's do a subset of what musb_start() does
in the same way as musb_suspend() does it. Platform-specific stuff it still called as there might be some phy-related stuff which needs to be enabled.
Also interrupts are enabled, as it was the original idea of calling musb_start() in musb_resume() according to Commit 6fc6f4b87cb3 ("usb: musb: Disable interrupts on suspend, enable them on resume")
--- drivers/usb/musb/musb_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/musb/musb_core.c +2 -1
@@ -2733,7 +2733,8 @@ static int musb_resume(struct device *deif ((devctl & mask) != (musb->context.devctl & mask)) musb->port1_status =0 ; -musb_start (musb); +musb_enable_interrupts (musb); +musb_platform_enable (musb);spin_lock_irqsave (&musb->lock, flags); error =musb_run_resume_work (musb);
Greg Kroah-Hartman
maintainerPATCH 18/183 NFSv4: always set NFS_LOCK_LOST when a lock is lost.
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
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
@@ -1885,7 +1885,7 @@ static int nfs4_open_reclaim(struct nfs4return 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 :
@@ -1932,7 +1932,11 @@ static int nfs4_handle_delegation_recallreturn -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;
@@ -1968,7 +1972,7 @@ int nfs4_open_delegation_recall(struct n 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)
@@ -6595,7 +6599,7 @@ int nfs4_lock_delegation_recall(struct fif (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
@@ -1447,6 +1447,7 @@ static int nfs4_reclaim_locks(struct nfsstruct 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;
@@ -1487,7 +1488,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);
Greg Kroah-Hartman
maintainerPATCH 21/183 ASoC: au1x: Fix timeout tests in au1xac97c_ac97_read()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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_rea 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_rea* 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 );
Greg Kroah-Hartman
maintainerPATCH 22/183 kvm: x86: fix KVM_XEN_HVM_CONFIG ioctl
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -4225,13 +4225,14 @@ long kvm_arch_vm_ioctl(struct file *filpmutex_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 ; }
Greg Kroah-Hartman
maintainerPATCH 23/183 RDMA/core: Clarify rdma_ah_find_type
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -3766,8 +3766,7 @@ static inline void rdma_ah_set_grh(strucstatic 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)))
Greg Kroah-Hartman
maintainerPATCH 24/183 KVM: PPC: Book3S HV: Enable migration of decrementer register
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -1837,6 +1837,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
@@ -607,6 +607,8 @@ struct kvm_ppc_rmmu_info {#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
@@ -1497,6 +1497,10 @@ static int kvmppc_get_one_reg_hv(structcase 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 ;
@@ -1724,6 +1728,10 @@ static int kvmppc_set_one_reg_hv(structcase 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
@@ -758,7 +758,7 @@ int kvm_arch_vcpu_init(struct kvm_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);
Greg Kroah-Hartman
maintainerPATCH 25/183 netfilter: ipv6: nf_defrag: Pass on packets to stack per RFC2460
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -230,7 +230,7 @@ static int nf_ct_frag6_queue(struct fragif ((unsigned int )end >IPV6_MAXPLEN ) {pr_debug ("offset is too large.\n" ); -return -1 ; +return -EINVAL ; } ecn =ip6_frag_ecn (ipv6_hdr (skb));
@@ -263,7 +263,7 @@ static int nf_ct_frag6_queue(struct frag* 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. */
@@ -357,7 +357,7 @@ found: discard_fq:inet_frag_kill (&fq->q, &nf_frags); err: -return -1 ; +return -EINVAL ; }/*
@@ -566,6 +566,7 @@ find_prev_fhdr(struct sk_buff *skb, u8 *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;
@@ -599,8 +600,12 @@ int nf_ct_frag6_gather(struct net *net,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; }
Greg Kroah-Hartman
maintainerPATCH 26/183 tracing/hrtimer: Fix tracing bugs by taking all clock bases and modes into account
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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)) );/**
Greg Kroah-Hartman
maintainerPATCH 28/183 platform/x86: dell-laptop: Filter out spurious keyboard backlight change events
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -1177,6 +1177,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.
@@ -2020,6 +2021,7 @@ static enum led_brightness kbd_led_levelstatic 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;
@@ -2049,6 +2051,9 @@ static int kbd_led_level_set(struct led_ } out: +if (ret ==0 ) + kbd_led_level = new_value; +mutex_unlock (&kbd_led_mutex);return ret; }
@@ -2076,6 +2081,9 @@ static int __init kbd_led_init(struct deif (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;
@@ -2100,13 +2108,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 ; }
Greg Kroah-Hartman
maintainerPATCH 29/183 xprtrdma: Fix backchannel allocation of extra rpcrdma_reps
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -951,10 +951,17 @@ rpcrdma_create_req(struct rpcrdma_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;
@@ -979,12 +986,18 @@ rpcrdma_create_rep(struct rpcrdma_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
@@ -1027,17 +1040,10 @@ rpcrdma_buffer_create(struct rpcrdma_xpr }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); }return 0 ;
net/sunrpc/xprtrdma/xprt_rdma.h +1 -1
@@ -550,8 +550,8 @@ int rpcrdma_ep_post_recv(struct rpcrdma_* 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 *);
Greg Kroah-Hartman
maintainerPATCH 31/183 PCI: Add function 1 DMA alias quirk for Marvell 9128
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -3879,6 +3879,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_M 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);
Greg Kroah-Hartman
maintainerPATCH 33/183 libbpf: Makefile set specified permission mode
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
Greg Kroah-Hartman
maintainerPATCH 34/183 Input: synaptics - reset the ABS_X/Y fuzz after initializing MT axes
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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 psmoINPUT_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))
Greg Kroah-Hartman
maintainerPATCH 35/183 i40iw: Free IEQ resources
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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 i4static 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)
@@ -1480,7 +1479,7 @@ static void i40iw_ieq_tx_compl(struct i4* @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
@@ -186,4 +186,5 @@ enum i40iw_status_code i40iw_cqp_qp_creaenum 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
@@ -428,6 +428,7 @@ void i40iw_free_qp_resources(struct i40i {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);
Greg Kroah-Hartman
maintainerPATCH 36/183 i40iw: Zero-out consumer key on allocate stag for FMR
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -1656,6 +1656,7 @@ static struct ib_mr *i40iw_alloc_mr(stru err_code = -EOVERFLOW ; goto err; } + stag &= ~I40IW_CQPSQ_STAG_KEY_MASK ; iwmr->stag = stag; iwmr->ibmr.rkey = stag; iwmr->ibmr.lkey = stag;
Greg Kroah-Hartman
maintainerPATCH 37/183 scsi: qla2xxx: Fix warning in qla2x00_async_iocb_timeout()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "[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 :
Greg Kroah-Hartman
maintainerPATCH 38/183 perf unwind: Do not look just at the global callchain_param.record_mode
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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_eenum 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
@@ -328,9 +328,10 @@ static int report__setup_sample_type(strif (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
@@ -2574,9 +2574,10 @@ static void script__setup_sample_type(stif (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 } 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 *a 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(strucstatic 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); }
Greg Kroah-Hartman
maintainerPATCH 39/183 tools lib traceevent: Simplify pointer print logic and fix %pF
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "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_seelse 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 ; }
Greg Kroah-Hartman
maintainerPATCH 40/183 perf callchain: Fix attr.sample_max_stack setting
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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 pestruct 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 :
Greg Kroah-Hartman
maintainerPATCH 41/183 tools lib traceevent: Fix get_field_str() for dynamic strings
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "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(structstruct 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 */
Greg Kroah-Hartman
maintainerPATCH 43/183 iommu/exynos: Dont unconditionally steal bus ops
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -1344,8 +1344,15 @@ static const struct iommu_ops exynos_iomstatic 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) {
Greg Kroah-Hartman
maintainerPATCH 44/183 powerpc: System reset avoid interleaving oops using die synchronisation
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -336,7 +336,7 @@ void system_reset_exception(struct pt_re* 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 );
Greg Kroah-Hartman
maintainerPATCH 45/183 iommu/vt-d: Use domain instead of cache fetching
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -1603,8 +1603,7 @@ static void iommu_flush_iotlb_psi(struct* 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)
Greg Kroah-Hartman
maintainerPATCH 47/183 dm mpath: return DM_MAPIO_REQUEUE on blk-mq rq allocation failure
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -502,8 +502,20 @@ static int multipath_clone_and_map(strucif (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;
Greg Kroah-Hartman
maintainerPATCH 48/183 blk-mq: turn WARN_ON in __blk_mq_run_hw_queue into printk
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Lei <[email protected]>
[ Upstream commit 7df938fbc4ee641e70e05002ac67c24b19e86e74 ]
We know this WARN_ON is harmless and in reality it may be trigged, so convert it to printk() and dump_stack() to avoid to confusing people.
Also add comment about two releated races here.
--- block/blk-mq.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
block/blk-mq.c +20 -2
@@ -1143,9 +1143,27 @@ static void __blk_mq_run_hw_queue(struct/* * We should be running this queue from one of the CPUs that * are mapped to it. +* +* There are at least two related races now between setting +* hctx->next_cpu from blk_mq_hctx_next_cpu() and running +* __blk_mq_run_hw_queue(): +* +* - hctx->next_cpu is found offline in blk_mq_hctx_next_cpu(), +* but later it becomes online, then this warning is harmless +* at all +* +* - hctx->next_cpu is found online in blk_mq_hctx_next_cpu(), +* but later it becomes offline, then the warning can't be +* triggered, and we depend on blk-mq timeout handler to +* handle dispatched requests to this hctx */ -WARN_ON (!cpumask_test_cpu (raw_smp_processor_id (), hctx->cpumask) && -cpu_online (hctx->next_cpu)); +if (!cpumask_test_cpu (raw_smp_processor_id (), hctx->cpumask) && +cpu_online (hctx->next_cpu)) { +printk (KERN_WARNING "run queue from wrong CPU %d, hctx %s\n" , +raw_smp_processor_id (), +cpumask_empty (hctx->cpumask) ?"inactive" :"active" ); +dump_stack (); + }/* * We can't run the queue inline with ints disabled. Ensure that
Greg Kroah-Hartman
maintainerPATCH 49/183 ubifs: Fix uninitialized variable in search_dh_cookie()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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 ubifsunion 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,
Greg Kroah-Hartman
maintainerPATCH 50/183 net: stmmac: dwmac-meson8b: fix setting the RGMII TX clock on Meson8b
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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 meson 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)))
Greg Kroah-Hartman
maintainerPATCH 51/183 net: stmmac: dwmac-meson8b: propagate rate changes to the parent clock
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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 mesonsnprintf (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 ;
Greg Kroah-Hartman
maintainerPATCH 52/183 spi: a3700: Clear DATA_OUT when performing a read
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -624,6 +624,11 @@ static int a3700_spi_transfer_one(structa3700_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);
Greg Kroah-Hartman
maintainerPATCH 53/183 IB/cq: Dont force IB_POLL_DIRECT poll context for ib_process_cq_direct
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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* 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: 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_po 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 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);
Greg Kroah-Hartman
maintainerPATCH 54/183 nfs: Do not convert nfs_idmap_cache_timeout to jiffies
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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, }, { } };
Greg Kroah-Hartman
maintainerPATCH 55/183 MIPS: Fix clean of vmlinuz.{32,ecoff,bin,srec}
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
Greg Kroah-Hartman
maintainerPATCH 57/183 watchdog: sp5100_tco: Fix watchdog disable bit
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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)
Greg Kroah-Hartman
maintainerPATCH 58/183 kconfig: Dont leak main menus during parsing
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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, *curre %% 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) {
Greg Kroah-Hartman
maintainerPATCH 59/183 kconfig: Fix automatic menu creation mem leak
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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;
Greg Kroah-Hartman
maintainerPATCH 60/183 kconfig: Fix expr_free() E_NOT leak
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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 :
Greg Kroah-Hartman
maintainerPATCH 61/183 mac80211_hwsim: fix possible memory leak in hwsim_new_radio_nl()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "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
@@ -3153,8 +3153,10 @@ static int hwsim_new_radio_nl(struct sk_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]; }
Greg Kroah-Hartman
maintainerPATCH 62/183 ipmi/powernv: Fix error return code in ipmi_powernv_probe()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -251,8 +251,9 @@ static int ipmi_powernv_probe(struct pla 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; }
Greg Kroah-Hartman
maintainerPATCH 63/183 Btrfs: set plug for fsync
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -2018,10 +2018,19 @@ int btrfs_release_file(struct inode *inostatic 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; }
Greg Kroah-Hartman
maintainerPATCH 64/183 btrfs: Fix out of bounds access in btrfs_search_slot
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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;
Greg Kroah-Hartman
maintainerPATCH 65/183 Btrfs: fix scrub to repair raid6 corruption
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -2159,11 +2159,21 @@ int raid56_parity_recover(struct btrfs_f }/* -* 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
@@ -5101,7 +5101,14 @@ int btrfs_num_copies(struct btrfs_fs_infelse 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);
Greg Kroah-Hartman
maintainerPATCH 66/183 btrfs: fail mount when sb flag is not in BTRFS_SUPER_FLAG_SUPP
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -4063,9 +4063,11 @@ static int btrfs_check_super_valid(strucbtrfs_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 );
Greg Kroah-Hartman
maintainerPATCH 67/183 Btrfs: fix unexpected EEXIST from btrfs_get_extent
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -7265,19 +7265,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
@@ -7289,10 +7282,6 @@ insert:free_extent_map (em); em =NULL ; } - }else { -free_extent_map (em); - em = existing; - err =0 ; } }write_unlock (&em_tree->lock);
Greg Kroah-Hartman
maintainerPATCH 68/183 Btrfs: raid56: fix race between merge_bio and rbio_orig_end_io
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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 btrfskfree (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_rstatic 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); }/*
Greg Kroah-Hartman
maintainerPATCH 69/183 RDMA/cma: Check existence of netdevice during port validation
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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(struif ((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 );
Greg Kroah-Hartman
maintainerPATCH 71/183 scsi: devinfo: fix format of the device list
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -109,8 +109,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 */
@@ -120,7 +120,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},
Greg Kroah-Hartman
maintainerPATCH 72/183 scsi: fas216: fix sense buffer initialization
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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_In* 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"); } /*
Greg Kroah-Hartman
maintainerPATCH 73/183 Input: stmfts - set IRQ_NOAUTOEN to the irq flag
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -687,6 +687,14 @@ static int stmfts_probe(struct i2c_clieninput_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,
@@ -694,9 +702,6 @@ static int stmfts_probe(struct i2c_clienif (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);
Greg Kroah-Hartman
maintainerPATCH 74/183 HID: roccat: prevent an out of bounds read in kovaplus_profile_activated()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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(ustatic 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;
Greg Kroah-Hartman
maintainerPATCH 76/183 block: Set BIO_TRACE_COMPLETION on new bio during split
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -1893,7 +1893,7 @@ struct bio *bio_split(struct bio *bio, ibio_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; }
Greg Kroah-Hartman
maintainerPATCH 77/183 bpf: test_maps: cleanup sockmaps when test ends
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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 *#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 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 ); }
Greg Kroah-Hartman
maintainerPATCH 78/183 i40evf: Dont schedule reset_task when device is being removed
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -186,6 +186,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
@@ -1839,6 +1839,12 @@ static void i40evf_reset_task(struct worint i =0 , err;bool running; +/* 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 );
@@ -3022,7 +3028,8 @@ static void i40evf_remove(struct pci_devstruct 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);
Greg Kroah-Hartman
maintainerPATCH 79/183 i40evf: ignore link up if not running
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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.
--- drivers/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
@@ -937,23 +937,34 @@ void i40evf_virtchnl_completion(struct iif (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" );
Greg Kroah-Hartman
maintainerPATCH 81/183 KVM: s390: vsie: use READ_ONCE to access some SCB fields
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -31,7 +31,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 */
@@ -143,12 +147,13 @@ static int shadow_crycb(struct kvm_vcpu {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 ))
@@ -186,12 +191,15 @@ static void prepare_ibc(struct kvm_vcpu {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;
@@ -256,6 +264,10 @@ static int shadow_scb(struct kvm_vcpu *v {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;
@@ -302,14 +314,14 @@ static int shadow_scb(struct kvm_vcpu *v 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 )
@@ -321,11 +333,11 @@ static int shadow_scb(struct kvm_vcpu *vif (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 ; }/* SIMD */ if (test_kvm_facility (vcpu->kvm,129 )) {
@@ -544,9 +556,9 @@ static int pin_blocks(struct kvm_vcpu *vgpa_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 );
@@ -566,7 +578,7 @@ static int pin_blocks(struct kvm_vcpu *v 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 );
@@ -581,7 +593,7 @@ static int pin_blocks(struct kvm_vcpu *v 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 );
@@ -599,7 +611,7 @@ static int pin_blocks(struct kvm_vcpu *v 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 );
@@ -617,8 +629,8 @@ static int pin_blocks(struct kvm_vcpu *vif ((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;
@@ -785,7 +797,7 @@ static void retry_vsie_icpt(struct vsie_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);
Greg Kroah-Hartman
maintainerPATCH 82/183 blk-mq-debugfs: dont allow write on attributes with seq_operations set
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -704,7 +704,11 @@ static ssize_t blk_mq_debugfs_write(struconst 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);
Greg Kroah-Hartman
maintainerPATCH 84/183 igb: Allow to remove administratively set MAC on VFs
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -8373,7 +8373,8 @@ static void igb_rar_set_index(struct igb/* 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 *
@@ -8411,17 +8412,36 @@ static int igb_set_vf_mac(struct igb_adastatic 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); }
Greg Kroah-Hartman
maintainerPATCH 86/183 fm10k: fix "failed to kill vid" message for VF
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -815,8 +815,12 @@ static int fm10k_update_vid(struct net_dif (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 */
@@ -835,6 +839,12 @@ static int fm10k_update_vid(struct net_d 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 */
Greg Kroah-Hartman
maintainerPATCH 87/183 x86/hyperv: Stop suppressing X86_FEATURE_PCID
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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(cons }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(c }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;
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Greg Kroah-Hartman
maintainerPATCH 88/183 tty: serial: exar: Relocate sleep wake-up handling
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -37,6 +37,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 */
@@ -124,6 +125,7 @@ struct exar8250_board {struct exar8250 {unsigned int nr;struct exar8250_board *board; +void __iomem *virt;int line[0 ]; };
@@ -134,12 +136,9 @@ static int default_setup(struct exar8250const 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 ;
@@ -423,6 +422,25 @@ static void pci_xr17v35x_exit(struct pci 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) {
@@ -451,6 +469,9 @@ exar_pci_probe(struct pci_dev *pcidev, creturn -ENOMEM ; priv->board = board; + priv->virt =pcim_iomap (pcidev, bar,0 ); +if (!priv->virt) +return -ENOMEM ;pci_set_master (pcidev);
@@ -464,6 +485,11 @@ exar_pci_probe(struct pci_dev *pcidev, c 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
@@ -458,7 +458,6 @@ static void io_serial_out(struct uart_po }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) {
@@ -1904,26 +1903,6 @@ static int serial8250_default_handle_irq }/* -* 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 * the IIR register. In this case, the THRE interrupt indicates the FIFO
@@ -3107,11 +3086,6 @@ static void serial8250_config_port(strucif (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; }
Greg Kroah-Hartman
maintainerPATCH 89/183 device property: Define type of PROPERTY_ENRTY_*() macros
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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_, \ }
Greg Kroah-Hartman
maintainerPATCH 90/183 crypto: artpec6 - remove select on non-existing CRYPTO_SHA384
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -721,7 +721,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
Greg Kroah-Hartman
maintainerPATCH 91/183 RDMA/uverbs: Use an unambiguous errno for method not supported
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -245,16 +245,13 @@ static long ib_uverbs_cmd_verbs(struct iuintptr_t data[UVERBS_OPTIMIZE_USING_STACK_SZ /sizeof (uintptr_t )];#endif -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 ;
@@ -310,6 +307,16 @@ static long ib_uverbs_cmd_verbs(struct i 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:#ifdef UVERBS_OPTIMIZE_USING_STACK_SZ if (ctx_size >UVERBS_OPTIMIZE_USING_STACK_SZ )
@@ -348,7 +355,7 @@ long ib_uverbs_ioctl(struct file *filp, }if (hdr.reserved) { - err = -EOPNOTSUPP ; + err = -EPROTONOSUPPORT ; goto out; }
Greg Kroah-Hartman
maintainerPATCH 92/183 jffs2: Fix use-after-free bug in jffs2_iget()s error handling path
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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); }
Greg Kroah-Hartman
maintainerPATCH 93/183 ixgbe: dont set RXDCTL.RLPML for 82599
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -3987,11 +3987,15 @@ void ixgbe_configure_rx_ring(struct ixgb 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 |
Greg Kroah-Hartman
maintainerPATCH 94/183 i40e: program fragmented IPv4 filter input set
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -3648,6 +3648,16 @@ static int i40e_check_fdir_input_set(stri40e_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
@@ -5828,6 +5828,9 @@ static void i40e_fdir_filter_exit(struct/* 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 ); }/**
Greg Kroah-Hartman
maintainerPATCH 95/183 i40e: fix reported mask for ntuple filters
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -2588,16 +2588,16 @@ static int i40e_get_ethtool_fdir_entry(s 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 ;
Greg Kroah-Hartman
maintainerPATCH 96/183 samples/bpf: Partially fixes the bpf.o build
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "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
@@ -179,13 +179,16 @@ LLC ?= llc CLANG ?= clang # 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)
Greg Kroah-Hartman
maintainerPATCH 98/183 powerpc/numa: Ensure nodes initialized for hotplug
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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 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(v 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:
@@ -1277,6 +1275,40 @@ static long vphn_get_associativity(unsigreturn 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
@@ -1344,7 +1376,6 @@ int numa_update_cpu_topology(bool cpus_l {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 ;
@@ -1379,11 +1410,7 @@ int numa_update_cpu_topology(bool cpus_lcontinue ; } -/* 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,
Greg Kroah-Hartman
maintainerPATCH 99/183 RDMA/mlx5: Avoid memory leak in case of XRCD dealloc failure
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -4636,13 +4636,10 @@ int mlx5_ib_dealloc_xrcd(struct ib_xrcdint 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 ; }
Greg Kroah-Hartman
maintainerPATCH 101/183 gianfar: prevent integer wrapping in the rx handler
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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 irqstatic 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 gfarif (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 */
Greg Kroah-Hartman
maintainerPATCH 102/183 x86/hyperv: Check for required priviliges in hyperv_init()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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 );
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Greg Kroah-Hartman
maintainerPATCH 103/183 netfilter: x_tables: fix pointer leaks to userspace
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -256,6 +256,7 @@ static struct xt_target idletimer_tg __r .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 __rea .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 __re .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 __r .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_r .checkentry = statistic_mt_check, .destroy = statistic_mt_destroy, .matchsize = sizeof(struct xt_statistic_info), + .usersize = offsetof(struct xt_statistic_info, master), .me = THIS_MODULE, };
Greg Kroah-Hartman
maintainerPATCH 104/183 tcp_nv: fix potential integer overflow in tcpnv_acked
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "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
@@ -327,7 +327,7 @@ static void tcpnv_acked(struct sock *sk,*/ 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
Greg Kroah-Hartman
maintainerPATCH 105/183 kvm: Map PFN-type memory regions as writable (if possible)
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -1434,7 +1434,8 @@ static bool vma_is_valid(struct vm_area_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;
@@ -1460,6 +1461,8 @@ static int hva_to_pfn_remapped(struct vm } +if (writable) + *writable = true;/* * Get a reference here because callers of *hva_to_pfn* and
@@ -1525,7 +1528,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 )
Greg Kroah-Hartman
maintainerPATCH 106/183 x86/kvm/vmx: do not use vm-exit instruction length for fast MMIO when running nested
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -6765,7 +6765,21 @@ static int handle_ept_misconfig(struct kif (!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
@@ -5699,7 +5699,8 @@ int x86_emulate_instruction(struct kvm_v* 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 ;
Greg Kroah-Hartman
maintainerPATCH 107/183 fs/dax.c: release PMD lock even when there is no PMD support in DAX
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "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
@@ -630,8 +630,8 @@ static void dax_mapping_entry_mkclean(stset_pmd_at (vma->vm_mm, address, pmdp, pmd);mmu_notifier_invalidate_range (vma->vm_mm, start, end); unlock_pmd: -spin_unlock (ptl);#endif +spin_unlock (ptl); }else {if (pfn !=pte_pfn (*ptep)) goto unlock_pte;
Greg Kroah-Hartman
maintainerPATCH 108/183 ocfs2: return -EROFS to mount.ocfs2 if inode block is invalid
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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_inod 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_inode 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;
Greg Kroah-Hartman
maintainerPATCH 113/183 asm-generic: provide generic_pmdp_establish()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "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(sextern 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);
Greg Kroah-Hartman
maintainerPATCH 115/183 mm: thp: use down_read_trylock() in khugepaged to avoid long block
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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_sspin_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++;
Greg Kroah-Hartman
maintainerPATCH 117/183 mm/fadvise: discard partial page if endbyte is also EOF
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "shidao.ytt" <[email protected]>
[ Upstream commit a7ab400d6fe73d0119fdc234e9982a6f80faea9f ]
During our recent testing with fadvise(FADV_DONTNEED), we find that if given offset/length is not page-aligned, the last page will not be discarded. The tool we use is vmtouch (https://hoytech.com/vmtouch/),
we map a 10KB-sized file into memory and then try to run this tool to evict the whole file mapping, but the last single page always remains staying in the memory:
$./vmtouch -e test_10K
Files: 1
Directories: 0
Evicted Pages: 3 (12K)
Elapsed: 2.1e-05 seconds
$./vmtouch test_10K
Files: 1
Directories: 0
Resident Pages: 1/3 4K/12K 33.3%
Elapsed: 5.5e-05 seconds
However when we test with an older kernel, say 3.10, this problem is gone. So we wonder if this is a regression:
$./vmtouch -e test_10K
Files: 1
Directories: 0
Evicted Pages: 3 (12K)
Elapsed: 8.2e-05 seconds
$./vmtouch test_10K
Files: 1
Directories: 0
Resident Pages: 0/3 0/12K 0% <-- partial page also discarded
Elapsed: 5e-05 seconds
After digging a little bit into this problem, we find it seems not a regression. Not discarding partial page is likely to be on purpose according to commit 441c228f817f ("mm: fadvise: document the fadvise(FADV_DONTNEED) behaviour for partial pages") written by Mel Gorman. He explained why partial pages should be preserved instead of being discarded when using fadvise(FADV_DONTNEED).
However, the interesting part is that the actual code did NOT work as the same as it was described, the partial page was still discarded anyway, due to a calculation mistake of `end_index' passed to invalidate_mapping_pages(). This mistake has not been fixed until recently, that's why we fail to reproduce our problem in old kernels. The fix is done in commit 18aba41cbf ("mm/fadvise.c: do not discard partial pages with POSIX_FADV_DONTNEED") by Oleg Drokin.
Back to the original testing, our problem becomes that there is a special case that, if the page-unaligned `endbyte' is also the end of file, it is not necessary at all to preserve the last partial page, as we all know no one else will use the rest of it. It should be safe enough if we just discard the whole page. So we add an EOF check in this patch.
We also find a poosbile real world issue in mainline kernel. Assume such scenario: A userspace backup application want to backup a huge amount of small files (<4k) at once, the developer might (I guess) want to use fadvise(FADV_DONTNEED) to save memory. However, FADV_DONTNEED won't really happen since the only page mapped is a partial page, and kernel will preserve it. Our patch also fixes this problem, since we know the endbyte is EOF, so we discard it.
Here is a simple reproducer to reproduce and verify each scenario we described above:
test_fadvise.c
==============================
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
int main(int argc, char **argv)
{
int i, fd, ret, len;
struct stat buf;
void *addr;
unsigned char *vec;
char *strbuf;
ssize_t pagesize = getpagesize();
ssize_t filesize;
fd = open(argv[1], O_RDWR|O_CREAT, S_IRUSR|S_IWUSR);
if (fd < 0)
return -1;
filesize = strtoul(argv[2], NULL, 10);
strbuf = malloc(filesize);
memset(strbuf, 42, filesize);
write(fd, strbuf, filesize);
free(strbuf);
fsync(fd);
len = (filesize + pagesize - 1) / pagesize;
printf("length of pages: %d\n", len);
addr = mmap(NULL, filesize, PROT_READ, MAP_SHARED, fd, 0);
if (addr == MAP_FAILED)
return -1;
ret = posix_fadvise(fd, 0, filesize, POSIX_FADV_DONTNEED);
if (ret < 0)
return -1;
vec = malloc(len);
ret = mincore(addr, filesize, (void *)vec);
if (ret < 0)
return -1;
for (i = 0; i < len; i++)
printf("pages[%d]: %x\n", i, vec[i] & 0x1);
free(vec);
close(fd);
return 0;
}
==============================Test 1: running on kernel with commit 18aba41cbf reverted:
[root@caspar ~]# uname -r
4.15.0-rc6.revert+
[root@caspar ~]# ./test_fadvise file1 1024
length of pages: 1
pages[0]: 0 # <-- partial page discarded
[root@caspar ~]# ./test_fadvise file2 8192
length of pages: 2
pages[0]: 0
pages[1]: 0
[root@caspar ~]# ./test_fadvise file3 10240
length of pages: 3
pages[0]: 0
pages[1]: 0
pages[2]: 0 # <-- partial page discarded
Test 2: running on mainline kernel:
[root@caspar ~]# uname -r
4.15.0-rc6+
[root@caspar ~]# ./test_fadvise test1 1024
length of pages: 1
pages[0]: 1 # <-- partial and the only page not discarded
[root@caspar ~]# ./test_fadvise test2 8192
length of pages: 2
pages[0]: 0
pages[1]: 0
[root@caspar ~]# ./test_fadvise test3 10240
length of pages: 3
pages[0]: 0
pages[1]: 0
pages[2]: 1 # <-- partial page not discarded
Test 3: running on kernel with this patch:
[root@caspar ~]# uname -r
4.15.0-rc6.patched+
[root@caspar ~]# ./test_fadvise test1 1024
length of pages: 1
pages[0]: 0 # <-- partial page and EOF, discarded
[root@caspar ~]# ./test_fadvise test2 8192
length of pages: 2
pages[0]: 0
pages[1]: 0
[root@caspar ~]# ./test_fadvise test3 10240
length of pages: 3
pages[0]: 0
pages[1]: 0
pages[2]: 0 # <-- partial page and EOF, discarded
--- mm/fadvise.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
mm/fadvise.c +9 -1
@@ -127,7 +127,15 @@ SYSCALL_DEFINE4(fadvise64_64, int, fd, l*/ start_index = (offset+(PAGE_SIZE -1 )) >>PAGE_SHIFT ; end_index = (endbyte >>PAGE_SHIFT ); -if ((endbyte & ~PAGE_MASK ) != ~PAGE_MASK ) { +/* +* The page at end_index will be inclusively discarded according +* by invalidate_mapping_pages(), so subtracting 1 from +* end_index means we will skip the last page. But if endbyte +* is page aligned or is at the end of file, we should not skip +* that page - discarding the last page is safe enough. +*/ +if ((endbyte & ~PAGE_MASK ) != ~PAGE_MASK && + endbyte != inode->i_size -1 ) {/* First page is tricky as 0 - 1 = -1, but pgoff_t * is unsigned, so the end_index >= start_index * check below would be true and we'll discard the whole
Greg Kroah-Hartman
maintainerPATCH 119/183 blk-mq: fix discard merge with scheduler attached
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -3065,6 +3065,8 @@ void blk_rq_bio_prep(struct request_queu {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(structreturn !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(str* 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(str 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
Greg Kroah-Hartman
maintainerPATCH 120/183 IB/hfi1: Re-order IRQ cleanup to address driver cleanup race
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "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
@@ -8294,8 +8294,8 @@ static irqreturn_t sdma_interrupt(int ir/* 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 ; }
@@ -12967,7 +12967,14 @@ static void disable_intx(struct pci_devpci_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;
@@ -13344,7 +13351,7 @@ static int set_up_interrupts(struct hfi1return 0 ; fail: -clean_up_interrupts (dd); +hfi1_clean_up_interrupts (dd);return ret; }
@@ -14770,7 +14777,6 @@ void hfi1_start_cleanup(struct hfi1_devdaspm_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
@@ -1954,6 +1954,7 @@ void hfi1_verbs_unregister_sysfs(structint 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
@@ -1039,8 +1039,9 @@ static void shutdown_device(struct hfi1_ } 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;
@@ -1696,6 +1697,7 @@ static int init_one(struct pci_dev *pdevdd_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) {
Greg Kroah-Hartman
maintainerPATCH 121/183 IB/hfi1: Fix for potential refcount leak in hfi1_open_file()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -191,9 +191,6 @@ static int hfi1_file_open(struct inode *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 );
@@ -203,6 +200,7 @@ static int hfi1_file_open(struct inode * fd->mm = current->mm;mmgrab (fd->mm); fd->dd = dd; +kobject_get (&fd->dd->kobj); fp->private_data = fd; }else { fp->private_data =NULL ;
Greg Kroah-Hartman
maintainerPATCH 122/183 IB/ipoib: Fix for potential no-carrier state
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -2273,6 +2273,9 @@ static struct net_device *ipoib_add_port 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",
Greg Kroah-Hartman
maintainerPATCH 123/183 IB/core: Map iWarp AH type to undefined in rdma_ah_find_type
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -866,6 +866,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 ,
@@ -3762,17 +3763,24 @@ static inline void rdma_ah_set_grh(struc 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 ; }/**
Greg Kroah-Hartman
maintainerPATCH 124/183 drm/nouveau/pmu/fuc: dont use movw directly anymore
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
--- drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gf100.fuc3.h | 746 +++++------ drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gk208.fuc5.h | 802 +++++------ drivers/gpu/drm/nouveau/nvkm/subdev/pmu/fuc/gt215.fuc3.h | 1006 +++++++-------- drivers/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.
Part of the diff is not shown here. View the raw message.
Greg Kroah-Hartman
maintainerPATCH 125/183 s390/eadm: fix CONFIG_BLOCK include dependency
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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;
Greg Kroah-Hartman
maintainerPATCH 126/183 netfilter: ipv6: nf_defrag: Kill frag queue on RFC2460 failure
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Subash Abhinov Kasiviswanathan <[email protected]>
[ Upstream commit ea23d5e3bf340e413b8e05c13da233c99c64142b ]
Failures were seen in ICMPv6 fragmentation timeout tests if they were run after the RFC2460 failure tests. Kernel was not sending out the ICMPv6 fragment reassembly time exceeded packet after the fragmentation reassembly timeout of 1 minute had elapsed.
This happened because the frag queue was not released if an error in IPv6 fragmentation header was detected by RFC2460.
--- net/ipv6/netfilter/nf_conntrack_reasm.c | 1 + 1 file changed, 1 insertion(+)
net/ipv6/netfilter/nf_conntrack_reasm.c +1 -0
@@ -263,6 +263,7 @@ static int nf_ct_frag6_queue(struct frag* this case. -DaveM */ pr_debug ("end of fragment not rounded to 8 bytes.\n" ); +inet_frag_kill (&fq->q, &nf_frags);return -EPROTO ; }if (end > fq->q.len) {
Greg Kroah-Hartman
maintainerPATCH 127/183 x86/power: Fix swsusp_arch_resume prototype
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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_lev#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(struextern 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 );
Greg Kroah-Hartman
maintainerPATCH 128/183 x86/dumpstack: Avoid uninitlized variable
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit ebfc15019cfa72496c674ffcb0b8ef10790dcddc ]
In some configurations, 'partial' does not get initialized, as shown by this gcc-8 warning:
arch/x86/kernel/dumpstack.c: In function 'show_trace_log_lvl':arch/x86/kernel/dumpstack.c:156:4: error: 'partial' may be used uninitialized in this function [-Werror=maybe-uninitialized]
show_regs_if_on_stack(&stack_info, regs, partial);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~This initializes it to false, to get the previous behavior in this case.
--- arch/x86/kernel/dumpstack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/dumpstack.c +1 -1
@@ -109,7 +109,7 @@ void show_trace_log_lvl(struct task_strustruct stack_info stack_info = {0 };unsigned long visit_mask =0 ;int graph_idx =0 ; -bool partial; +bool partial = false;printk ("%sCall Trace:\n" , log_lvl);
Greg Kroah-Hartman
maintainerPATCH 129/183 firmware: dmi_scan: Fix handling of empty DMI strings
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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)
Greg Kroah-Hartman
maintainerPATCH 130/183 ACPI: processor_perflib: Do not send _PPC change notification if not ready
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Yu <[email protected]>
[ Upstream commit ba1edb9a5125a617d612f98eead14b9b84e75c3a ]
The following warning was triggered after resumed from S3 - if all the nonboot CPUs were put offline before suspend:
[ 1840.329515] unchecked MSR access error: RDMSR from 0x771 at rIP: 0xffffffff86061e3a (native_read_msr+0xa/0x30) [ 1840.329516] Call Trace: [ 1840.329521] __rdmsr_on_cpu+0x33/0x50 [ 1840.329525] generic_exec_single+0x81/0xb0 [ 1840.329527] smp_call_function_single+0xd2/0x100 [ 1840.329530] ? acpi_ds_result_pop+0xdd/0xf2 [ 1840.329532] ? acpi_ds_create_operand+0x215/0x23c [ 1840.329534] rdmsrl_on_cpu+0x57/0x80 [ 1840.329536] ? cpumask_next+0x1b/0x20 [ 1840.329538] ? rdmsrl_on_cpu+0x57/0x80 [ 1840.329541] intel_pstate_update_perf_limits+0xf3/0x220 [ 1840.329544] ? notifier_call_chain+0x4a/0x70 [ 1840.329546] intel_pstate_set_policy+0x4e/0x150 [ 1840.329548] cpufreq_set_policy+0xcd/0x2f0 [ 1840.329550] cpufreq_update_policy+0xb2/0x130 [ 1840.329552] ? cpufreq_update_policy+0x130/0x130 [ 1840.329556] acpi_processor_ppc_has_changed+0x65/0x80 [ 1840.329558] acpi_processor_notify+0x80/0x100 [ 1840.329561] acpi_ev_notify_dispatch+0x44/0x5c [ 1840.329563] acpi_os_execute_deferred+0x14/0x20 [ 1840.329565] process_one_work+0x193/0x3c0 [ 1840.329567] worker_thread+0x35/0x3b0 [ 1840.329569] kthread+0x125/0x140 [ 1840.329571] ? process_one_work+0x3c0/0x3c0 [ 1840.329572] ? kthread_park+0x60/0x60 [ 1840.329575] ? do_syscall_64+0x67/0x180 [ 1840.329577] ret_from_fork+0x25/0x30 [ 1840.329585] unchecked MSR access error: WRMSR to 0x774 (tried to write 0x0000000000000000) at rIP: 0xffffffff86061f78 (native_write_msr+0x8/0x30) [ 1840.329586] Call Trace: [ 1840.329587] __wrmsr_on_cpu+0x37/0x40 [ 1840.329589] generic_exec_single+0x81/0xb0 [ 1840.329592] smp_call_function_single+0xd2/0x100 [ 1840.329594] ? acpi_ds_create_operand+0x215/0x23c [ 1840.329595] ? cpumask_next+0x1b/0x20 [ 1840.329597] wrmsrl_on_cpu+0x57/0x70 [ 1840.329598] ? rdmsrl_on_cpu+0x57/0x80 [ 1840.329599] ? wrmsrl_on_cpu+0x57/0x70 [ 1840.329602] intel_pstate_hwp_set+0xd3/0x150 [ 1840.329604] intel_pstate_set_policy+0x119/0x150 [ 1840.329606] cpufreq_set_policy+0xcd/0x2f0 [ 1840.329607] cpufreq_update_policy+0xb2/0x130 [ 1840.329610] ? cpufreq_update_policy+0x130/0x130 [ 1840.329613] acpi_processor_ppc_has_changed+0x65/0x80 [ 1840.329615] acpi_processor_notify+0x80/0x100 [ 1840.329617] acpi_ev_notify_dispatch+0x44/0x5c [ 1840.329619] acpi_os_execute_deferred+0x14/0x20 [ 1840.329620] process_one_work+0x193/0x3c0 [ 1840.329622] worker_thread+0x35/0x3b0 [ 1840.329624] kthread+0x125/0x140 [ 1840.329625] ? process_one_work+0x3c0/0x3c0 [ 1840.329626] ? kthread_park+0x60/0x60 [ 1840.329628] ? do_syscall_64+0x67/0x180 [ 1840.329631] ret_from_fork+0x25/0x30
This is because if there's only one online CPU, the MSR_PM_ENABLE (package wide)can not be enabled after resumed, due to intel_pstate_hwp_enable() will only be invoked on AP's online process after resumed - if there's no AP online, the HWP remains disabled after resumed (BIOS has disabled it in S3). Then if there comes a _PPC change notification which touches HWP register during this stage, the warning is triggered.
Since we don't call acpi_processor_register_performance() when HWP is enabled, the pr->performance will be NULL. When this is NULL we don't need to do _PPC change notification.
--- drivers/acpi/processor_perflib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/processor_perflib.c +1 -1
@@ -159,7 +159,7 @@ void acpi_processor_ppc_has_changed(stru {int ret; -if (ignore_ppc) { +if (ignore_ppc || !pr->performance) {/* * Only when it is notification event, the _OST object * will be evaluated. Otherwise it is skipped.
Greg Kroah-Hartman
maintainerPATCH 131/183 ACPI / bus: Do not call _STA on battery devices with unmet dependencies
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 54ddce7062242036402242242c07c60c0b505f84 ]
The battery code uses acpi_device->dep_unmet to check for unmet deps and if there are unmet deps it does not bind to the device to avoid errors about missing OpRegions when calling ACPI methods on the device.
The missing OpRegions when there are unmet deps problem also applies to the _STA method of some battery devices and calling it too early 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)This commit fixes these errors happening when acpi_get_bus_status gets called by checking dep_unmet for battery devices and reporting a status of 0 until all dependencies are met.
--- drivers/acpi/bus.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/acpi/bus.c +6 -0
@@ -146,6 +146,12 @@ int acpi_bus_get_status(struct acpi_devireturn 0 ; } +/* Battery devices must have their deps met before calling _STA */ +if (acpi_device_is_battery (device) && device->dep_unmet) { +acpi_set_device_status (device,0 ); +return 0 ; + } + status =acpi_bus_get_status_handle (device->handle, &sta);if (ACPI_FAILURE (status))return -ENODEV ;
Greg Kroah-Hartman
maintainerPATCH 132/183 ACPI / scan: Use acpi_bus_get_status() to initialize ACPI_TYPE_DEVICE devs
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -1568,6 +1568,8 @@ void acpi_init_device_object(struct acpidevice_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)
@@ -1591,6 +1593,14 @@ static int acpi_add_single_object(struct }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);
@@ -1663,9 +1673,11 @@ static int acpi_bus_type_and_status(acpireturn -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 ;
@@ -1763,6 +1775,8 @@ static void acpi_device_dep_initialize(sacpi_status status;int i; + adev->dep_unmet =0 ; +if (!acpi_has_method (adev->handle,"_DEP" ))return ;
Greg Kroah-Hartman
maintainerPATCH 133/183 bpf: fix selftests/bpf test_kmod.sh failure when CONFIG_BPF_JIT_ALWAYS_ON=y
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yonghong Song <[email protected]>
[ Upstream commit 09584b406742413ac4c8d7e030374d4daa045b69 ]
With CONFIG_BPF_JIT_ALWAYS_ON is defined in the config file, tools/testing/selftests/bpf/test_kmod.sh failed like below:
[root@localhost bpf]# ./test_kmod.sh
sysctl: setting key "net.core.bpf_jit_enable": Invalid argument [ JIT enabled:0 hardened:0 ]
[ 132.175681] test_bpf: #297 BPF_MAXINSNS: Jump, gap, jump, ... FAIL to prog_create err=-524 len=4096 [ 132.458834] test_bpf: Summary: 348 PASSED, 1 FAILED, [340/340 JIT'ed] [ JIT enabled:1 hardened:0 ] [ 133.456025] test_bpf: #297 BPF_MAXINSNS: Jump, gap, jump, ... FAIL to prog_create err=-524 len=4096 [ 133.730935] test_bpf: Summary: 348 PASSED, 1 FAILED, [340/340 JIT'ed] [ JIT enabled:1 hardened:1 ] [ 134.769730] test_bpf: #297 BPF_MAXINSNS: Jump, gap, jump, ... FAIL to prog_create err=-524 len=4096 [ 135.050864] test_bpf: Summary: 348 PASSED, 1 FAILED, [340/340 JIT'ed] [ JIT enabled:1 hardened:2 ] [ 136.442882] test_bpf: #297 BPF_MAXINSNS: Jump, gap, jump, ... FAIL to prog_create err=-524 len=4096 [ 136.821810] test_bpf: Summary: 348 PASSED, 1 FAILED, [340/340 JIT'ed] [root@localhost bpf]#
The test_kmod.sh load/remove test_bpf.ko multiple times with different settings for sysctl net.core.bpf_jit_{enable,harden}. The failed test #297 of test_bpf.ko is designed such that JIT always fails.
Commit 290af86629b2 (bpf: introduce BPF_JIT_ALWAYS_ON config) introduced the following tightening logic:
...
if (!bpf_prog_is_dev_bound(fp->aux)) {
fp = bpf_int_jit_compile(fp);
#ifdef CONFIG_BPF_JIT_ALWAYS_ON
if (!fp->jited) {
*err = -ENOTSUPP;
return fp;
}
#endif
...With this logic, Test #297 always gets return value -ENOTSUPP when CONFIG_BPF_JIT_ALWAYS_ON is defined, causing the test failure.
This patch fixed the failure by marking Test #297 as expected failure when CONFIG_BPF_JIT_ALWAYS_ON is defined.
--- lib/test_bpf.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-)
lib/test_bpf.c +26 -5
@@ -83,6 +83,7 @@ struct bpf_test {__u32 result; } test[MAX_SUBTESTS ];int (*fill_helper)(struct bpf_test *self); +int expected_errcode;/* used when FLAG_EXPECTED_FAIL is set in the aux */ __u8 frag_data[MAX_DATA ];int stack_depth;/* for eBPF only, since tests don't call verifier */ };
@@ -1987,7 +1988,9 @@ static struct bpf_test tests[] = { }, CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL, { }, - { } + { }, + .fill_helper = NULL, + .expected_errcode = -EINVAL, }, { "check: div_k_0",
@@ -1997,7 +2000,9 @@ static struct bpf_test tests[] = { }, CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL, { }, - { } + { }, + .fill_helper = NULL, + .expected_errcode = -EINVAL, }, { "check: unknown insn",
@@ -2008,7 +2013,9 @@ static struct bpf_test tests[] = { }, CLASSIC | FLAG_EXPECTED_FAIL, { }, - { } + { }, + .fill_helper = NULL, + .expected_errcode = -EINVAL, }, { "check: out of range spill/fill",
@@ -2018,7 +2025,9 @@ static struct bpf_test tests[] = { }, CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL, { }, - { } + { }, + .fill_helper = NULL, + .expected_errcode = -EINVAL, }, { "JUMPS + HOLES",
@@ -2110,6 +2119,8 @@ static struct bpf_test tests[] = { CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL, { }, { }, + .fill_helper = NULL, + .expected_errcode = -EINVAL , }, { "check: LDX + RET X",
@@ -2120,6 +2131,8 @@ static struct bpf_test tests[] = { CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL, { }, { }, + .fill_helper = NULL, + .expected_errcode = -EINVAL , }, { /* Mainly checking JIT here. */ "M[]: alt STX + LDX",
@@ -2294,6 +2307,8 @@ static struct bpf_test tests[] = { CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL, { }, { }, + .fill_helper = NULL, + .expected_errcode = -EINVAL , }, { /* Passes checker but fails during runtime. */ "LD [SKF_AD_OFF-1]",
@@ -5356,6 +5371,7 @@ static struct bpf_test tests[] = { { }, { }, .fill_helper = bpf_fill_maxinsns4, + .expected_errcode = -EINVAL, }, {/* Mainly checking JIT here. */ "BPF_MAXINSNS: Very long jump",
@@ -5411,10 +5427,15 @@ static struct bpf_test tests[] = { { "BPF_MAXINSNS: Jump, gap, jump, ...", { }, +#ifdef CONFIG_BPF_JIT_ALWAYS_ON + CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL, +#else CLASSIC | FLAG_NO_DATA, +#endif { }, { { 0, 0xababcbac } }, .fill_helper = bpf_fill_maxinsns11, + .expected_errcode = -ENOTSUPP, }, { "BPF_MAXINSNS: ld_abs+get_processor_id",
@@ -6193,7 +6214,7 @@ static struct bpf_prog *generate_filter( *err =bpf_prog_create (&fp, &fprog);if (tests[which].aux &FLAG_EXPECTED_FAIL ) { -if (*err == -EINVAL ) { +if (*err == tests[which].expected_errcode) {pr_cont ("PASS\n" );/* Verifier rejected filter as expected. */ *err =0 ;
Greg Kroah-Hartman
maintainerPATCH 134/183 MIPS: generic: Fix machine compatible matching
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Hogan <[email protected]>
[ Upstream commit 9a9ab3078e2744a1a55163cfaec73a5798aae33e ]
We now have a platform (Ranchu) in the "generic" platform which matches based on the FDT compatible string using mips_machine_is_compatible(), however that function doesn't stop at a blank struct of_device_id::compatible as that is an array in the struct, not a pointer to a string.
Fix the loop completion to check the first byte of the compatible array rather than the address of the compatible array in the struct.
Patchwork: https://patchwork.linux-mips.org/patch/18580/
--- arch/mips/include/asm/machine.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/include/asm/machine.h +1 -1
@@ -52,7 +52,7 @@ mips_machine_is_compatible(const structif (!mach->matches)return NULL ; -for (match = mach->matches; match->compatible; match++) { +for (match = mach->matches; match->compatible[0 ]; match++) {if (fdt_node_check_compatible (fdt,0 , match->compatible) ==0 )return match; }
Greg Kroah-Hartman
maintainerPATCH 146/183 cifs: silence compiler warnings showing up with gcc-8.0.0
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit ade7db991b47ab3016a414468164f4966bd08202 ]
This bug was fixed before, but came up again with the latest compiler in another function:
fs/cifs/cifssmb.c: In function 'CIFSSMBSetEA':fs/cifs/cifssmb.c:6362:3: error: 'strncpy' offset 8 is out of the bounds [0, 4] [-Werror=array-bounds]
strncpy(parm_data->list[0].name, ea_name, name_len);
Let's apply the same fix that was used for the other instances.
--- fs/cifs/cifssmb.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/cifs/cifssmb.c +1 -3
@@ -6331,9 +6331,7 @@ SetEARetry: pSMB->InformationLevel =cpu_to_le16 (SMB_SET_FILE_EA ); - parm_data = - (struct fealist *) (((char *) &pSMB->hdr.Protocol) + - offset); + parm_data = (void *)pSMB + offsetof(struct smb_hdr , Protocol) + offset; pSMB->ParameterOffset =cpu_to_le16 (param_offset); pSMB->DataOffset =cpu_to_le16 (offset); pSMB->SetupCount =1 ;
Greg Kroah-Hartman
maintainerPATCH 147/183 bcache: properly set task state in bch_writeback_thread()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Coly Li <[email protected]>
[ Upstream commit 99361bbf26337186f02561109c17a4c4b1a7536a ]
Kernel thread routine bch_writeback_thread() has the following code block,
447 down_write(&dc->writeback_lock);
448~450 if (check conditions) {
451 up_write(&dc->writeback_lock);
452 set_current_state(TASK_INTERRUPTIBLE);
453
454 if (kthread_should_stop())
455 return 0;
456
457 schedule();
458 continue;
459 }
If condition check is true, its task state is set to TASK_INTERRUPTIBLE and call schedule() to wait for others to wake up it.
There are 2 issues in current code,
1, Task state is set to TASK_INTERRUPTIBLE after the condition checks, if
another process changes the condition and call wake_up_process(dc-> writeback_thread), then at line 452 task state is set back to TASK_INTERRUPTIBLE, the writeback kernel thread will lose a chance to be waken up.
2, At line 454 if kthread_should_stop() is true, writeback kernel thread
will return to kernel/kthread.c:kthread() with TASK_INTERRUPTIBLE and call do_exit(). It is not good to enter do_exit() with task state TASK_INTERRUPTIBLE, in following code path might_sleep() is called and a warning message is reported by __might_sleep(): "WARNING: do not call blocking ops when !TASK_RUNNING; state=1 set at [xxxx]".
For the first issue, task state should be set before condition checks. Ineed because dc->writeback_lock is required when modifying all the conditions, calling set_current_state() inside code block where dc-> writeback_lock is hold is safe. But this is quite implicit, so I still move set_current_state() before all the condition checks.
For the second issue, frankley speaking it does not hurt when kernel thread exits with TASK_INTERRUPTIBLE state, but this warning message scares users, makes them feel there might be something risky with bcache and hurt their data. Setting task state to TASK_RUNNING before returning fixes this problem.
In alloc.c:allocator_wait(), there is also a similar issue, and is also fixed in this patch.
Changelog:
v3: merge two similar fixes into one patch
v2: fix the race issue in v1 patch.
v1: initial buggy fix.
--- drivers/md/bcache/alloc.c | 4 +++- drivers/md/bcache/writeback.c | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-)
drivers/md/bcache/alloc.c +3 -1
@@ -287,8 +287,10 @@ do { \break ; \ \mutex_unlock (&(ca)->set->bucket_lock); \ -if (kthread_should_stop ()) \ +if (kthread_should_stop ()) { \ +set_current_state (TASK_RUNNING ); \return 0 ; \ + } \ \schedule (); \mutex_lock (&(ca)->set->bucket_lock); \
drivers/md/bcache/writeback.c +5 -2
@@ -420,18 +420,21 @@ static int bch_writeback_thread(void *arwhile (!kthread_should_stop ()) {down_write (&dc->writeback_lock); +set_current_state (TASK_INTERRUPTIBLE );if (!atomic_read (&dc->has_dirty) || (!test_bit (BCACHE_DEV_DETACHING , &dc->disk.flags) && !dc->writeback_running)) {up_write (&dc->writeback_lock); -set_current_state (TASK_INTERRUPTIBLE ); -if (kthread_should_stop ()) +if (kthread_should_stop ()) { +set_current_state (TASK_RUNNING );return 0 ; + }schedule ();continue ; } +set_current_state (TASK_RUNNING ); searched_full_index =refill_dirty (dc);
Greg Kroah-Hartman
maintainerPATCH 148/183 bcache: fix for allocator and register thread race
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -1868,14 +1868,17 @@ void bch_initial_gc_finish(struct cache_*/ 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
@@ -1829,6 +1829,7 @@ void bch_cache_release(struct kobject *kstatic int cache_alloc (struct cache *ca) {size_t free; +size_t btree_buckets;struct bucket *b;__module_get (THIS_MODULE );
@@ -1836,9 +1837,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) ||
Greg Kroah-Hartman
maintainerPATCH 155/183 net: Extra _get in declaration of arch_get_platform_mac_address
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathieu Malaterre <[email protected]>
[ Upstream commit e728789c52afccc1275cba1dd812f03abe16ea3c ]
In commit c7f5d105495a ("net: Add eth_platform_get_mac_address() helper."), two declarations were added:
int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr); unsigned char *arch_get_platform_get_mac_address(void);
An extra '_get' was introduced in arch_get_platform_get_mac_address, remove it. Fix compile warning using W=1:
CC net/ethernet/eth.onet/ethernet/eth.c:523:24: warning: no previous prototype for ‘arch_get_platform_mac_address’ [-Wmissing-prototypes]
unsigned char * __weak arch_get_platform_mac_address(void)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
AR net/ethernet/built-in.o
--- include/linux/etherdevice.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/etherdevice.h +1 -1
@@ -31,7 +31,7 @@#ifdef __KERNEL__struct device ;int eth_platform_get_mac_address (struct device *dev,u8 *mac_addr); -unsigned char *arch_get_platform_get_mac_address (void ); +unsigned char *arch_get_platform_mac_address (void );u32 eth_get_headlen (void *data,unsigned int max_len);__be16 eth_type_trans (struct sk_buff *skb,struct net_device *dev);extern const struct header_ops eth_header_ops;
Greg Kroah-Hartman
maintainerPATCH 156/183 tools/libbpf: handle issues with bpf ELF objects containing .eh_frames
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -661,6 +661,24 @@ bpf_object__init_maps(struct bpf_objectreturn bpf_object__validate_maps (obj); } +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;
@@ -742,6 +760,14 @@ static int bpf_object__elf_collect(struc }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);
Greg Kroah-Hartman
maintainerPATCH 157/183 KVM: PPC: Book3S HV: Fix handling of secondary HPTEG in HPT resizing code
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Mackerras <[email protected]>
[ Upstream commit 05f2bb0313a2855e491dadfc8319b7da261d7074 ]
This fixes the computation of the HPTE index to use when the HPT resizing code encounters a bolted HPTE which is stored in its secondary HPTE group. The code inverts the HPTE group number, which is correct, but doesn't then mask it with new_hash_mask. As a result, new_pteg will be effectively negative, resulting in new_hptep pointing before the new HPT, which will corrupt memory.
In addition, this removes two BUG_ON statements. The condition that the BUG_ONs were testing -- that we have computed the hash value incorrectly -- has never been observed in testing, and if it did occur, would only affect the guest, not the host. Given that BUG_ON should only be used in conditions where the kernel (i.e. the host kernel, in this case) can't possibly continue execution, it is not appropriate here.
--- arch/powerpc/kvm/book3s_64_mmu_hv.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
arch/powerpc/kvm/book3s_64_mmu_hv.c +2 -6
@@ -1348,12 +1348,8 @@ static unsigned long resize_hpt_rehash_h } new_pteg = hash & new_hash_mask; -if (vpte &HPTE_V_SECONDARY ) { -BUG_ON (~pteg != (hash & old_hash_mask)); - new_pteg = ~new_pteg; - }else { -BUG_ON (pteg != (hash & old_hash_mask)); - } +if (vpte &HPTE_V_SECONDARY ) + new_pteg = ~hash & new_hash_mask; new_idx = new_pteg *HPTES_PER_GROUP + (idx %HPTES_PER_GROUP ); new_hptep = (__be64 *)(new->virt + (new_idx <<4 ));
Greg Kroah-Hartman
maintainerPATCH 158/183 SUNRPC: Dont call __UDPX_INC_STATS() from a preemptible context
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -1069,18 +1069,18 @@ static void xs_udp_data_read_skb(struct/* 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:
Greg Kroah-Hartman
maintainerPATCH 159/183 net: stmmac: discard disabled flags in interrupt status register
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <[email protected]>
[ Upstream commit 1b84ca187510f60f00f4e15255043ce19bb30410 ]
The interrupt status register in both dwmac1000 and dwmac4 ignores interrupt enable (for dwmac4) / interrupt mask (for dwmac1000). Therefore, if we want to check only the bits that can actually trigger an irq, we have to filter the interrupt status register manually.
Commit 0a764db10337 ("stmmac: Discard masked flags in interrupt status register") fixed this for dwmac1000. Fix the same issue for dwmac4.
Just like commit 0a764db10337 ("stmmac: Discard masked flags in interrupt status register"), this makes sure that we do not get spurious link up/link down prints.
--- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +4 -2
@@ -562,10 +562,12 @@ static int dwmac4_irq_status(struct mac_ struct stmmac_extra_stats *x) {void __iomem *ioaddr = hw->pcsr; -u32 intr_status; +u32 intr_status =readl (ioaddr +GMAC_INT_STATUS ); +u32 intr_enable =readl (ioaddr +GMAC_INT_EN );int ret =0 ; - intr_status =readl (ioaddr +GMAC_INT_STATUS ); +/* Discard disabled bits */ + intr_status &= intr_enable;/* Not used events (e.g. MMC interrupts) are not handled. */ if ((intr_status & mmc_tx_irq))
Greg Kroah-Hartman
maintainerPATCH 160/183 bpf: fix rlimit in reuseport net selftest
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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_paramsstruct 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" );
Greg Kroah-Hartman
maintainerPATCH 161/183 ACPI / EC: Restore polling during noirq suspend/resume phases
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Rafael J. Wysocki" <[email protected]>
[ Upstream commit 3cd091a773936c54344a519f7ee1379ccb620bee ]
Commit 662591461c4b (ACPI / EC: Drop EC noirq hooks to fix a regression) modified the ACPI EC driver so that it doesn't switch over to busy polling mode during noirq stages of system suspend and resume in an attempt to fix an issue resulting from that behavior.
However, that modification introduced a system resume regression on Thinkpad X240, so make the EC driver switch over to the polling mode during noirq stages of system suspend and resume again, which effectively reverts the problematic commit.
--- drivers/acpi/ec.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/acpi/ec.c +6 -0
@@ -1927,6 +1927,9 @@ static int acpi_ec_suspend_noirq(struct ec->reference_count >= 1)acpi_set_gpe (NULL , ec->gpe,ACPI_GPE_DISABLE ); +if (acpi_sleep_no_ec_events ()) +acpi_ec_enter_noirq (ec); +return 0 ; }
@@ -1934,6 +1937,9 @@ static int acpi_ec_resume_noirq(struct d {struct acpi_ec *ec =acpi_driver_data (to_acpi_device (dev)); +if (acpi_sleep_no_ec_events ()) +acpi_ec_leave_noirq (ec); +if (ec_no_wakeup &&test_bit (EC_FLAGS_STARTED , &ec->flags) && ec->reference_count >=1 )acpi_set_gpe (NULL , ec->gpe,ACPI_GPE_ENABLE );
Greg Kroah-Hartman
maintainerPATCH 162/183 PM / wakeirq: Fix unbalanced IRQ enable for wakeirq
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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_irqreturn ;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_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); } }
Greg Kroah-Hartman
maintainerPATCH 163/183 vfs/proc/kcore, x86/mm/kcore: Fix SMAP fault when dumping vsyscall user page
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jia Zhang <[email protected]>
[ Upstream commit 595dd46ebfc10be041a365d0a3fa99df50b6ba73 ]
Commit:
df04abfd181a ("fs/proc/kcore.c: Add bounce buffer for ktext data")
... introduced a bounce buffer to work around CONFIG_HARDENED_USERCOPY=y. However, accessing the vsyscall user page will cause an SMAP fault.
Replace memcpy() with copy_from_user() to fix this bug works, but adding a common way to handle this sort of user page may be useful for future.
Currently, only vsyscall page requires KCORE_USER.
--- arch/x86/mm/init_64.c | 3 +-- fs/proc/kcore.c | 4 ++++ include/linux/kcore.h | 1 + 3 files changed, 6 insertions(+), 2 deletions(-)
arch/x86/mm/init_64.c +1 -2
@@ -1180,8 +1180,7 @@ void __init mem_init(void) after_bootmem =1 ;/* Register memory areas for /proc/kcore */ -kclist_add (&kcore_vsyscall, (void *)VSYSCALL_ADDR , -PAGE_SIZE ,KCORE_OTHER ); +kclist_add (&kcore_vsyscall, (void *)VSYSCALL_ADDR ,PAGE_SIZE ,KCORE_USER );mem_init_print_info (NULL ); }
fs/proc/kcore.c +4 -0
@@ -510,6 +510,10 @@ read_kcore(struct file *file, char __use/* we have to zero-fill user buffer even if no read */ if (copy_to_user (buffer, buf, tsz))return -EFAULT ; + }else if (m->type ==KCORE_USER ) { +/* User page is handled prior to normal kernel page: */ +if (copy_to_user (buffer, (char *)start, tsz)) +return -EFAULT ; }else {if (kern_addr_valid (start)) {/*
include/linux/kcore.h +1 -0
@@ -10,6 +10,7 @@ enum kcore_type {KCORE_VMALLOC ,KCORE_RAM ,KCORE_VMEMMAP , +KCORE_USER , KCORE_OTHER, };
Greg Kroah-Hartman
maintainerPATCH 165/183 x86/platform/UV: Fix GAM Range Table entries less than 1GB
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "[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
@@ -1140,16 +1140,25 @@ static void __init decode_gam_rng_tbl(un 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;
Greg Kroah-Hartman
maintainerPATCH 166/183 locking/qspinlock: Ensure node->count is updated before initialising node
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
[ Upstream commit 11dc13224c975efcec96647a4768a6f1bb7a19a8 ]
When queuing on the qspinlock, the count field for the current CPU's head node is incremented. This needn't be atomic because locking in e.g. IRQ context is balanced and so an IRQ will return with node->count as it found it.
However, the compiler could in theory reorder the initialisation of node[idx] before the increment of the head node->count, causing an IRQ to overwrite the initialised node and potentially corrupt the lock state.
Avoid the potential for this harmful compiler reordering by placing a barrier() between the increment of the head node->count and the subsequent node initialisation.
--- kernel/locking/qspinlock.c | 8 ++++++++ 1 file changed, 8 insertions(+)
kernel/locking/qspinlock.c +8 -0
@@ -379,6 +379,14 @@ queue: tail =encode_tail (smp_processor_id (), idx); node += idx; + +/* +* Ensure that we increment the head node->count before initialising +* the actual node. If the compiler is kind enough to reorder these +* stores, then an IRQ could overwrite our assignments. +*/ +barrier (); + node->locked =0 ; node->next =NULL ;pv_init_node (node);
Greg Kroah-Hartman
maintainerPATCH 167/183 powerpc/powernv: IMC fix out of bounds memory access at shutdown
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Piggin <[email protected]>
[ Upstream commit e7bde88cdb4f0e432398a7d29ca2a15d2c18952a ]
The OPAL IMC driver's shutdown handler disables nest PMU counters by walking nodes and taking the first CPU out of their cpumask, which is used to index into the paca (get_hard_smp_processor_id()). This does not always do the right thing, and in particular for CPU-less nodes it returns NR_CPUS and that overruns the paca and dereferences random memory.
Fix it by being more careful about checking returned CPU, and only using online CPUs. It's not clear this shutdown code makes sense after commit 885dcd709b ("powerpc/perf: Add nest IMC PMU support"), but this should not make things worse
Currently the bug causes us to call OPAL with a junk CPU number. A separate patch in development to change the way pacas are allocated escalates this bug into a crash:
Unable to handle kernel paging request for data at address 0x2a21af1eeb000076 Faulting instruction address: 0xc0000000000a5468 Oops: Kernel access of bad area, sig: 11 [#1] ... NIP opal_imc_counters_shutdown+0x148/0x1d0 LR opal_imc_counters_shutdown+0x134/0x1d0 Call Trace: opal_imc_counters_shutdown+0x134/0x1d0 (unreliable) platform_drv_shutdown+0x44/0x60 device_shutdown+0x1f8/0x350 kernel_restart_prepare+0x54/0x70 kernel_restart+0x28/0xc0 SyS_reboot+0x1d0/0x2c0 system_call+0x58/0x6c
--- arch/powerpc/platforms/powernv/opal-imc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/powerpc/platforms/powernv/opal-imc.c +4 -2
@@ -126,9 +126,11 @@ static void disable_nest_pmu_counters(voconst struct cpumask *l_cpumask;get_online_cpus (); -for_each_online_node (nid) { +for_each_node_with_cpus (nid) { l_cpumask =cpumask_of_node (nid); - cpu =cpumask_first (l_cpumask); + cpu =cpumask_first_and (l_cpumask, cpu_online_mask); +if (cpu >= nr_cpu_ids) +continue ;opal_imc_counters_stop (OPAL_IMC_COUNTERS_NEST ,get_hard_smp_processor_id (cpu)); }
Greg Kroah-Hartman
maintainerPATCH 168/183 perf test: Fix test trace+probe_libc_inet_pton.sh for s390x
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Richter <[email protected]>
[ Upstream commit 7a92453620d42c3a5fea94a864dc6aa04c262b93 ]
On Intel test case trace+probe_libc_inet_pton.sh succeeds and the output is:
[root@f27 perf]# ./perf trace --no-syscalls
-e probe_libc:inet_pton/max-stack=3/ ping -6 -c 1 ::1
PING ::1(::1) 56 data bytes
64 bytes from ::1: icmp_seq=1 ttl=64 time=0.037 ms
--- ::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.037/0.037/0.037/0.000 ms
0.000 probe_libc:inet_pton:(7fa40ac618a0))
__GI___inet_pton (/usr/lib64/libc-2.26.so)
getaddrinfo (/usr/lib64/libc-2.26.so)
main (/usr/bin/ping)The kernel stack unwinder is used, it is specified implicitly as call-graph=fp (frame pointer).
On s390x only dwarf is available for stack unwinding. It is also done in user space. This requires different parameter setup and result checking for s390x and Intel.
This patch adds separate perf trace setup and result checking for Intel and s390x. On s390x specify this command line to get a call-graph and handle the different call graph result checking:
[root@s35lp76 perf]# ./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.041 ms
--- ::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.041/0.041/0.041/0.000 ms
0.000 probe_libc:inet_pton:(3ffb9942060))
__GI___inet_pton (/usr/lib64/libc-2.26.so)
gaih_inet (inlined)
__GI_getaddrinfo (inlined)
main (/usr/bin/ping)
__libc_start_main (/usr/lib64/libc-2.26.so)
_start (/usr/bin/ping)[root@s35lp76 perf]#
Before:
[root@s8360047 perf]# ./perf test -vv 58
58: probe libc's inet_pton & backtrace it with ping :
--- start ---
test child forked, pid 26349
PING ::1(::1) 56 data bytes
64 bytes from ::1: icmp_seq=1 ttl=64 time=0.079 ms
--- ::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.079/0.079/0.079/0.000 ms 0.000 probe_libc:inet_pton:(3ff925c2060))
test child finished with -1
---- end ----
probe libc's inet_pton & backtrace it with ping: FAILED! [root@s8360047 perf]#
After:
[root@s35lp76 perf]# ./perf test -vv 57
57: probe libc's inet_pton & backtrace it with ping :
--- start ---
test child forked, pid 38708
PING ::1(::1) 56 data bytes
64 bytes from ::1: icmp_seq=1 ttl=64 time=0.038 ms
--- ::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.038/0.038/0.038/0.000 ms 0.000 probe_libc:inet_pton:(3ff87342060)) __GI___inet_pton (/usr/lib64/libc-2.26.so) gaih_inet (inlined)__GI_getaddrinfo (inlined)
main (/usr/bin/ping)__libc_start_main (/usr/lib64/libc-2.26.so)_start (/usr/bin/ping)
test child finished with 0
---- end ----
probe libc's inet_pton & backtrace it with ping: Ok [root@s35lp76 perf]#
On Intel the test case runs unchanged and succeeds.
--- tools/perf/tests/shell/trace+probe_libc_inet_pton.sh | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
tools/perf/tests/shell/trace+probe_libc_inet_pton.sh +17 -4
@@ -22,10 +22,23 @@ trace_libc_inet_pton_backtrace() { expected[4]="rtt min.*" expected[5]="[0-9]+\.[0-9]+[[:space:]]+probe_libc:inet_pton:\([[:xdigit:]]+\)" expected[6]=".*inet_pton[[:space:]]\($libc\)$" - expected[7]="getaddrinfo[[:space:]]\($libc\)$" - expected[8]=".*\(.*/bin/ping.*\)$" + case "$(uname -m)" in + s390x) + eventattr='call-graph=dwarf' + expected[7]="gaih_inet[[:space:]]\(inlined\)$" + expected[8]="__GI_getaddrinfo[[:space:]]\(inlined\)$" + expected[9]="main[[:space:]]\(.*/bin/ping.*\)$" + expected[10]="__libc_start_main[[:space:]]\($libc\)$" + expected[11]="_start[[:space:]]\(.*/bin/ping.*\)$" + ;; + *) + eventattr='max-stack=3' + expected[7]="getaddrinfo[[:space:]]\($libc\)$" + expected[8]=".*\(.*/bin/ping.*\)$" + ;; + esac - perf trace --no-syscalls -e probe_libc:inet_pton/max-stack=3/ ping -6 -c 1 ::1 2>&1 | grep -v ^$ | while read line ; do + perf trace --no-syscalls -e probe_libc:inet_pton/$eventattr/ ping -6 -c 1 ::1 2>&1 | grep -v ^$ | while read line ; do echo $line echo "$line" | egrep -q "${expected[$idx]}" if [ $? -ne 0 ] ; then
@@ -33,7 +46,7 @@ trace_libc_inet_pton_backtrace() { exit 1 fi let idx+=1 - [ $idx -eq 9 ] && break + [ -z "${expected[$idx]}" ] && break done }
Greg Kroah-Hartman
maintainerPATCH 169/183 irqchip/gic-v3: Ignore disabled ITS nodes
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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(vofor (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(voidfor (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
@@ -3083,6 +3083,8 @@ static int __init its_of_probe(struct defor (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 ;
Greg Kroah-Hartman
maintainerPATCH 171/183 irqchip/gic-v3: Change pr_debug message to pr_devel
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Salter <[email protected]>
[ Upstream commit b6dd4d83dc2f78cebc9a7e6e7e4bc2be4d29b94d ]
The pr_debug() in gic-v3 gic_send_sgi() can trigger a circular locking warning:
GICv3: CPU10: ICC_SGI1R_EL1 5000400
======================================================
WARNING: possible circular locking dependency detected
4.15.0+ #1 Tainted: G W
------------------------------------------------------
dynamic_debug01/1873 is trying to acquire lock:
((console_sem).lock){-...}, at: [<0000000099c891ec>] down_trylock+0x20/0x4c
but task is already holding lock:
(&rq->lock){-.-.}, at: [<00000000842e1587>] __task_rq_lock+0x54/0xdc
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 (&rq->lock){-.-.}:
__lock_acquire+0x3b4/0x6e0
lock_acquire+0xf4/0x2a8
_raw_spin_lock+0x4c/0x60
task_fork_fair+0x3c/0x148
sched_fork+0x10c/0x214
copy_process.isra.32.part.33+0x4e8/0x14f0
_do_fork+0xe8/0x78c
kernel_thread+0x48/0x54
rest_init+0x34/0x2a4
start_kernel+0x45c/0x488-> #1 (&p->pi_lock){-.-.}:
__lock_acquire+0x3b4/0x6e0
lock_acquire+0xf4/0x2a8
_raw_spin_lock_irqsave+0x58/0x70
try_to_wake_up+0x48/0x600
wake_up_process+0x28/0x34
__up.isra.0+0x60/0x6c
up+0x60/0x68
__up_console_sem+0x4c/0x7c
console_unlock+0x328/0x634
vprintk_emit+0x25c/0x390
dev_vprintk_emit+0xc4/0x1fc
dev_printk_emit+0x88/0xa8
__dev_printk+0x58/0x9c
_dev_info+0x84/0xa8
usb_new_device+0x100/0x474
hub_port_connect+0x280/0x92c
hub_event+0x740/0xa84
process_one_work+0x240/0x70c
worker_thread+0x60/0x400
kthread+0x110/0x13c
ret_from_fork+0x10/0x18-> #0 ((console_sem).lock){-...}:
validate_chain.isra.34+0x6e4/0xa20
__lock_acquire+0x3b4/0x6e0
lock_acquire+0xf4/0x2a8
_raw_spin_lock_irqsave+0x58/0x70
down_trylock+0x20/0x4c
__down_trylock_console_sem+0x3c/0x9c
console_trylock+0x20/0xb0
vprintk_emit+0x254/0x390
vprintk_default+0x58/0x90
vprintk_func+0xbc/0x164
printk+0x80/0xa0
__dynamic_pr_debug+0x84/0xac
gic_raise_softirq+0x184/0x18c
smp_cross_call+0xac/0x218
smp_send_reschedule+0x3c/0x48
resched_curr+0x60/0x9c
check_preempt_curr+0x70/0xdc
wake_up_new_task+0x310/0x470
_do_fork+0x188/0x78c
SyS_clone+0x44/0x50
__sys_trace_return+0x0/0x4other info that might help us debug this:
Chain exists of: (console_sem).lock --> &p->pi_lock --> &rq->lock Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&rq->lock);
lock(&p->pi_lock);
lock(&rq->lock);lock((console_sem).lock);
*** DEADLOCK ***
2 locks held by dynamic_debug01/1873:
#0: (&p->pi_lock){-.-.}, at: [<000000001366df53>] wake_up_new_task+0x40/0x470 #1: (&rq->lock){-.-.}, at: [<00000000842e1587>] __task_rq_lock+0x54/0xdc
stack backtrace: CPU: 10 PID: 1873 Comm: dynamic_debug01 Tainted: G W 4.15.0+ #1 Hardware name: GIGABYTE R120-T34-00/MT30-GS2-00, BIOS T48 10/02/2017 Call trace: dump_backtrace+0x0/0x188 show_stack+0x24/0x2c dump_stack+0xa4/0xe0 print_circular_bug.isra.31+0x29c/0x2b8 check_prev_add.constprop.39+0x6c8/0x6dc validate_chain.isra.34+0x6e4/0xa20 __lock_acquire+0x3b4/0x6e0 lock_acquire+0xf4/0x2a8 _raw_spin_lock_irqsave+0x58/0x70 down_trylock+0x20/0x4c __down_trylock_console_sem+0x3c/0x9c console_trylock+0x20/0xb0 vprintk_emit+0x254/0x390 vprintk_default+0x58/0x90 vprintk_func+0xbc/0x164 printk+0x80/0xa0 __dynamic_pr_debug+0x84/0xac gic_raise_softirq+0x184/0x18c smp_cross_call+0xac/0x218 smp_send_reschedule+0x3c/0x48 resched_curr+0x60/0x9c check_preempt_curr+0x70/0xdc wake_up_new_task+0x310/0x470 _do_fork+0x188/0x78c SyS_clone+0x44/0x50 __sys_trace_return+0x0/0x4 GICv3: CPU0: ICC_SGI1R_EL1 12000
This could be fixed with printk_deferred() but that might lessen its usefulness for debugging. So change it to pr_devel to keep it out of production kernels. Developers working on gic-v3 can enable it as needed in their kernels.
--- drivers/irqchip/irq-gic-v3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-gic-v3.c +1 -1
@@ -645,7 +645,7 @@ static void gic_send_sgi(u64 cluster_id,MPIDR_TO_SGI_AFFINITY (cluster_id,1 ) | tlist << ICC_SGI1R_TARGET_LIST_SHIFT); -pr_debug ("CPU%d: ICC_SGI1R_EL1 %llx\n" ,smp_processor_id (), val); +pr_devel ("CPU%d: ICC_SGI1R_EL1 %llx\n" ,smp_processor_id (), val);gic_write_sgi1r (val); }
Greg Kroah-Hartman
maintainerPATCH 172/183 RDMA/core: Reduce poll batch for direct cq polling
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Max Gurtovoy <[email protected]>
[ Upstream commit d3b9e8ad425cfd5b9116732e057f1b48e4d3bcb8 ]
Fix warning limit for kernel stack consumption:
drivers/infiniband/core/cq.c: In function 'ib_process_cq_direct':drivers/infiniband/core/cq.c:78:1: error: the frame size of 1032 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
Using smaller ib_wc array on the stack brings us comfortably below that limit again.
--- drivers/infiniband/core/cq.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/infiniband/core/cq.c +11 -10
@@ -17,6 +17,7 @@/* # of WCs to poll for with a single call to ib_poll_cq */ #define IB_POLL_BATCH 16 +#define IB_POLL_BATCH_DIRECT 8/* # of WCs to iterate over before yielding */ #define IB_POLL_BUDGET_IRQ 256
@@ -25,18 +26,18 @@#define IB_POLL_FLAGS \ (IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS) -static int __ib_process_cq (struct ib_cq *cq,int budget,struct ib_wc *poll_wc) +static int __ib_process_cq (struct ib_cq *cq,int budget,struct ib_wc *wcs, +int batch) {int i, n, completed =0 ; -struct ib_wc *wcs = poll_wc ? : cq->wc;/* * budget might be (-1) if the caller does not * want to bound this call, thus we need unsigned * minimum here. */ -while ((n =ib_poll_cq (cq,min_t (u32,IB_POLL_BATCH , - budget - completed), wcs)) >0 ) { +while ((n =ib_poll_cq (cq,min_t (u32, batch, + budget - completed), wcs)) >0 ) {for (i =0 ; i < n; i++) {struct ib_wc *wc = &wcs[i];
@@ -48,8 +49,7 @@ static int __ib_process_cq(struct ib_cq completed += n; -if (n !=IB_POLL_BATCH || - (budget !=-1 && completed >= budget)) +if (n != batch || (budget !=-1 && completed >= budget))break ; }
@@ -72,9 +72,9 @@ static int __ib_process_cq(struct ib_cq*/ int ib_process_cq_direct (struct ib_cq *cq,int budget) { -struct ib_wc wcs[IB_POLL_BATCH ]; +struct ib_wc wcs[IB_POLL_BATCH_DIRECT ]; -return __ib_process_cq (cq, budget, wcs); +return __ib_process_cq (cq, budget, wcs,IB_POLL_BATCH_DIRECT ); }EXPORT_SYMBOL (ib_process_cq_direct);
@@ -88,7 +88,7 @@ static int ib_poll_handler(struct irq_po struct ib_cq *cq = container_of(iop, struct ib_cq, iop);int completed; - completed =__ib_process_cq (cq, budget,NULL ); + completed =__ib_process_cq (cq, budget, cq->wc,IB_POLL_BATCH );if (completed < budget) {irq_poll_complete (&cq->iop);if (ib_req_notify_cq (cq,IB_POLL_FLAGS ) >0 )
@@ -108,7 +108,8 @@ static void ib_cq_poll_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 ,NULL ); + completed =__ib_process_cq (cq,IB_POLL_BUDGET_WORKQUEUE , cq->wc, +IB_POLL_BATCH );if (completed >=IB_POLL_BUDGET_WORKQUEUE ||ib_req_notify_cq (cq,IB_POLL_FLAGS ) >0 )queue_work (ib_comp_wq, &cq->work);
Greg Kroah-Hartman
maintainerPATCH 173/183 alarmtimer: Init nanosleep alarm timer on stack
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit bd03143007eb9b03a7f2316c677780561b68ba2a upstream.
syszbot reported the following debugobjects splat:
ODEBUG: object is on stack, but not annotated
WARNING: CPU: 0 PID: 4185 at lib/debugobjects.c:328 RIP: 0010:debug_object_is_on_stack lib/debugobjects.c:327 [inline] debug_object_init+0x17/0x20 lib/debugobjects.c:391 debug_hrtimer_init kernel/time/hrtimer.c:410 [inline] debug_init kernel/time/hrtimer.c:458 [inline] hrtimer_init+0x8c/0x410 kernel/time/hrtimer.c:1259 alarm_init kernel/time/alarmtimer.c:339 [inline] alarm_timer_nsleep+0x164/0x4d0 kernel/time/alarmtimer.c:787 SYSC_clock_nanosleep kernel/time/posix-timers.c:1226 [inline] SyS_clock_nanosleep+0x235/0x330 kernel/time/posix-timers.c:1204 do_syscall_64+0x281/0x940 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x42/0xb7
This happens because the hrtimer for the alarm nanosleep is on stack, but the code does not use the proper debug objects initialization.
Split out the code for the allocated use cases and invoke hrtimer_init_on_stack() for the nanosleep related functions.
--- kernel/time/alarmtimer.c | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-)
kernel/time/alarmtimer.c +26 -8
@@ -326,6 +326,17 @@ static int alarmtimer_resume(struct devi }#endif +static void +__alarm_init (struct alarm *alarm,enum alarmtimer_type type, +enum alarmtimer_restart (*function)(struct alarm *,ktime_t )) +{ +timerqueue_init (&alarm->node); + alarm->timer.function = alarmtimer_fired; + alarm->function = function; + alarm->type = type; + alarm->state =ALARMTIMER_STATE_INACTIVE ; +} +/** * alarm_init - Initialize an alarm structure * @alarm: ptr to alarm to be initialized
@@ -335,13 +346,9 @@ static int alarmtimer_resume(struct devivoid alarm_init (struct alarm *alarm,enum alarmtimer_type type,enum alarmtimer_restart (*function)(struct alarm *,ktime_t )) { -timerqueue_init (&alarm->node);hrtimer_init (&alarm->timer, alarm_bases[type].base_clockid, -HRTIMER_MODE_ABS ); - alarm->timer.function = alarmtimer_fired; - alarm->function = function; - alarm->type = type; - alarm->state =ALARMTIMER_STATE_INACTIVE ; +HRTIMER_MODE_ABS ); +__alarm_init (alarm, type, function); }EXPORT_SYMBOL_GPL (alarm_init);
@@ -719,6 +726,8 @@ static int alarmtimer_do_nsleep(struct a__set_current_state (TASK_RUNNING ); +destroy_hrtimer_on_stack (&alarm->timer); +if (!alarm->data)return 0 ;
@@ -740,6 +749,15 @@ static int alarmtimer_do_nsleep(struct areturn -ERESTART_RESTARTBLOCK ; } +static void +alarm_init_on_stack (struct alarm *alarm,enum alarmtimer_type type, +enum alarmtimer_restart (*function)(struct alarm *,ktime_t )) +{ +hrtimer_init_on_stack (&alarm->timer, alarm_bases[type].base_clockid, +HRTIMER_MODE_ABS ); +__alarm_init (alarm, type, function); +} +/** * alarm_timer_nsleep_restart - restartblock alarmtimer nsleep * @restart: ptr to restart block
@@ -752,7 +770,7 @@ static long __sched alarm_timer_nsleep_rktime_t exp = restart->nanosleep.expires;struct alarm alarm; -alarm_init (&alarm, type, alarmtimer_nsleep_wakeup); +alarm_init_on_stack (&alarm, type, alarmtimer_nsleep_wakeup);return alarmtimer_do_nsleep (&alarm, exp, type); }
@@ -784,7 +802,7 @@ static int alarm_timer_nsleep(const clocif (!capable (CAP_WAKE_ALARM ))return -EPERM ; -alarm_init (&alarm, type, alarmtimer_nsleep_wakeup); +alarm_init_on_stack (&alarm, type, alarmtimer_nsleep_wakeup); exp =timespec64_to_ktime (*tsreq);/* Convert (if necessary) to absolute time */
Greg Kroah-Hartman
maintainerPATCH 174/183 netfilter: x_tables: cap allocations at 512 mbyte
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
commit 19926968ea86a286aa6fbea16ee3f2e7442f10f0 upstream.
Arbitrary limit, however, this still allows huge rulesets (> 1 million rules). This helps with automated fuzzer as it prevents oom-killer invocation.
--- net/netfilter/x_tables.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/netfilter/x_tables.c +2 -1
@@ -40,6 +40,7 @@ MODULE_AUTHOR("Harald Welte <laforge@netMODULE_DESCRIPTION ("{ip,ip6,arp,eb}_tables backend module" );#define XT_PCPU_BLOCK_SIZE 4096 +#define XT_MAX_TABLE_SIZE (512 * 1024 * 1024)struct compat_delta {unsigned int offset;/* offset in kernel */
@@ -1031,7 +1032,7 @@ struct xt_table_info *xt_alloc_table_infstruct xt_table_info *info =NULL ;size_t sz =sizeof (*info) + size; -if (sz <sizeof (*info)) +if (sz <sizeof (*info) || sz >=XT_MAX_TABLE_SIZE )return NULL ;/* Pedantry: prevent them from hitting BUG() in vmalloc.c --RR */
Greg Kroah-Hartman
maintainerPATCH 176/183 netfilter: compat: prepare xt_compat_init_offsets to return errors
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
commit 9782a11efc072faaf91d4aa60e9d23553f918029 upstream.
should have no impact, function still always returns 0. This patch is only to ease review.
--- include/linux/netfilter/x_tables.h | 2 +- net/bridge/netfilter/ebtables.c | 10 ++++++++-- net/ipv4/netfilter/arp_tables.c | 10 +++++++--- net/ipv4/netfilter/ip_tables.c | 8 ++++++-- net/ipv6/netfilter/ip6_tables.c | 10 +++++++--- net/netfilter/x_tables.c | 4 +++- 6 files changed, 32 insertions(+), 12 deletions(-)
include/linux/netfilter/x_tables.h +1 -1
@@ -508,7 +508,7 @@ void xt_compat_unlock(u_int8_t af);int xt_compat_add_offset (u_int8_t af,unsigned int offset,int delta);void xt_compat_flush_offsets (u_int8_t af); -void xt_compat_init_offsets (u_int8_t af,unsigned int number); +int xt_compat_init_offsets (u8 af,unsigned int number);int xt_compat_calc_jump (u_int8_t af,unsigned int offset);int xt_compat_match_offset (const struct xt_match *match);
net/bridge/netfilter/ebtables.c +8 -2
@@ -1819,10 +1819,14 @@ static int compat_table_info(const struc {unsigned int size = info->entries_size;const void *entries = info->entries; +int ret; newinfo->entries_size = size; -xt_compat_init_offsets (NFPROTO_BRIDGE , info->nentries); + ret =xt_compat_init_offsets (NFPROTO_BRIDGE , info->nentries); +if (ret) +return ret; +return EBT_ENTRY_ITERATE (entries, size, compat_calc_entry, info, entries, newinfo); }
@@ -2257,7 +2261,9 @@ static int compat_do_replace(struct netxt_compat_lock (NFPROTO_BRIDGE ); -xt_compat_init_offsets (NFPROTO_BRIDGE , tmp.nentries); + ret =xt_compat_init_offsets (NFPROTO_BRIDGE , tmp.nentries); +if (ret <0 ) + goto out_unlock; ret =compat_copy_entries (entries_tmp, tmp.entries_size, &state);if (ret <0 ) goto out_unlock;
net/ipv4/netfilter/arp_tables.c +7 -3
@@ -768,7 +768,9 @@ static int compat_table_info(const strucmemcpy (newinfo, info, offsetof(struct xt_table_info , entries)); newinfo->initial_entries =0 ; loc_cpu_entry = info->entries; -xt_compat_init_offsets (NFPROTO_ARP , info->number); + ret =xt_compat_init_offsets (NFPROTO_ARP , info->number); +if (ret) +return ret; xt_entry_foreach(iter, loc_cpu_entry, info->size) { ret =compat_calc_entry (iter, info, loc_cpu_entry, newinfo);if (ret !=0 )
@@ -1157,7 +1159,7 @@ static int translate_compat_table(structstruct compat_arpt_entry *iter0;struct arpt_replace repl;unsigned int size; -int ret =0 ; +int ret; info = *pinfo; entry0 = *pentry0;
@@ -1166,7 +1168,9 @@ static int translate_compat_table(struct j =0 ;xt_compat_lock (NFPROTO_ARP ); -xt_compat_init_offsets (NFPROTO_ARP , compatr->num_entries); + ret =xt_compat_init_offsets (NFPROTO_ARP , compatr->num_entries); +if (ret) + goto out_unlock;/* Walk through entries, checking offsets. */ xt_entry_foreach(iter0, entry0, compatr->size) { ret = check_compat_entry_size_and_hooks(iter0, info, &size,
net/ipv4/netfilter/ip_tables.c +6 -2
@@ -931,7 +931,9 @@ static int compat_table_info(const strucmemcpy (newinfo, info, offsetof(struct xt_table_info , entries)); newinfo->initial_entries =0 ; loc_cpu_entry = info->entries; -xt_compat_init_offsets (AF_INET , info->number); + ret =xt_compat_init_offsets (AF_INET , info->number); +if (ret) +return ret; xt_entry_foreach(iter, loc_cpu_entry, info->size) { ret =compat_calc_entry (iter, info, loc_cpu_entry, newinfo);if (ret !=0 )
@@ -1407,7 +1409,9 @@ translate_compat_table(struct net *net, j =0 ;xt_compat_lock (AF_INET ); -xt_compat_init_offsets (AF_INET , compatr->num_entries); + ret =xt_compat_init_offsets (AF_INET , compatr->num_entries); +if (ret) + goto out_unlock;/* Walk through entries, checking offsets. */ xt_entry_foreach(iter0, entry0, compatr->size) { ret = check_compat_entry_size_and_hooks(iter0, info, &size,
net/ipv6/netfilter/ip6_tables.c +7 -3
@@ -949,7 +949,9 @@ static int compat_table_info(const strucmemcpy (newinfo, info, offsetof(struct xt_table_info , entries)); newinfo->initial_entries =0 ; loc_cpu_entry = info->entries; -xt_compat_init_offsets (AF_INET6 , info->number); + ret =xt_compat_init_offsets (AF_INET6 , info->number); +if (ret) +return ret; xt_entry_foreach(iter, loc_cpu_entry, info->size) { ret =compat_calc_entry (iter, info, loc_cpu_entry, newinfo);if (ret !=0 )
@@ -1415,7 +1417,7 @@ translate_compat_table(struct net *net,struct compat_ip6t_entry *iter0;struct ip6t_replace repl;unsigned int size; -int ret =0 ; +int ret; info = *pinfo; entry0 = *pentry0;
@@ -1424,7 +1426,9 @@ translate_compat_table(struct net *net, j =0 ;xt_compat_lock (AF_INET6 ); -xt_compat_init_offsets (AF_INET6 , compatr->num_entries); + ret =xt_compat_init_offsets (AF_INET6 , compatr->num_entries); +if (ret) + goto out_unlock;/* Walk through entries, checking offsets. */ xt_entry_foreach(iter0, entry0, compatr->size) { ret = check_compat_entry_size_and_hooks(iter0, info, &size,
net/netfilter/x_tables.c +3 -1
@@ -605,10 +605,12 @@ int xt_compat_calc_jump(u_int8_t af, uns }EXPORT_SYMBOL_GPL (xt_compat_calc_jump); -void xt_compat_init_offsets (u_int8_t af,unsigned int number) +int xt_compat_init_offsets (u8 af,unsigned int number) { xt[af].number = number; xt[af].cur =0 ; + +return 0 ; }EXPORT_SYMBOL (xt_compat_init_offsets);
Greg Kroah-Hartman
maintainerPATCH 177/183 netfilter: compat: reject huge allocation requests
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
commit 7d7d7e02111e9a4dc9d0658597f528f815d820fd upstream.
no need to bother even trying to allocating huge compat offset arrays, such ruleset is rejected later on anyway becaus we refuse to allocate overly large rule blobs.
However, compat translation happens before blob allocation, so we should add a check there too.
This is supposed to help with fuzzing by avoiding oom-killer.
--- net/netfilter/x_tables.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-)
net/netfilter/x_tables.c +18 -8
@@ -555,14 +555,8 @@ int xt_compat_add_offset(u_int8_t af, un {struct xt_af *xp = &xt[af]; -if (!xp->compat_tab) { -if (!xp->number) -return -EINVAL ; - xp->compat_tab =vmalloc (sizeof (struct compat_delta ) * xp->number); -if (!xp->compat_tab) -return -ENOMEM ; - xp->cur =0 ; - } +if (WARN_ON (!xp->compat_tab)) +return -ENOMEM ;if (xp->cur >= xp->number)return -EINVAL ;
@@ -607,6 +601,22 @@ EXPORT_SYMBOL_GPL(xt_compat_calc_jump);int xt_compat_init_offsets (u8 af,unsigned int number) { +size_t mem; + +if (!number || number > (INT_MAX /sizeof (struct compat_delta ))) +return -EINVAL ; + +if (WARN_ON (xt[af].compat_tab)) +return -EINVAL ; + + mem =sizeof (struct compat_delta ) * number; +if (mem >XT_MAX_TABLE_SIZE ) +return -ENOMEM ; + + xt[af].compat_tab =vmalloc (mem); +if (!xt[af].compat_tab) +return -ENOMEM ; + xt[af].number = number; xt[af].cur =0 ;
Greg Kroah-Hartman
maintainerPATCH 179/183 perf: Fix sample_max_stack maximum check
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Olsa <[email protected]>
commit 5af44ca53d019de47efe6dbc4003dd518e5197ed upstream.
The syzbot hit KASAN bug in perf_callchain_store having the entry stored behind the allocated bounds [1].
We miss the sample_max_stack check for the initial event that allocates callchain buffers. This missing check allows to create an event with sample_max_stack value bigger than the global sysctl maximum:
# sysctl -a | grep perf_event_max_stack kernel.perf_event_max_stack = 127
# perf record -vv -C 1 -e cycles/max-stack=256/ kill
...
perf_event_attr:
size 112
...
sample_max_stack 256
------------------------------------------------------------
sys_perf_event_open: pid -1 cpu 1 group_fd -1 flags 0x8 = 4Note the '-C 1', which forces perf record to create just single event. Otherwise it opens event for every cpu, then the sample_max_stack check fails on the second event and all's fine.
The fix is to run the sample_max_stack check also for the first event with callchains.
[1] https://marc.info/?l=linux-kernel&m=152352732920874&w=2
--- kernel/events/callchain.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
kernel/events/callchain.c +12 -9
@@ -119,19 +119,22 @@ int get_callchain_buffers(int event_max_ goto exit; } +/* +* If requesting per event more than the global cap, +* return a different error to help userspace figure +* this out. +* +* And also do it here so that we have &callchain_mutex held. +*/ +if (event_max_stack > sysctl_perf_event_max_stack) { + err = -EOVERFLOW ; + goto exit; + } +if (count >1 ) {/* If the allocation failed, give up */ if (!callchain_cpus_entries) err = -ENOMEM ; -/* -* If requesting per event more than the global cap, -* return a different error to help userspace figure -* this out. -* -* And also do it here so that we have &callchain_mutex held. -*/ -if (event_max_stack > sysctl_perf_event_max_stack) - err = -EOVERFLOW ; goto exit; }
Greg Kroah-Hartman
maintainerPATCH 181/183 RDMA/mlx5: Fix NULL dereference while accessing XRC_TGT QPs
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leon Romanovsky <[email protected]>
commit 75a4598209cbe45540baa316c3b51d9db222e96e upstream.
mlx5 modify_qp() relies on FW that the error will be thrown if wrong state is supplied. The missing check in FW causes the following crash while using XRC_TGT QPs.
[ 14.769632] BUG: unable to handle kernel NULL pointer dereference at (null) [ 14.771085] IP: mlx5_ib_modify_qp+0xf60/0x13f0 [ 14.771894] PGD 800000001472e067 P4D 800000001472e067 PUD 14529067 PMD 0 [ 14.773126] Oops: 0002 [#1] SMP PTI [ 14.773763] CPU: 0 PID: 365 Comm: ubsan Not tainted 4.16.0-rc1-00038-g8151138c0793 #119 [ 14.775192] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.7.5-0-ge51488c-20140602_164612-nilsson.home.kraxel.org 04/01/2014 [ 14.777522] RIP: 0010:mlx5_ib_modify_qp+0xf60/0x13f0 [ 14.778417] RSP: 0018:ffffbf48001c7bd8 EFLAGS: 00010246 [ 14.779346] RAX: 0000000000000000 RBX: ffff9a8f9447d400 RCX: 0000000000000000 [ 14.780643] RDX: 0000000000000000 RSI: 000000000000000a RDI: 0000000000000000 [ 14.781930] RBP: 0000000000000000 R08: 00000000000217b0 R09: ffffffffbc9c1504 [ 14.783214] R10: fffff4a180519480 R11: ffff9a8f94523600 R12: ffff9a8f9493e240 [ 14.784507] R13: ffff9a8f9447d738 R14: 000000000000050a R15: 0000000000000000 [ 14.785800] FS: 00007f545b466700(0000) GS:ffff9a8f9fc00000(0000) knlGS:0000000000000000 [ 14.787073] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 14.787792] CR2: 0000000000000000 CR3: 00000000144be000 CR4: 00000000000006b0 [ 14.788689] Call Trace: [ 14.789007] _ib_modify_qp+0x71/0x120 [ 14.789475] modify_qp.isra.20+0x207/0x2f0 [ 14.790010] ib_uverbs_modify_qp+0x90/0xe0 [ 14.790532] ib_uverbs_write+0x1d2/0x3c0 [ 14.791049] ? __handle_mm_fault+0x93c/0xe40 [ 14.791644] __vfs_write+0x36/0x180 [ 14.792096] ? handle_mm_fault+0xc1/0x210 [ 14.792601] vfs_write+0xad/0x1e0 [ 14.793018] SyS_write+0x52/0xc0 [ 14.793422] do_syscall_64+0x75/0x180 [ 14.793888] entry_SYSCALL_64_after_hwframe+0x21/0x86 [ 14.794527] RIP: 0033:0x7f545ad76099 [ 14.794975] RSP: 002b:00007ffd78787468 EFLAGS: 00000287 ORIG_RAX: 0000000000000001 [ 14.795958] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f545ad76099 [ 14.797075] RDX: 0000000000000078 RSI: 0000000020009000 RDI: 0000000000000003 [ 14.798140] RBP: 00007ffd78787470 R08: 00007ffd78787480 R09: 00007ffd78787480 [ 14.799207] R10: 00007ffd78787480 R11: 0000000000000287 R12: 00005599ada98760 [ 14.800277] R13: 00007ffd78787560 R14: 0000000000000000 R15: 0000000000000000 [ 14.801341] Code: 4c 8b 1c 24 48 8b 83 70 02 00 00 48 c7 83 cc 02 00 00 00 00 00 00 48 c7 83 24 03 00 00 00 00 00 00 c7 83 2c 03 00 00 00 00 00 00 <c7> 00 00 00 00 00 48 8b 83 70 02 00 00 c7 40 04 00 00 00 00 4c [ 14.804012] RIP: mlx5_ib_modify_qp+0xf60/0x13f0 RSP: ffffbf48001c7bd8 [ 14.804838] CR2: 0000000000000000 [ 14.805288] ---[ end trace 3f1da0df5c8b7c37 ]---
--- drivers/infiniband/hw/mlx5/qp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/qp.c +2 -1
@@ -2923,7 +2923,8 @@ static int __mlx5_ib_modify_qp(struct ib* If we moved a kernel QP to RESET, clean up all old CQ * entries and reinitialize the QP. */ -if (new_state ==IB_QPS_RESET && !ibqp->uobject) { +if (new_state ==IB_QPS_RESET && + !ibqp->uobject && ibqp->qp_type !=IB_QPT_XRC_TGT ) {mlx5_ib_cq_clean (recv_cq, base->mqp.qpn, ibqp->srq ?to_msrq (ibqp->srq) :NULL );if (send_cq != recv_cq)
Greg Kroah-Hartman
maintainerPATCH 183/183 mac80211_hwsim: fix use-after-free bug in hwsim_exit_net
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Beichler <[email protected]>
commit 8cfd36a0b53aeb4ec21d81eb79706697b84dfc3d upstream.
When destroying a net namespace, all hwsim interfaces, which are not created in default namespace are deleted. But the async deletion of the interfaces could last longer than the actual destruction of the namespace, which results to an use after free bug. Therefore use synchronous deletion in this case.
--- drivers/net/wireless/mac80211_hwsim.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/wireless/mac80211_hwsim.c +5 -2
@@ -3427,8 +3427,11 @@ static void __net_exit hwsim_exit_net(stcontinue ;list_del (&data->list); -INIT_WORK (&data->destroy_work, destroy_radio); -schedule_work (&data->destroy_work); +spin_unlock_bh (&hwsim_radio_lock); +mac80211_hwsim_del_radio (data,wiphy_name (data->hw->wiphy), +NULL ); +spin_lock_bh (&hwsim_radio_lock); + }spin_unlock_bh (&hwsim_radio_lock); }
Greg Kroah-Hartman
maintainerPATCH 1/183 cifs: do not allow creating sockets except with SMB1 posix exensions
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
commit 1d0cffa674cfa7d185a302c8c6850fc50b893bed upstream.
RHBZ: 1453123
Since at least the 3.10 kernel and likely a lot earlier we have not been able to create unix domain sockets in a cifs share when mounted using the SFU mount option (except when mounted with the cifs unix extensions to Samba e.g.)
Trying to create a socket, for example using the af_unix command from xfstests will cause :
BUG: unable to handle kernel NULL pointer dereference at 00000000
00000040
Since no one uses or depends on being able to create unix domains sockets on a cifs share the easiest fix to stop this vulnerability is to simply not allow creation of any other special files than char or block devices when sfu is used.
Added update to Ronnie's patch to handle a tcon link leak, and to address a buf leak noticed by Gustavo and Colin.
--- fs/cifs/dir.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
fs/cifs/dir.c +5 -4
@@ -684,6 +684,9 @@ int cifs_mknod(struct inode *inode, stru goto mknod_out; } +if (!S_ISCHR (mode) && !S_ISBLK (mode)) + goto mknod_out; +if (!(cifs_sb->mnt_cifs_flags &CIFS_MOUNT_UNX_EMUL )) goto mknod_out;
@@ -692,10 +695,8 @@ int cifs_mknod(struct inode *inode, stru buf =kmalloc (sizeof (FILE_ALL_INFO ),GFP_KERNEL );if (buf ==NULL ) { -kfree (full_path); rc = -ENOMEM ; -free_xid (xid); -return rc; + goto mknod_out; }if (backup_cred (cifs_sb))
@@ -742,7 +743,7 @@ int cifs_mknod(struct inode *inode, stru pdev->minor =cpu_to_le64 (MINOR (device_number)); rc = tcon->ses->server->ops->sync_write (xid, &fid, &io_parms, &bytes_written, iov,1 ); - }/* else if (S_ISFIFO) */ + } tcon->ses->server->ops->close (xid, tcon, &fid);d_drop (direntry);
Greg Kroah-Hartman
maintainerPATCH 13/183 usb: musb: call pm_runtime_{get,put}_sync before reading vbus registers
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Merlijn Wajer <[email protected]>
commit df6b074dbe248d8c43a82131e8fd429e401841a5 upstream.
Without pm_runtime_{get,put}_sync calls in place, reading vbus status via /sys causes the following error:
Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa0ab060 pgd = b333e822
[fa0ab060] *pgd=48011452(bad)
[<c05261b0>] (musb_default_readb) from [<c0525bd0>] (musb_vbus_show+0x58/0xe4) [<c0525bd0>] (musb_vbus_show) from [<c04c0148>] (dev_attr_show+0x20/0x44) [<c04c0148>] (dev_attr_show) from [<c0259f74>] (sysfs_kf_seq_show+0x80/0xdc) [<c0259f74>] (sysfs_kf_seq_show) from [<c0210bac>] (seq_read+0x250/0x448) [<c0210bac>] (seq_read) from [<c01edb40>] (__vfs_read+0x1c/0x118) [<c01edb40>] (__vfs_read) from [<c01edccc>] (vfs_read+0x90/0x144) [<c01edccc>] (vfs_read) from [<c01ee1d0>] (SyS_read+0x3c/0x74) [<c01ee1d0>] (SyS_read) from [<c0106fe0>] (ret_fast_syscall+0x0/0x54)
Solution was suggested by Tony Lindgren <[email protected]>.
--- drivers/usb/musb/musb_core.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/musb/musb_core.c +2 -0
@@ -1780,6 +1780,7 @@ musb_vbus_show(struct device *dev, strucint vbus;u8 devctl; +pm_runtime_get_sync (dev);spin_lock_irqsave (&musb->lock, flags); val = musb->a_wait_bcon; vbus =musb_platform_get_vbus_status (musb);
@@ -1793,6 +1794,7 @@ musb_vbus_show(struct device *dev, struc vbus =0 ; }spin_unlock_irqrestore (&musb->lock, flags); +pm_runtime_put_sync (dev);return sprintf (buf,"Vbus %s, timeout %lu msec\n" , vbus ?"on" :"off" , val);
Greg Kroah-Hartman
maintainerPATCH 14/183 usb: musb: Fix external abort in musb_remove on omap2430
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Merlijn Wajer <[email protected]>
commit 94e46a4f2d5eb14059e42f313c098d4854847376 upstream.
This fixes an oops on unbind / module unload (on the musb omap2430 platform).
musb_remove function now calls musb_platform_exit before disabling runtime pm.
--- drivers/usb/musb/musb_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/musb/musb_core.c +1 -1
@@ -2498,11 +2498,11 @@ static int musb_remove(struct platform_dmusb_disable_interrupts (musb);musb_writeb (musb->mregs,MUSB_DEVCTL ,0 );spin_unlock_irqrestore (&musb->lock, flags); +musb_platform_exit (musb);pm_runtime_dont_use_autosuspend (musb->controller);pm_runtime_put_sync (musb->controller);pm_runtime_disable (musb->controller); -musb_platform_exit (musb); musb_phy_callback =NULL ;if (musb->dma_controller)musb_dma_controller_destroy (musb->dma_controller);
Greg Kroah-Hartman
maintainerPATCH 15/183 powerpc/eeh: Fix race with driver un/bind
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Neuling <[email protected]>
commit f0295e047fcf52ccb42561fb7de6942f5201b676 upstream.
The current EEH callbacks can race with a driver unbind. This can result in a backtraces like this:
EEH: Frozen PHB#0-PE#1fc detected
EEH: PE location: S000009, PHB location: N/A
CPU: 2 PID: 2312 Comm: kworker/u258:3 Not tainted 4.15.6-openpower1 #2
Workqueue: nvme-wq nvme_reset_work [nvme]
Call Trace:
dump_stack+0x9c/0xd0 (unreliable)
eeh_dev_check_failure+0x420/0x470
eeh_check_failure+0xa0/0xa4
nvme_reset_work+0x138/0x1414 [nvme]
process_one_work+0x1ec/0x328
worker_thread+0x2e4/0x3a8
kthread+0x14c/0x154
ret_from_kernel_thread+0x5c/0xc8
nvme nvme1: Removing after probe failure status: -19
<snip>
cpu 0x23: Vector: 300 (Data Access) at [c000000ff50f3800]
pc: c0080000089a0eb0: nvme_error_detected+0x4c/0x90 [nvme]
lr: c000000000026564: eeh_report_error+0xe0/0x110
sp: c000000ff50f3a80
msr: 9000000000009033
dar: 400
dsisr: 40000000
current = 0xc000000ff507c000
paca = 0xc00000000fdc9d80 softe: 0 irq_happened: 0x01
pid = 782, comm = eehd
Linux version 4.15.6-openpower1 (smc@smc-desktop) (gcc version 6.4.0 (Buildroot 2017.11.2-00008-g4b6188e)) #2 SM P Tue Feb 27 12:33:27 PST 2018
enter ? for help
eeh_report_error+0xe0/0x110
eeh_pe_dev_traverse+0xc0/0xdc
eeh_handle_normal_event+0x184/0x4c4
eeh_handle_event+0x30/0x288
eeh_event_handler+0x124/0x170
kthread+0x14c/0x154
ret_from_kernel_thread+0x5c/0xc8The first part is an EEH (on boot), the second half is the resulting crash. nvme probe starts the nvme_reset_work() worker thread. This worker thread starts touching the device which see a device error (EEH) and hence queues up an event in the powerpc EEH worker thread. nvme_reset_work() then continues and runs nvme_remove_dead_ctrl_work() which results in unbinding the driver from the device and hence releases all resources. At the same time, the EEH worker thread starts doing the EEH .error_detected() driver callback, which no longer works since the resources have been freed.
This fixes the problem in the same way the generic PCIe AER code (in drivers/pci/pcie/aer/aerdrv_core.c) does. It makes the EEH code hold the device_lock() while performing the driver EEH callbacks and associated code. This ensures either the callbacks are no longer register, or if they are registered the driver will not be removed from underneath us.
This has been broken forever. The EEH call backs were first introduced in 2005 (in 77bd7415610) but it's not clear if a lock was needed back then.
--- arch/powerpc/kernel/eeh_driver.c | 65 +++++++++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 23 deletions(-)
arch/powerpc/kernel/eeh_driver.c +42 -23
@@ -207,18 +207,18 @@ static void *eeh_report_error(void *dataif (!dev ||eeh_dev_removed (edev) ||eeh_pe_passed (edev->pe))return NULL ; + +device_lock (&dev->dev); dev->error_state = pci_channel_io_frozen; driver =eeh_pcid_get (dev); -if (!driver)return NULL ; +if (!driver) goto out_no_dev;eeh_disable_irq (dev);if (!driver->err_handler || - !driver->err_handler->error_detected) { -eeh_pcid_put (dev); -return NULL ; - } + !driver->err_handler->error_detected) + goto out; rc = driver->err_handler->error_detected (dev, pci_channel_io_frozen);
@@ -227,7 +227,10 @@ static void *eeh_report_error(void *dataif (*res ==PCI_ERS_RESULT_NONE ) *res = rc; edev->in_error = true; +out:eeh_pcid_put (dev); +out_no_dev: +device_unlock (&dev->dev);return NULL ; }
@@ -250,15 +253,14 @@ static void *eeh_report_mmio_enabled(voiif (!dev ||eeh_dev_removed (edev) ||eeh_pe_passed (edev->pe))return NULL ; +device_lock (&dev->dev); driver =eeh_pcid_get (dev); -if (!driver)return NULL ; +if (!driver) goto out_no_dev;if (!driver->err_handler || !driver->err_handler->mmio_enabled || - (edev->mode &EEH_DEV_NO_HANDLER )) { -eeh_pcid_put (dev); -return NULL ; - } + (edev->mode &EEH_DEV_NO_HANDLER )) + goto out; rc = driver->err_handler->mmio_enabled (dev);
@@ -266,7 +268,10 @@ static void *eeh_report_mmio_enabled(voiif (rc ==PCI_ERS_RESULT_NEED_RESET ) *res = rc;if (*res ==PCI_ERS_RESULT_NONE ) *res = rc; +out:eeh_pcid_put (dev); +out_no_dev: +device_unlock (&dev->dev);return NULL ; }
@@ -289,20 +294,20 @@ static void *eeh_report_reset(void *dataif (!dev ||eeh_dev_removed (edev) ||eeh_pe_passed (edev->pe))return NULL ; + +device_lock (&dev->dev); dev->error_state = pci_channel_io_normal; driver =eeh_pcid_get (dev); -if (!driver)return NULL ; +if (!driver) goto out_no_dev;eeh_enable_irq (dev);if (!driver->err_handler || !driver->err_handler->slot_reset || (edev->mode &EEH_DEV_NO_HANDLER ) || - (!edev->in_error)) { -eeh_pcid_put (dev); -return NULL ; - } + (!edev->in_error)) + goto out; rc = driver->err_handler->slot_reset (dev); if ((*res == PCI_ERS_RESULT_NONE) ||
@@ -310,7 +315,10 @@ static void *eeh_report_reset(void *dataif (*res ==PCI_ERS_RESULT_DISCONNECT && rc ==PCI_ERS_RESULT_NEED_RESET ) *res = rc; +out:eeh_pcid_put (dev); +out_no_dev: +device_unlock (&dev->dev);return NULL ; }
@@ -361,10 +369,12 @@ static void *eeh_report_resume(void *datif (!dev ||eeh_dev_removed (edev) ||eeh_pe_passed (edev->pe))return NULL ; + +device_lock (&dev->dev); dev->error_state = pci_channel_io_normal; driver =eeh_pcid_get (dev); -if (!driver)return NULL ; +if (!driver) goto out_no_dev; was_in_error = edev->in_error; edev->in_error = false;
@@ -374,13 +384,19 @@ static void *eeh_report_resume(void *dat !driver->err_handler->resume || (edev->mode & EEH_DEV_NO_HANDLER) || !was_in_error) { edev->mode &= ~EEH_DEV_NO_HANDLER ; -eeh_pcid_put (dev); -return NULL ; + goto out; } driver->err_handler->resume (dev); +out:eeh_pcid_put (dev); +#ifdef CONFIG_PCI_IOV +if (eeh_ops->notify_resume &&eeh_dev_to_pdn (edev)) + eeh_ops->notify_resume (eeh_dev_to_pdn (edev)); +#endif +out_no_dev: +device_unlock (&dev->dev);return NULL ; }
@@ -400,22 +416,25 @@ static void *eeh_report_failure(void *daif (!dev ||eeh_dev_removed (edev) ||eeh_pe_passed (edev->pe))return NULL ; + +device_lock (&dev->dev); dev->error_state = pci_channel_io_perm_failure; driver =eeh_pcid_get (dev); -if (!driver)return NULL ; +if (!driver) goto out_no_dev;eeh_disable_irq (dev);if (!driver->err_handler || - !driver->err_handler->error_detected) { -eeh_pcid_put (dev); -return NULL ; - } + !driver->err_handler->error_detected) + goto out; driver->err_handler->error_detected (dev, pci_channel_io_perm_failure); +out:eeh_pcid_put (dev); +out_no_dev: +device_unlock (&dev->dev);return NULL ; }
Greg Kroah-Hartman
maintainerPATCH 16/183 firewire-ohci: work around oversized DMA reads on JMicron controllers
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
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
@@ -1130,7 +1130,13 @@ static int context_add_buffer(struct conreturn -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 ;
Greg Kroah-Hartman
maintainerPATCH 17/183 x86/tsc: Allow TSC calibration without PIT
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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(uunsigned 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_calibrateu64 tsc, delta;unsigned long d1, d2; +if (!has_legacy_pic ()) +return 0 ; +/* Set the Gate high, disable speaker */ outb ((inb (0x61 ) & ~0x02 ) |0x01 ,0x61 );
Greg Kroah-Hartman
maintainerPATCH 19/183 ACPI / LPSS: Do not instiate platform_dev for devs without MMIO resources
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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(strucacpi_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;
Greg Kroah-Hartman
maintainerPATCH 20/183 ALSA: hda - Use IS_REACHABLE() for dependency on input
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -3721,6 +3721,7 @@ static void alc280_fixup_hp_gpio4(struct } } +#if IS_REACHABLE (INPUT )static void gpio2_mic_hotkey_event (struct hda_codec *codec,struct hda_jack_callback *event) {
@@ -3853,6 +3854,10 @@ static void alc233_fixup_lenovo_line2_mi 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)
Greg Kroah-Hartman
maintainercover 4.14.37-stable review
This is the start of the stable review cycle for the 4.14.37 release. There are 183 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri Apr 27 10:32:04 UTC 2018. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.37-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.14.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.14.37-rc1
Benjamin Beichler <[email protected]>
mac80211_hwsim: fix use-after-free bug in hwsim_exit_net
Sean Christopherson <[email protected]>
Revert "KVM: X86: Fix SMRAM accessing even if VM is shutdown"
Leon Romanovsky <[email protected]>
RDMA/mlx5: Fix NULL dereference while accessing XRC_TGT QPs
Jiri Olsa <[email protected]>
perf: Return proper values for user stack errors
Jiri Olsa <[email protected]>
perf: Fix sample_max_stack maximum check
Florian Westphal <[email protected]>
netfilter: x_tables: limit allocation requests for blob rule heads
Florian Westphal <[email protected]>
netfilter: compat: reject huge allocation requests
Florian Westphal <[email protected]>
netfilter: compat: prepare xt_compat_init_offsets to return errors
Florian Westphal <[email protected]>
netfilter: x_tables: add counters allocation wrapper
Florian Westphal <[email protected]>
netfilter: x_tables: cap allocations at 512 mbyte
Thomas Gleixner <[email protected]>
alarmtimer: Init nanosleep alarm timer on stack
Max Gurtovoy <[email protected]>
RDMA/core: Reduce poll batch for direct cq polling
Mark Salter <[email protected]>
irqchip/gic-v3: Change pr_debug message to pr_devel
Michael Kelley <[email protected]>
cpumask: Make for_each_cpu_wrap() available on UP as well
Stephen Boyd <[email protected]>
irqchip/gic-v3: Ignore disabled ITS nodes
Thomas Richter <[email protected]>
perf test: Fix test trace+probe_libc_inet_pton.sh for s390x
Nicholas Piggin <[email protected]>
powerpc/powernv: IMC fix out of bounds memory access at shutdown
Will Deacon <[email protected]>
locking/qspinlock: Ensure node->count is updated before initialising node
[email protected] <[email protected]>
x86/platform/UV: Fix GAM Range Table entries less than 1GB
Aneesh Kumar K.V <[email protected]>
powerpc/mm/hash64: Zero PGD pages on allocation
Jia Zhang <[email protected]>
vfs/proc/kcore, x86/mm/kcore: Fix SMAP fault when dumping vsyscall user page
Tony Lindgren <[email protected]>
PM / wakeirq: Fix unbalanced IRQ enable for wakeirq
Rafael J. Wysocki <[email protected]>
ACPI / EC: Restore polling during noirq suspend/resume phases
Daniel Borkmann <[email protected]>
bpf: fix rlimit in reuseport net selftest
Niklas Cassel <[email protected]>
net: stmmac: discard disabled flags in interrupt status register
Trond Myklebust <[email protected]>
SUNRPC: Don't call __UDPX_INC_STATS() from a preemptible context
Paul Mackerras <[email protected]>
KVM: PPC: Book3S HV: Fix handling of secondary HPTEG in HPT resizing code
Jesper Dangaard Brouer <[email protected]>
tools/libbpf: handle issues with bpf ELF objects containing .eh_frames
Mathieu Malaterre <[email protected]>
net: Extra '_get' in declaration of arch_get_platform_mac_address
Chuck Lever <[email protected]>
svcrdma: Fix Read chunk round-up
David Howells <[email protected]>
rxrpc: Don't put crypto buffers on the stack
Steven Rostedt (VMware) <[email protected]>
selftests/ftrace: Add some missing glob checks
Chen Yu <[email protected]>
cpufreq: intel_pstate: Enable HWP during system resume on CPU0
Tang Junhui <[email protected]>
bcache: return attach error when no cache set exist
Tang Junhui <[email protected]>
bcache: fix for data collapse after re-attaching an attached device
Tang Junhui <[email protected]>
bcache: fix for allocator and register thread race
Coly Li <[email protected]>
bcache: properly set task state in bch_writeback_thread()
Arnd Bergmann <[email protected]>
cifs: silence compiler warnings showing up with gcc-8.0.0
Ulf Hansson <[email protected]>
PM / domains: Fix up domain-idle-states OF parsing
Alexey Dobriyan <[email protected]>
proc: fix /proc/*/map_files lookup
Will Deacon <[email protected]>
arm64: spinlock: Fix theoretical trylock() A-B-A with LSE atomics
Guanglei Li <[email protected]>
RDS: IB: Fix null pointer issue
John Fastabend <[email protected]>
bpf: sockmap, fix leaking maps with attached but not detached progs
Ross Lagerwall <[email protected]>
xen/grant-table: Use put_page instead of free_page
Ross Lagerwall <[email protected]>
xen-netfront: Fix race between device setup and open
Jiri Olsa <[email protected]>
perf evsel: Fix period/freq terms setup
Matt Redfearn <[email protected]>
MIPS: Generic: Support GIC in EIC mode
Jiri Olsa <[email protected]>
perf record: Fix period option handling
Matt Redfearn <[email protected]>
MIPS: TXx9: use IS_BUILTIN() for CONFIG_LEDS_CLASS
James Hogan <[email protected]>
MIPS: generic: Fix machine compatible matching
Yonghong Song <[email protected]>
bpf: fix selftests/bpf test_kmod.sh failure when CONFIG_BPF_JIT_ALWAYS_ON=y
Hans de Goede <[email protected]>
ACPI / scan: Use acpi_bus_get_status() to initialize ACPI_TYPE_DEVICE devs
Hans de Goede <[email protected]>
ACPI / bus: Do not call _STA on battery devices with unmet dependencies
Chen Yu <[email protected]>
ACPI: processor_perflib: Do not send _PPC change notification if not ready
Jean Delvare <[email protected]>
firmware: dmi_scan: Fix handling of empty DMI strings
Arnd Bergmann <[email protected]>
x86/dumpstack: Avoid uninitlized variable
Arnd Bergmann <[email protected]>
x86/power: Fix swsusp_arch_resume prototype
Subash Abhinov Kasiviswanathan <[email protected]>
netfilter: ipv6: nf_defrag: Kill frag queue on RFC2460 failure
Sebastian Ott <[email protected]>
s390/eadm: fix CONFIG_BLOCK include dependency
Karol Herbst <[email protected]>
drm/nouveau/pmu/fuc: don't use movw directly anymore
Don Hiatt <[email protected]>
IB/core: Map iWarp AH type to undefined in rdma_ah_find_type
Alex Estrin <[email protected]>
IB/ipoib: Fix for potential no-carrier state
Alex Estrin <[email protected]>
IB/hfi1: Fix for potential refcount leak in hfi1_open_file()
Michael J. Ruhl <[email protected]>
IB/hfi1: Re-order IRQ cleanup to address driver cleanup race
Jens Axboe <[email protected]>
blk-mq: fix discard merge with scheduler attached
Ed Swierk <[email protected]>
openvswitch: Remove padding from packet before L3+ conntrack processing
shidao.ytt <[email protected]>
mm/fadvise: discard partial page if endbyte is also EOF
Mel Gorman <[email protected]>
mm: pin address_space before dereferencing it while isolating an LRU page
Yang Shi <[email protected]>
mm: thp: use down_read_trylock() in khugepaged to avoid long block
Nitin Gupta <[email protected]>
sparc64: update pmdp_invalidate() to return old pmd value
Kirill A. Shutemov <[email protected]>
asm-generic: provide generic_pmdp_establish()
Yisheng Xie <[email protected]>
mm/mempolicy: add nodes_empty check in SYSC_migrate_pages
Yisheng Xie <[email protected]>
mm/mempolicy: fix the check of nodemask from user
piaojun <[email protected]>
ocfs2: return error when we attempt to access a dirty bh in jbd2
piaojun <[email protected]>
ocfs2/acl: use 'ip_xattr_sem' to protect getting extended attribute
piaojun <[email protected]>
ocfs2: return -EROFS to mount.ocfs2 if inode block is invalid
Jan H. Schönherr <[email protected]>
fs/dax.c: release PMD lock even when there is no PMD support in DAX
Vitaly Kuznetsov <[email protected]>
x86/kvm/vmx: do not use vm-exit instruction length for fast MMIO when running nested
KarimAllah Ahmed <[email protected]>
kvm: Map PFN-type memory regions as writable (if possible)
Gustavo A. R. Silva <[email protected]>
tcp_nv: fix potential integer overflow in tcpnv_acked
Dmitry Vyukov <[email protected]>
netfilter: x_tables: fix pointer leaks to userspace
Vitaly Kuznetsov <[email protected]>
x86/hyperv: Check for required priviliges in hyperv_init()
Andy Spencer <[email protected]>
gianfar: prevent integer wrapping in the rx handler
Logan Gunthorpe <[email protected]>
ntb_transport: Fix bug with max_mw_size parameter
Leon Romanovsky <[email protected]>
RDMA/mlx5: Avoid memory leak in case of XRCD dealloc failure
Michael Bringmann <[email protected]>
powerpc/numa: Ensure nodes initialized for hotplug
Michael Bringmann <[email protected]>
powerpc/numa: Use ibm,max-associativity-domains to discover possible nodes
Mickaël Salaün <[email protected]>
samples/bpf: Partially fixes the bpf.o build
Jacob Keller <[email protected]>
i40e: fix reported mask for ntuple filters
Jacob Keller <[email protected]>
i40e: program fragmented IPv4 filter input set
Emil Tantilov <[email protected]>
ixgbe: don't set RXDCTL.RLPML for 82599
Jake Daryll Obina <[email protected]>
jffs2: Fix use-after-free bug in jffs2_iget()'s error handling path
Jason Gunthorpe <[email protected]>
RDMA/uverbs: Use an unambiguous errno for method not supported
Corentin LABBE <[email protected]>
crypto: artpec6 - remove select on non-existing CRYPTO_SHA384
Andy Shevchenko <[email protected]>
device property: Define type of PROPERTY_ENRTY_*() macros
Aaron Sierra <[email protected]>
tty: serial: exar: Relocate sleep wake-up handling
Vitaly Kuznetsov <[email protected]>
x86/hyperv: Stop suppressing X86_FEATURE_PCID
Ngai-Mint Kwan <[email protected]>
fm10k: fix "failed to kill vid" message for VF
Daniel Hua <[email protected]>
igb: Clear TXSTMP when ptp_tx_work() is timeout
Corinna Vinschen <[email protected]>
igb: Allow to remove administratively set MAC on VFs
Jeffy Chen <[email protected]>
ASoC: rockchip: Use dummy_dai for rt5514 dsp dailink
Eryu Guan <[email protected]>
blk-mq-debugfs: don't allow write on attributes with seq_operations set
David Hildenbrand <[email protected]>
KVM: s390: vsie: use READ_ONCE to access some SCB fields
David Herrmann <[email protected]>
platform/x86: thinkpad_acpi: suppress warning about palm detection
Alan Brady <[email protected]>
i40evf: ignore link up if not running
Avinash Dayanand <[email protected]>
i40evf: Don't schedule reset_task when device is being removed
Prashant Bhole <[email protected]>
bpf: test_maps: cleanup sockmaps when test ends
Goldwyn Rodrigues <[email protected]>
block: Set BIO_TRACE_COMPLETION on new bio during split
Wei Yongjun <[email protected]>
nfp: fix error return code in nfp_pci_probe()
Dan Carpenter <[email protected]>
HID: roccat: prevent an out of bounds read in kovaplus_profile_activated()
Andi Shyti <[email protected]>
Input: stmfts - set IRQ_NOAUTOEN to the irq flag
Arnd Bergmann <[email protected]>
scsi: fas216: fix sense buffer initialization
Xose Vazquez Perez <[email protected]>
scsi: devinfo: fix format of the device list
Sheng Yong <[email protected]>
f2fs: avoid hungtask when GC encrypted block if io_bits is set
Parav Pandit <[email protected]>
RDMA/cma: Check existence of netdevice during port validation
Liu Bo <[email protected]>
Btrfs: raid56: fix race between merge_bio and rbio_orig_end_io
Liu Bo <[email protected]>
Btrfs: fix unexpected EEXIST from btrfs_get_extent
Anand Jain <[email protected]>
btrfs: fail mount when sb flag is not in BTRFS_SUPER_FLAG_SUPP
Liu Bo <[email protected]>
Btrfs: fix scrub to repair raid6 corruption
Nikolay Borisov <[email protected]>
btrfs: Fix out of bounds access in btrfs_search_slot
Liu Bo <[email protected]>
Btrfs: set plug for fsync
Wei Yongjun <[email protected]>
ipmi/powernv: Fix error return code in ipmi_powernv_probe()
weiyongjun (A) <[email protected]>
mac80211_hwsim: fix possible memory leak in hwsim_new_radio_nl()
Ulf Magnusson <[email protected]>
kconfig: Fix expr_free() E_NOT leak
Ulf Magnusson <[email protected]>
kconfig: Fix automatic menu creation mem leak
Ulf Magnusson <[email protected]>
kconfig: Don't leak main menus during parsing
Guenter Roeck <[email protected]>
watchdog: sp5100_tco: Fix watchdog disable bit
Niklas Cassel <[email protected]>
PCI: Add dummy pci_irqd_intx_xlate() for CONFIG_PCI=n build
James Hogan <[email protected]>
MIPS: Fix clean of vmlinuz.{32,ecoff,bin,srec}Jan Chochol <[email protected]>
nfs: Do not convert nfs_idmap_cache_timeout to jiffies
Sagi Grimberg <[email protected]>
IB/cq: Don't force IB_POLL_DIRECT poll context for ib_process_cq_direct
Maxime Chevallier <[email protected]>
spi: a3700: Clear DATA_OUT when performing a read
Martin Blumenstingl <[email protected]>
net: stmmac: dwmac-meson8b: propagate rate changes to the parent clock
Martin Blumenstingl <[email protected]>
net: stmmac: dwmac-meson8b: fix setting the RGMII TX clock on Meson8b
Geert Uytterhoeven <[email protected]>
ubifs: Fix uninitialized variable in search_dh_cookie()
Ming Lei <[email protected]>
blk-mq: turn WARN_ON in __blk_mq_run_hw_queue into printk
Ming Lei <[email protected]>
dm mpath: return DM_MAPIO_REQUEUE on blk-mq rq allocation failure
mulhern <[email protected]>
dm thin: fix documentation relative to low water mark threshold
Peter Xu <[email protected]>
iommu/vt-d: Use domain instead of cache fetching
Nicholas Piggin <[email protected]>
powerpc: System reset avoid interleaving oops using die synchronisation
Robin Murphy <[email protected]>
iommu/exynos: Don't unconditionally steal bus ops
Thomas Richter <[email protected]>
perf record: Fix failed memory allocation for get_cpuid_str
Steven Rostedt (VMware) <[email protected]>
tools lib traceevent: Fix get_field_str() for dynamic strings
Arnaldo Carvalho de Melo <[email protected]>
perf callchain: Fix attr.sample_max_stack setting
Steven Rostedt (VMware) <[email protected]>
tools lib traceevent: Simplify pointer print logic and fix %pF
Arnaldo Carvalho de Melo <[email protected]>
perf unwind: Do not look just at the global callchain_param.record_mode
[email protected] <[email protected]>
scsi: qla2xxx: Fix warning in qla2x00_async_iocb_timeout()
Shiraz Saleem <[email protected]>
i40iw: Zero-out consumer key on allocate stag for FMR
Mustafa Ismail <[email protected]>
i40iw: Free IEQ resources
Peter Hutterer <[email protected]>
Input: synaptics - reset the ABS_X/Y fuzz after initializing MT axes
Jesper Dangaard Brouer <[email protected]>
libbpf: Makefile set specified permission mode
Dmitry Torokhov <[email protected]>
Input: psmouse - fix Synaptics detection when protocol is disabled
Alex Williamson <[email protected]>
PCI: Add function 1 DMA alias quirk for Marvell 9128
Masami Hiramatsu <[email protected]>
selftest: ftrace: Fix to pick text symbols for kprobes
Chuck Lever <[email protected]>
xprtrdma: Fix backchannel allocation of extra rpcrdma_reps
Hans de Goede <[email protected]>
platform/x86: dell-laptop: Filter out spurious keyboard backlight change events
Christian Borntraeger <[email protected]>
KVM: s390: use created_vcpus in more places
Anna-Maria Gleixner <[email protected]>
tracing/hrtimer: Fix tracing bugs by taking all clock bases and modes into account
Subash Abhinov Kasiviswanathan <[email protected]>
netfilter: ipv6: nf_defrag: Pass on packets to stack per RFC2460
Paul Mackerras <[email protected]>
KVM: PPC: Book3S HV: Enable migration of decrementer register
Parav Pandit <[email protected]>
RDMA/core: Clarify rdma_ah_find_type
Paolo Bonzini <[email protected]>
kvm: x86: fix KVM_XEN_HVM_CONFIG ioctl
Dan Carpenter <[email protected]>
ASoC: au1x: Fix timeout tests in au1xac97c_ac97_read()
Takashi Iwai <[email protected]>
ALSA: hda - Use IS_REACHABLE() for dependency on input
Hans de Goede <[email protected]>
ACPI / LPSS: Do not instiate platform_dev for devs without MMIO resources
NeilBrown <[email protected]>
NFSv4: always set NFS_LOCK_LOST when a lock is lost.
Peter Zijlstra <[email protected]>
x86/tsc: Allow TSC calibration without PIT
Hector Martin <[email protected]>
firewire-ohci: work around oversized DMA reads on JMicron controllers
Michael Neuling <[email protected]>
powerpc/eeh: Fix race with driver un/bind
Merlijn Wajer <[email protected]>
usb: musb: Fix external abort in musb_remove on omap2430
Merlijn Wajer <[email protected]>
usb: musb: call pm_runtime_{get,put}_sync before reading vbus registers
Andreas Kemnade <[email protected]>
usb: musb: fix enumeration after resume
Imre Deak <[email protected]>
drm/i915/bxt, glk: Increase PCODE timeouts during CDCLK freq changing
Imre Deak <[email protected]>
drm/i915: Fix LSPCON TMDS output buffer enabling from low-power state
Xidong Wang <[email protected]>
drm/i915: Do no use kfree() to free a kmem_cache_alloc() return value
Gaurav K Singh <[email protected]>
drm/i915/audio: Fix audio detection issue on GLK
Gerd Hoffmann <[email protected]>
drm/i915/gvt: throw error on unhandled vfio ioctls
Daniel J Blueman <[email protected]>
drm/vc4: Fix memory leak during BO teardown
Xiaoming Gao <[email protected]>
x86/tsc: Prevent 32bit truncation in calc_hpet_ref()
Anson Huang <[email protected]>
clocksource/imx-tpm: Correct -ETIME return condition check
Dou Liyang <[email protected]>
x86/acpi: Prevent X2APIC id 0xffffffff from being accounted
David Sterba <[email protected]>
btrfs: fix unaligned access in readdir
Steve French <[email protected]>
cifs: do not allow creating sockets except with SMB1 posix exensions
-------------
Diffstat:
Documentation/device-mapper/thin-provisioning.txt | 8 +- Documentation/virtual/kvm/api.txt | 1 + Makefile | 4 +- arch/arm64/include/asm/spinlock.h | 4 +- arch/mips/boot/compressed/Makefile | 6 +- arch/mips/generic/irq.c | 18 +- arch/mips/include/asm/machine.h | 2 +- arch/mips/txx9/rbtx4939/setup.c | 4 +- arch/powerpc/include/asm/book3s/64/pgalloc.h | 10 +- arch/powerpc/include/uapi/asm/kvm.h | 2 + arch/powerpc/kernel/eeh_driver.c | 65 +- arch/powerpc/kernel/traps.c | 2 +- arch/powerpc/kvm/book3s_64_mmu_hv.c | 8 +- arch/powerpc/kvm/book3s_hv.c | 8 + arch/powerpc/kvm/powerpc.c | 2 +- arch/powerpc/mm/numa.c | 78 +- arch/powerpc/platforms/powernv/opal-imc.c | 6 +- arch/s390/include/asm/eadm.h | 2 +- arch/s390/kvm/kvm-s390.c | 4 +- arch/s390/kvm/vsie.c | 50 +- arch/sparc/include/asm/pgtable_64.h | 2 +- arch/sparc/mm/tlb.c | 23 +- arch/x86/hyperv/hv_init.c | 9 +- arch/x86/hyperv/mmu.c | 12 +- arch/x86/include/asm/i8259.h | 5 + arch/x86/kernel/acpi/boot.c | 4 + arch/x86/kernel/apic/x2apic_uv_x.c | 15 +- arch/x86/kernel/dumpstack.c | 2 +- arch/x86/kernel/tsc.c | 20 +- arch/x86/kvm/mmu.c | 2 +- arch/x86/kvm/vmx.c | 16 +- arch/x86/kvm/x86.c | 10 +- arch/x86/mm/init_64.c | 3 +- arch/x86/power/hibernate_32.c | 2 +- arch/x86/power/hibernate_64.c | 2 +- block/bio.c | 2 +- block/blk-core.c | 2 + block/blk-merge.c | 29 +- block/blk-mq-debugfs.c | 6 +- block/blk-mq.c | 22 +- drivers/acpi/acpi_lpss.c | 2 + drivers/acpi/bus.c | 6 + drivers/acpi/ec.c | 6 + drivers/acpi/processor_perflib.c | 2 +- drivers/acpi/scan.c | 20 +- drivers/base/power/domain.c | 76 +- drivers/base/power/wakeirq.c | 6 +- drivers/char/ipmi/ipmi_powernv.c | 5 +- drivers/clocksource/timer-imx-tpm.c | 2 +- drivers/cpufreq/intel_pstate.c | 5 + drivers/crypto/Kconfig | 1 - drivers/firewire/ohci.c | 8 +- drivers/firmware/dmi_scan.c | 22 +- drivers/gpu/drm/drm_dp_dual_mode_helper.c | 39 +- drivers/gpu/drm/i915/gvt/kvmgt.c | 2 +- drivers/gpu/drm/i915/i915_drv.h | 6 +- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 2 +- drivers/gpu/drm/i915/intel_audio.c | 2 +- drivers/gpu/drm/i915/intel_cdclk.c | 22 +- drivers/gpu/drm/i915/intel_pm.c | 6 +- .../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 +- drivers/gpu/drm/vc4/vc4_bo.c | 2 + drivers/gpu/drm/vc4/vc4_validate_shaders.c | 1 + drivers/hid/hid-roccat-kovaplus.c | 2 + drivers/infiniband/core/cma.c | 8 +- drivers/infiniband/core/cq.c | 30 +- drivers/infiniband/core/uverbs_ioctl.c | 19 +- drivers/infiniband/hw/hfi1/chip.c | 18 +- drivers/infiniband/hw/hfi1/file_ops.c | 4 +- drivers/infiniband/hw/hfi1/hfi.h | 1 + drivers/infiniband/hw/hfi1/init.c | 4 +- drivers/infiniband/hw/i40iw/i40iw_puda.c | 3 +- drivers/infiniband/hw/i40iw/i40iw_puda.h | 1 + drivers/infiniband/hw/i40iw/i40iw_verbs.c | 2 + drivers/infiniband/hw/mlx5/qp.c | 8 +- drivers/infiniband/ulp/ipoib/ipoib_main.c | 3 + drivers/input/mouse/psmouse-base.c | 34 +- drivers/input/mouse/synaptics.c | 10 + drivers/input/touchscreen/stmfts.c | 11 +- drivers/iommu/exynos-iommu.c | 7 + drivers/iommu/intel-iommu.c | 3 +- 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/irqchip/irq-gic-v3.c | 2 +- drivers/md/bcache/alloc.c | 4 +- drivers/md/bcache/bcache.h | 2 +- drivers/md/bcache/btree.c | 9 +- drivers/md/bcache/super.c | 23 +- drivers/md/bcache/sysfs.c | 11 +- drivers/md/bcache/writeback.c | 7 +- drivers/md/dm-mpath.c | 14 +- drivers/net/ethernet/freescale/gianfar.c | 9 +- drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 14 +- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 18 +- drivers/net/ethernet/intel/i40e/i40e_main.c | 3 + drivers/net/ethernet/intel/i40evf/i40evf.h | 1 + drivers/net/ethernet/intel/i40evf/i40evf_main.c | 9 +- .../net/ethernet/intel/i40evf/i40evf_virtchnl.c | 35 +- drivers/net/ethernet/intel/igb/igb_main.c | 42 +- drivers/net/ethernet/intel/igb/igb_ptp.c | 9 + drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 8 +- drivers/net/ethernet/netronome/nfp/nfp_main.c | 1 + .../net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 6 +- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 6 +- drivers/net/wireless/mac80211_hwsim.c | 11 +- drivers/net/xen-netfront.c | 46 +- drivers/ntb/ntb_transport.c | 3 + drivers/pci/quirks.c | 2 + drivers/platform/x86/dell-laptop.c | 24 +- drivers/platform/x86/thinkpad_acpi.c | 10 + drivers/scsi/arm/fas216.c | 2 +- drivers/scsi/qla2xxx/qla_init.c | 4 + drivers/scsi/scsi_devinfo.c | 7 +- drivers/spi/spi-armada-3700.c | 5 + .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 2 + drivers/tty/serial/8250/8250_exar.c | 34 +- drivers/tty/serial/8250/8250_port.c | 26 - drivers/usb/musb/musb_core.c | 7 +- drivers/watchdog/sp5100_tco.h | 2 +- drivers/xen/grant-table.c | 4 +- fs/btrfs/ctree.c | 12 +- fs/btrfs/disk-io.c | 6 +- fs/btrfs/file.c | 9 + fs/btrfs/inode.c | 37 +- fs/btrfs/raid56.c | 55 +- fs/btrfs/volumes.c | 9 +- fs/cifs/cifssmb.c | 4 +- fs/cifs/dir.c | 9 +- fs/dax.c | 2 +- fs/f2fs/gc.c | 7 +- fs/jffs2/fs.c | 1 - fs/nfs/nfs4proc.c | 12 +- fs/nfs/nfs4state.c | 5 +- fs/nfs/nfs4sysctl.c | 2 +- fs/ocfs2/acl.c | 6 + fs/ocfs2/journal.c | 23 +- fs/ocfs2/super.c | 5 +- fs/ocfs2/xattr.c | 2 + fs/proc/base.c | 29 +- fs/proc/kcore.c | 4 + fs/ubifs/tnc.c | 21 +- include/asm-generic/pgtable.h | 15 + include/linux/cpumask.h | 2 + include/linux/etherdevice.h | 2 +- include/linux/kcore.h | 1 + include/linux/netfilter/x_tables.h | 3 +- include/linux/pci.h | 7 + include/linux/property.h | 10 +- include/linux/suspend.h | 2 + include/rdma/ib_verbs.h | 23 +- include/trace/events/timer.h | 20 +- kernel/bpf/sockmap.c | 19 +- kernel/events/callchain.c | 21 +- kernel/events/core.c | 4 +- kernel/locking/qspinlock.c | 8 + kernel/power/power.h | 3 - kernel/time/alarmtimer.c | 34 +- lib/test_bpf.c | 31 +- mm/fadvise.c | 10 +- mm/khugepaged.c | 12 +- mm/mempolicy.c | 33 +- mm/vmscan.c | 14 +- net/bridge/netfilter/ebtables.c | 10 +- net/ipv4/netfilter/arp_tables.c | 12 +- net/ipv4/netfilter/ip_tables.c | 10 +- net/ipv4/tcp_nv.c | 2 +- net/ipv6/netfilter/ip6_tables.c | 12 +- net/ipv6/netfilter/nf_conntrack_reasm.c | 16 +- net/netfilter/x_tables.c | 51 +- 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 + net/openvswitch/conntrack.c | 34 + net/rds/ib.c | 3 +- net/rxrpc/conn_event.c | 1 + net/rxrpc/rxkad.c | 92 +- net/sunrpc/xprtrdma/backchannel.c | 12 +- net/sunrpc/xprtrdma/svc_rdma_rw.c | 12 +- net/sunrpc/xprtrdma/verbs.c | 32 +- net/sunrpc/xprtrdma/xprt_rdma.h | 2 +- net/sunrpc/xprtsock.c | 4 +- samples/bpf/Makefile | 5 +- scripts/kconfig/expr.c | 2 +- scripts/kconfig/menu.c | 1 + scripts/kconfig/zconf.y | 33 +- sound/pci/hda/Kconfig | 1 - sound/pci/hda/patch_realtek.c | 5 + sound/soc/au1x/ac97c.c | 6 +- sound/soc/rockchip/rk3399_gru_sound.c | 19 +- tools/lib/bpf/Makefile | 2 +- tools/lib/bpf/libbpf.c | 26 + tools/lib/traceevent/event-parse.c | 17 +- tools/lib/traceevent/parse-filter.c | 10 +- tools/perf/arch/x86/util/header.c | 2 +- tools/perf/builtin-c2c.c | 5 +- tools/perf/builtin-record.c | 3 +- tools/perf/builtin-report.c | 5 +- tools/perf/builtin-script.c | 5 +- tools/perf/perf.h | 1 + tools/perf/tests/dwarf-unwind.c | 1 + .../perf/tests/shell/trace+probe_libc_inet_pton.sh | 21 +- tools/perf/util/callchain.c | 10 + tools/perf/util/callchain.h | 2 + tools/perf/util/evsel.c | 21 +- tools/perf/util/unwind-libunwind-local.c | 9 +- tools/testing/selftests/bpf/test_maps.c | 16 +- .../ftrace/test.d/ftrace/func-filter-glob.tc | 6 + .../ftrace/test.d/kprobe/multiple_kprobes.tc | 4 +- tools/testing/selftests/net/reuseport_bpf.c | 21 +- virt/kvm/kvm_main.c | 7 +- 216 files changed, 3025 insertions(+), 1982 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 27/183 KVM: s390: use created_vcpus in more places
4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -601,7 +601,7 @@ static int kvm_vm_ioctl_enable_cap(struccase 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 );
@@ -1121,7 +1121,7 @@ static int kvm_s390_set_processor_feat(sreturn -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 ;
Greg Kroah-Hartman
maintainerPATCH 42/183 perf record: Fix failed memory allocation for get_cpuid_str
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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 ; }
Greg Kroah-Hartman
maintainerPATCH 46/183 dm thin: fix documentation relative to low water mark threshold
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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 o 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
Greg Kroah-Hartman
maintainerPATCH 56/183 PCI: Add dummy pci_irqd_intx_xlate() for CONFIG_PCI=n build
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: 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
@@ -1688,6 +1688,13 @@ static inline int pci_get_new_domain_nr(#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 */