5.4.7-stable review
Subsystems (13)
Greg Kroah-Hartman
maintainerPATCH 308/434 bcache: fix deadlock in bcache_allocator
In reply to Greg Kroah-HartmanFrom: Andrea Righi <[email protected]>
[ Upstream commit 84c529aea182939e68f618ed9813740c9165c7eb ]
bcache_allocator can call the following:
bch_allocator_thread()
-> bch_prio_write()
-> bch_bucket_alloc()
-> wait on &ca->set->bucket_waitBut the wake up event on bucket_wait is supposed to come from bch_allocator_thread() itself => deadlock:
[ 1158.490744] INFO: task bcache_allocato:15861 blocked for more than 10 seconds. [ 1158.495929] Not tainted 5.3.0-050300rc3-generic #201908042232 [ 1158.500653] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 1158.504413] bcache_allocato D 0 15861 2 0x80004000 [ 1158.504419] Call Trace: [ 1158.504429] __schedule+0x2a8/0x670 [ 1158.504432] schedule+0x2d/0x90 [ 1158.504448] bch_bucket_alloc+0xe5/0x370 [bcache] [ 1158.504453] ? wait_woken+0x80/0x80 [ 1158.504466] bch_prio_write+0x1dc/0x390 [bcache] [ 1158.504476] bch_allocator_thread+0x233/0x490 [bcache] [ 1158.504491] kthread+0x121/0x140 [ 1158.504503] ? invalidate_buckets+0x890/0x890 [bcache] [ 1158.504506] ? kthread_park+0xb0/0xb0 [ 1158.504510] ret_from_fork+0x35/0x40
Fix by making the call to bch_prio_write() non-blocking, so that bch_allocator_thread() never waits on itself.
Moreover, make sure to wake up the garbage collector thread when bch_prio_write() is failing to allocate buckets.
--- drivers/md/bcache/alloc.c | 5 ++++- drivers/md/bcache/bcache.h | 2 +- drivers/md/bcache/super.c | 27 +++++++++++++++++++++------ 3 files changed, 26 insertions(+), 8 deletions(-)
drivers/md/bcache/alloc.c +4 -1
@@ -377,7 +377,10 @@ retry_invalidate:if (!fifo_full (&ca->free_inc)) goto retry_invalidate; -bch_prio_write (ca); +if (bch_prio_write (ca, false) <0 ) { + ca->invalidate_needs_gc =1 ; +wake_up_gc (ca->set); + } } } out:
drivers/md/bcache/bcache.h +1 -1
@@ -977,7 +977,7 @@ bool bch_cached_dev_error(struct cached_dev *dc); __printf(2, 3)bool bch_cache_set_error (struct cache_set *c,const char *fmt, ...); -void bch_prio_write (struct cache *ca); +int bch_prio_write (struct cache *ca,bool wait);void bch_write_bdev_super (struct cached_dev *dc,struct closure *parent);extern struct workqueue_struct *bcache_wq;
drivers/md/bcache/super.c +21 -6
@@ -529,12 +529,29 @@ static void prio_io(struct cache *ca, uint64_t bucket, int op,closure_sync (cl); } -void bch_prio_write (struct cache *ca) +int bch_prio_write (struct cache *ca,bool wait) {int i;struct bucket *b;struct closure cl; +pr_debug ("free_prio=%zu, free_none=%zu, free_inc=%zu" , +fifo_used (&ca->free[RESERVE_PRIO ]), +fifo_used (&ca->free[RESERVE_NONE ]), +fifo_used (&ca->free_inc)); + +/* +* Pre-check if there are enough free buckets. In the non-blocking +* scenario it's better to fail early rather than starting to allocate +* buckets and do a cleanup later in case of failure. +*/ +if (!wait) { +size_t avail =fifo_used (&ca->free[RESERVE_PRIO ]) + +fifo_used (&ca->free[RESERVE_NONE ]); +if (prio_buckets (ca) > avail) +return -ENOMEM ; + } +closure_init_stack (&cl);lockdep_assert_held (&ca->set->bucket_lock);
@@ -544,9 +561,6 @@ void bch_prio_write(struct cache *ca)atomic_long_add (ca->sb.bucket_size *prio_buckets (ca), &ca->meta_sectors_written); -//pr_debug("free %zu, free_inc %zu, unused %zu", fifo_used(&ca->free), -// fifo_used(&ca->free_inc), fifo_used(&ca->unused)); -for (i =prio_buckets (ca) -1 ; i >=0 ; --i) {long bucket;struct prio_set *p = ca->disk_buckets;
@@ -564,7 +578,7 @@ void bch_prio_write(struct cache *ca) p->magic =pset_magic (&ca->sb); p->csum =bch_crc64 (&p->magic,bucket_bytes (ca) -8 ); - bucket =bch_bucket_alloc (ca,RESERVE_PRIO , true); + bucket =bch_bucket_alloc (ca,RESERVE_PRIO , wait);BUG_ON (bucket ==-1 );mutex_unlock (&ca->set->bucket_lock);
@@ -593,6 +607,7 @@ void bch_prio_write(struct cache *ca) ca->prio_last_buckets[i] = ca->prio_buckets[i]; } +return 0 ; }static void prio_read (struct cache *ca,uint64_t bucket)
@@ -1962,7 +1977,7 @@ static int run_cache_set(struct cache_set *c)mutex_lock (&c->bucket_lock);for_each_cache (ca, c, i) -bch_prio_write (ca); +bch_prio_write (ca, true);mutex_unlock (&c->bucket_lock); err ="cannot allocate new UUID bucket" ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 309/434 iwlwifi: mvm: fix unaligned read of rx_pkt_status
In reply to Greg Kroah-HartmanFrom: Wang Xuerui <[email protected]>
[ Upstream commit c5aaa8be29b25dfe1731e9a8b19fd91b7b789ee3 ]
This is present since the introduction of iwlmvm.
Example stack trace on MIPS:
[<ffffffffc0789328>] iwl_mvm_rx_rx_mpdu+0xa8/0xb88 [iwlmvm] [<ffffffffc0632b40>] iwl_pcie_rx_handle+0x420/0xc48 [iwlwifi]
Tested with a Wireless AC 7265 for ~6 months, confirmed to fix the problem. No other unaligned accesses are spotted yet.
--- drivers/net/wireless/intel/iwlwifi/mvm/rx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/rx.c +2 -1
@@ -60,6 +60,7 @@* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#include <asm/unaligned.h> #include <linux/etherdevice.h> #include <linux/skbuff.h> #include "iwl-trans.h"
@@ -357,7 +358,7 @@ void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct napi_struct *napi, rx_res = (struct iwl_rx_mpdu_res_start *)pkt->data; hdr = (struct ieee80211_hdr *)(pkt->data +sizeof (*rx_res)); len =le16_to_cpu (rx_res->byte_count); - rx_pkt_status =le32_to_cpup ((__le32 *) + rx_pkt_status =get_unaligned_le32 ((__le32 *) (pkt->data +sizeof (*rx_res) + len));/* Dont use dev_alloc_skb(), we'll have enough headroom once
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 310/434 ASoC: wm8904: fix regcache handling
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit e9149b8c00d25dbaef1aa174fc604bed207e576d ]
The current code assumes that the power is turned off in SND_SOC_BIAS_OFF. If there are no actual regulator the codec isn't turned off and the registers are not reset to their default values but the regcache is still marked as dirty. Thus a value might not be written to the hardware if it is set to the default value. Do a software reset before turning off the power to make sure the registers are always reset to their default states.
--- sound/soc/codecs/wm8904.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/codecs/wm8904.c +1 -0
@@ -1917,6 +1917,7 @@ static int wm8904_set_bias_level(struct snd_soc_component *component,snd_soc_component_update_bits (component,WM8904_BIAS_CONTROL_0 ,WM8904_BIAS_ENA ,0 ); +snd_soc_component_write (component,WM8904_SW_RESET_AND_ID ,0 );regcache_cache_only (wm8904->regmap, true);regcache_mark_dirty (wm8904->regmap);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 311/434 regulator: core: Let boot-on regulators be powered off
In reply to Greg Kroah-HartmanFrom: Pascal Paillet <[email protected]>
[ Upstream commit 089b3f61ecfc43ca4ea26d595e1d31ead6de3f7b ]
Boot-on regulators are always kept on because their use_count value is now incremented at boot time and never cleaned.
Only increment count value for alway-on regulators. regulator_late_cleanup() is now able to power off boot-on regulators when unused.
--- drivers/regulator/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/regulator/core.c +3 -1
@@ -1403,7 +1403,9 @@ static int set_machine_constraints(struct regulator_dev *rdev,rdev_err (rdev,"failed to enable\n" );return ret; } - rdev->use_count++; + +if (rdev->constraints->always_on) + rdev->use_count++; }print_constraints (rdev);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 312/434 spi: tegra20-slink: add missed clk_unprepare
In reply to Greg Kroah-HartmanFrom: Chuhong Yuan <[email protected]>
[ Upstream commit 04358e40ba96d687c0811c21d9dede73f5244a98 ]
The driver misses calling clk_unprepare in probe failure and remove. Add the calls to fix it.
--- drivers/spi/spi-tegra20-slink.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/spi/spi-tegra20-slink.c +4 -1
@@ -1073,7 +1073,7 @@ static int tegra_slink_probe(struct platform_device *pdev) ret =clk_enable (tspi->clk);if (ret <0 ) {dev_err (&pdev->dev,"Clock enable failed %d\n" , ret); - goto exit_free_master; + goto exit_clk_unprepare; } spi_irq =platform_get_irq (pdev,0 );
@@ -1146,6 +1146,8 @@ exit_free_irq:free_irq (spi_irq, tspi); exit_clk_disable:clk_disable (tspi->clk); +exit_clk_unprepare: +clk_unprepare (tspi->clk); exit_free_master:spi_master_put (master);return ret;
@@ -1159,6 +1161,7 @@ static int tegra_slink_remove(struct platform_device *pdev)free_irq (tspi->irq, tspi);clk_disable (tspi->clk); +clk_unprepare (tspi->clk);if (tspi->tx_dma_chan)tegra_slink_deinit_dma_param (tspi, false);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 313/434 tun: fix data-race in gro_normal_list()
In reply to Greg Kroah-HartmanFrom: Petar Penkov <[email protected]>
[ Upstream commit c39e342a050a4425348e6fe7f75827c0a1a7ebc5 ]
There is a race in the TUN driver between napi_busy_loop and napi_gro_frags. This commit resolves the race by adding the NAPI struct via netif_tx_napi_add, instead of netif_napi_add, which disables polling for the NAPI struct.
KCSAN reported:
BUG: KCSAN: data-race in gro_normal_list.part.0 / napi_busy_loop
write to 0xffff8880b5d474b0 of 4 bytes by task 11205 on cpu 0:
gro_normal_list.part.0+0x77/0xb0 net/core/dev.c:5682 gro_normal_list net/core/dev.c:5678 [inline] gro_normal_one net/core/dev.c:5692 [inline] napi_frags_finish net/core/dev.c:5705 [inline] napi_gro_frags+0x625/0x770 net/core/dev.c:5778 tun_get_user+0x2150/0x26a0 drivers/net/tun.c:1976 tun_chr_write_iter+0x79/0xd0 drivers/net/tun.c:2022 call_write_iter include/linux/fs.h:1895 [inline] do_iter_readv_writev+0x487/0x5b0 fs/read_write.c:693 do_iter_write fs/read_write.c:970 [inline] do_iter_write+0x13b/0x3c0 fs/read_write.c:951 vfs_writev+0x118/0x1c0 fs/read_write.c:1015 do_writev+0xe3/0x250 fs/read_write.c:1058 __do_sys_writev fs/read_write.c:1131 [inline] __se_sys_writev fs/read_write.c:1128 [inline] __x64_sys_writev+0x4e/0x60 fs/read_write.c:1128 do_syscall_64+0xcc/0x370 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9
read to 0xffff8880b5d474b0 of 4 bytes by task 11168 on cpu 1:
gro_normal_list net/core/dev.c:5678 [inline] napi_busy_loop+0xda/0x4f0 net/core/dev.c:6126 sk_busy_loop include/net/busy_poll.h:108 [inline] __skb_recv_udp+0x4ad/0x560 net/ipv4/udp.c:1689 udpv6_recvmsg+0x29e/0xe90 net/ipv6/udp.c:288 inet6_recvmsg+0xbb/0x240 net/ipv6/af_inet6.c:592 sock_recvmsg_nosec net/socket.c:871 [inline] sock_recvmsg net/socket.c:889 [inline] sock_recvmsg+0x92/0xb0 net/socket.c:885 sock_read_iter+0x15f/0x1e0 net/socket.c:967 call_read_iter include/linux/fs.h:1889 [inline] new_sync_read+0x389/0x4f0 fs/read_write.c:414 __vfs_read+0xb1/0xc0 fs/read_write.c:427 vfs_read fs/read_write.c:461 [inline] vfs_read+0x143/0x2c0 fs/read_write.c:446 ksys_read+0xd5/0x1b0 fs/read_write.c:587 __do_sys_read fs/read_write.c:597 [inline] __se_sys_read fs/read_write.c:595 [inline] __x64_sys_read+0x4c/0x60 fs/read_write.c:595 do_syscall_64+0xcc/0x370 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9
Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 11168 Comm: syz-executor.0 Not tainted 5.4.0-rc6+ #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
--- drivers/net/tun.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/tun.c +2 -2
@@ -313,8 +313,8 @@ static void tun_napi_init(struct tun_struct *tun, struct tun_file *tfile, tfile->napi_enabled = napi_en; tfile->napi_frags_enabled = napi_en && napi_frags;if (napi_en) { -netif_napi_add (tun->dev, &tfile->napi, tun_napi_poll, -NAPI_POLL_WEIGHT ); +netif_tx_napi_add (tun->dev, &tfile->napi, tun_napi_poll, +NAPI_POLL_WEIGHT );napi_enable (&tfile->napi); } }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 314/434 xhci-pci: Allow host runtime PM as default also for Intel Ice Lake xHCI
In reply to Greg Kroah-HartmanFrom: Mika Westerberg <[email protected]>
[ Upstream commit 07a594f353655b1628f598add352e7e754f44869 ]
Intel Ice Lake has two xHCI controllers one on PCH and the other as part of the CPU itself. The latter is also part of the so called Type C Subsystem (TCSS) sharing ACPI power resources with the PCIe root ports and the Thunderbolt controllers. In order to put the whole TCSS block into D3cold the xHCI needs to be runtime suspended as well when idle.
For this reason allow runtime PM as default for Ice Lake TCSS xHCI controller.
--- drivers/usb/host/xhci-pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-pci.c +3 -1
@@ -48,6 +48,7 @@#define PCI_DEVICE_ID_INTEL_TITAN_RIDGE_2C_XHCI 0x15e9#define PCI_DEVICE_ID_INTEL_TITAN_RIDGE_4C_XHCI 0x15ec#define PCI_DEVICE_ID_INTEL_TITAN_RIDGE_DD_XHCI 0x15f0 +#define PCI_DEVICE_ID_INTEL_ICE_LAKE_XHCI 0x8a13#define PCI_DEVICE_ID_AMD_PROMONTORYA_4 0x43b9#define PCI_DEVICE_ID_AMD_PROMONTORYA_3 0x43ba
@@ -212,7 +213,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) pdev->device ==PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_4C_XHCI || pdev->device ==PCI_DEVICE_ID_INTEL_TITAN_RIDGE_2C_XHCI || pdev->device ==PCI_DEVICE_ID_INTEL_TITAN_RIDGE_4C_XHCI || - pdev->device == PCI_DEVICE_ID_INTEL_TITAN_RIDGE_DD_XHCI)) + pdev->device ==PCI_DEVICE_ID_INTEL_TITAN_RIDGE_DD_XHCI || + pdev->device == PCI_DEVICE_ID_INTEL_ICE_LAKE_XHCI)) xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW; if (pdev->vendor == PCI_VENDOR_ID_ETRON &&
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 315/434 crypto: virtio - deal with unsupported input sizes
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit 19c5da7d4a2662e85ea67d2d81df57e038fde3ab ]
Return -EINVAL for input sizes that are not a multiple of the AES block size, since they are not supported by our CBC chaining mode.
While at it, remove the pr_err() that reports unsupported key sizes being used: we shouldn't spam the kernel log with that.
--- drivers/crypto/virtio/virtio_crypto_algs.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/crypto/virtio/virtio_crypto_algs.c +10 -2
@@ -105,8 +105,6 @@ virtio_crypto_alg_validate_key(int key_len, uint32_t *alg) *alg =VIRTIO_CRYPTO_CIPHER_AES_CBC ;break ;default : -pr_err ("virtio_crypto: Unsupported key length: %d\n" , - key_len);return -EINVAL ; }return 0 ;
@@ -484,6 +482,11 @@ static int virtio_crypto_ablkcipher_encrypt(struct ablkcipher_request *req)/* Use the first data virtqueue as default */ struct data_queue *data_vq = &vcrypto->data_vq[0 ]; +if (!req->nbytes) +return 0 ; +if (req->nbytes %AES_BLOCK_SIZE ) +return -EINVAL ; + vc_req->dataq = data_vq; vc_req->alg_cb = virtio_crypto_dataq_sym_callback; vc_sym_req->ablkcipher_ctx = ctx;
@@ -504,6 +507,11 @@ static int virtio_crypto_ablkcipher_decrypt(struct ablkcipher_request *req)/* Use the first data virtqueue as default */ struct data_queue *data_vq = &vcrypto->data_vq[0 ]; +if (!req->nbytes) +return 0 ; +if (req->nbytes %AES_BLOCK_SIZE ) +return -EINVAL ; + vc_req->dataq = data_vq; vc_req->alg_cb = virtio_crypto_dataq_sym_callback; vc_sym_req->ablkcipher_ctx = ctx;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 315/434 crypto: virtio - deal with unsupported input sizes
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit 19c5da7d4a2662e85ea67d2d81df57e038fde3ab ]
Return -EINVAL for input sizes that are not a multiple of the AES block size, since they are not supported by our CBC chaining mode.
While at it, remove the pr_err() that reports unsupported key sizes being used: we shouldn't spam the kernel log with that.
--- drivers/crypto/virtio/virtio_crypto_algs.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/crypto/virtio/virtio_crypto_algs.c +10 -2
@@ -105,8 +105,6 @@ virtio_crypto_alg_validate_key(int key_len, uint32_t *alg) *alg =VIRTIO_CRYPTO_CIPHER_AES_CBC ;break ;default : -pr_err ("virtio_crypto: Unsupported key length: %d\n" , - key_len);return -EINVAL ; }return 0 ;
@@ -484,6 +482,11 @@ static int virtio_crypto_ablkcipher_encrypt(struct ablkcipher_request *req)/* Use the first data virtqueue as default */ struct data_queue *data_vq = &vcrypto->data_vq[0 ]; +if (!req->nbytes) +return 0 ; +if (req->nbytes %AES_BLOCK_SIZE ) +return -EINVAL ; + vc_req->dataq = data_vq; vc_req->alg_cb = virtio_crypto_dataq_sym_callback; vc_sym_req->ablkcipher_ctx = ctx;
@@ -504,6 +507,11 @@ static int virtio_crypto_ablkcipher_decrypt(struct ablkcipher_request *req)/* Use the first data virtqueue as default */ struct data_queue *data_vq = &vcrypto->data_vq[0 ]; +if (!req->nbytes) +return 0 ; +if (req->nbytes %AES_BLOCK_SIZE ) +return -EINVAL ; + vc_req->dataq = data_vq; vc_req->alg_cb = virtio_crypto_dataq_sym_callback; vc_sym_req->ablkcipher_ctx = ctx;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 316/434 mmc: tmio: Add MMC_CAP_ERASE to allow erase/discard/trim requests
In reply to Greg Kroah-HartmanFrom: Eugeniu Rosca <[email protected]>
[ Upstream commit c91843463e9e821dc3b48fe37e3155fa38299f6e ]
Isolated initially to renesas_sdhi_internal_dmac [1], Ulf suggested adding MMC_CAP_ERASE to the TMIO mmc core:
On Fri, Nov 15, 2019 at 10:27:25AM +0100, Ulf Hansson wrote:
-- snip --
This test and due to the discussions with Wolfram and you in this thread, I would actually suggest that you enable MMC_CAP_ERASE for all tmio variants, rather than just for this particular one.
In other words, set the cap in tmio_mmc_host_probe() should be fine, as it seems none of the tmio variants supports HW busy detection at this point.
-- snip --
Testing on R-Car H3ULCB-KF doesn't reveal any issues (v5.4-rc7):
root@rcar-gen3:~# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT mmcblk0 179:0 0 59.2G 0 disk <--- eMMC mmcblk0boot0 179:8 0 4M 1 disk mmcblk0boot1 179:16 0 4M 1 disk mmcblk1 179:24 0 30G 0 disk <--- SD card
root@rcar-gen3:~# time blkdiscard /dev/mmcblk0 real 0m8.659s user 0m0.001s sys 0m1.920s
root@rcar-gen3:~# time blkdiscard /dev/mmcblk1 real 0m1.176s user 0m0.001s sys 0m0.124s
[1] https://lore.kernel.org/linux-renesas-soc/[email protected]/
--- drivers/mmc/host/tmio_mmc_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/tmio_mmc_core.c +1 -1
@@ -1184,7 +1184,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host)if (ret == -EPROBE_DEFER )return ret; - mmc->caps |=MMC_CAP_4_BIT_DATA | pdata->capabilities; + mmc->caps |=MMC_CAP_ERASE |MMC_CAP_4_BIT_DATA | pdata->capabilities; mmc->caps2 |= pdata->capabilities2; mmc->max_segs = pdata->max_segs ? :32 ; mmc->max_blk_size =TMIO_MAX_BLK_SIZE ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 317/434 btrfs: dont prematurely free work in end_workqueue_fn()
In reply to Greg Kroah-HartmanFrom: Omar Sandoval <[email protected]>
[ Upstream commit 9be490f1e15c34193b1aae17da58e14dd9f55a95 ]
Currently, end_workqueue_fn() frees the end_io_wq entry (which embeds the work item) and then calls bio_endio(). This is another potential instance of the bug in "btrfs: don't prematurely free work in run_ordered_work()".
In particular, the endio call may depend on other work items. For example, btrfs_end_dio_bio() can call btrfs_subio_endio_read() -> __btrfs_correct_data_nocsum() -> dio_read_error() -> submit_dio_repair_bio(), which submits a bio that is also completed through a end_workqueue_fn() work item. However, __btrfs_correct_data_nocsum() waits for the newly submitted bio to complete, thus it depends on another work item.
This example currently usually works because we use different workqueue helper functions for BTRFS_WQ_ENDIO_DATA and BTRFS_WQ_ENDIO_DIO_REPAIR. However, it may deadlock with stacked filesystems and is fragile overall. The proper fix is to free the work item at the very end of the work function, so let's do that.
--- fs/btrfs/disk-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/disk-io.c +1 -1
@@ -1657,8 +1657,8 @@ static void end_workqueue_fn(struct btrfs_work *work) bio->bi_status = end_io_wq->status; bio->bi_private = end_io_wq->private; bio->bi_end_io = end_io_wq->end_io; -kmem_cache_free (btrfs_end_io_wq_cache, end_io_wq);bio_endio (bio); +kmem_cache_free (btrfs_end_io_wq_cache, end_io_wq); }static int cleaner_kthread (void *arg)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 318/434 btrfs: dont prematurely free work in run_ordered_work()
In reply to Greg Kroah-HartmanFrom: Omar Sandoval <[email protected]>
[ Upstream commit c495dcd6fbe1dce51811a76bb85b4675f6494938 ]
We hit the following very strange deadlock on a system with Btrfs on a loop device backed by another Btrfs filesystem:
1. The top (loop device) filesystem queues an async_cow work item from cow_file_range_async(). We'll call this work X.
2. Worker thread A starts work X (normal_work_helper()).
3. Worker thread A executes the ordered work for the top filesystem (run_ordered_work()).
4. Worker thread A finishes the ordered work for work X and frees X (work->ordered_free()).
5. Worker thread A executes another ordered work and gets blocked on I/O to the bottom filesystem (still in run_ordered_work()).
6. Meanwhile, the bottom filesystem allocates and queues an async_cow work item which happens to be the recently-freed X.
7. The workqueue code sees that X is already being executed by worker thread A, so it schedules X to be executed _after_ worker thread A finishes (see the find_worker_executing_work() call in process_one_work()).
Now, the top filesystem is waiting for I/O on the bottom filesystem, but the bottom filesystem is waiting for the top filesystem to finish, so we deadlock.
This happens because we are breaking the workqueue assumption that a work item cannot be recycled while it still depends on other work. Fix it by waiting to free the work item until we are done with all of the related ordered work.
P.S.:
One might ask why the workqueue code doesn't try to detect a recycled work item. It actually does try by checking whether the work item has the same work function (find_worker_executing_work()), but in our case the function is the same. This is the only key that the workqueue code has available to compare, short of adding an additional, layer-violating "custom key". Considering that we're the only ones that have ever hit this, we should just play by the rules.
Unfortunately, we haven't been able to create a minimal reproducer other than our full container setup using a compress-force=zstd filesystem on top of another compress-force=zstd filesystem.
--- fs/btrfs/async-thread.c | 56 ++++++++++++++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 12 deletions(-)
fs/btrfs/async-thread.c +44 -12
@@ -252,16 +252,17 @@ out: } } -static void run_ordered_work (struct __btrfs_workqueue *wq) +static void run_ordered_work (struct __btrfs_workqueue *wq, +struct btrfs_work *self) {struct list_head *list = &wq->ordered_list;struct btrfs_work *work;spinlock_t *lock = &wq->list_lock;unsigned long flags; +void *wtag; +bool free_self = false;while (1 ) { -void *wtag; -spin_lock_irqsave (lock, flags);if (list_empty (list))break ;
@@ -287,16 +288,47 @@ static void run_ordered_work(struct __btrfs_workqueue *wq)list_del (&work->ordered_list);spin_unlock_irqrestore (lock, flags); -/* -* We don't want to call the ordered free functions with the -* lock held though. Save the work as tag for the trace event, -* because the callback could free the structure. -*/ - wtag = work; - work->ordered_free (work); -trace_btrfs_all_work_done (wq->fs_info, wtag); +if (work == self) { +/* +* This is the work item that the worker is currently +* executing. +* +* The kernel workqueue code guarantees non-reentrancy +* of work items. I.e., if a work item with the same +* address and work function is queued twice, the second +* execution is blocked until the first one finishes. A +* work item may be freed and recycled with the same +* work function; the workqueue code assumes that the +* original work item cannot depend on the recycled work +* item in that case (see find_worker_executing_work()). +* +* Note that the work of one Btrfs filesystem may depend +* on the work of another Btrfs filesystem via, e.g., a +* loop device. Therefore, we must not allow the current +* work item to be recycled until we are really done, +* otherwise we break the above assumption and can +* deadlock. +*/ + free_self = true; + }else { +/* +* We don't want to call the ordered free functions with +* the lock held though. Save the work as tag for the +* trace event, because the callback could free the +* structure. +*/ + wtag = work; + work->ordered_free (work); +trace_btrfs_all_work_done (wq->fs_info, wtag); + } }spin_unlock_irqrestore (lock, flags); + +if (free_self) { + wtag = self; + self->ordered_free (self); +trace_btrfs_all_work_done (wq->fs_info, wtag); + } }static void normal_work_helper (struct btrfs_work *work)
@@ -324,7 +356,7 @@ static void normal_work_helper(struct btrfs_work *work) work->func (work);if (need_order) {set_bit (WORK_DONE_BIT , &work->flags); -run_ordered_work (wq); +run_ordered_work (wq, work); }if (!need_order)trace_btrfs_all_work_done (wq->fs_info, wtag);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 319/434 sched/uclamp: Fix overzealous type replacement
In reply to Greg Kroah-HartmanFrom: Valentin Schneider <[email protected]>
[ Upstream commit 7763baace1b738d65efa46d68326c9406311c6bf ]
Some uclamp helpers had their return type changed from 'unsigned int' to 'enum uclamp_id' by commit
0413d7f33e60 ("sched/uclamp: Always use 'enum uclamp_id' for clamp_id values")
but it happens that some do return a value in the [0, SCHED_CAPACITY_SCALE] range, which should really be unsigned int. The affected helpers are uclamp_none(), uclamp_rq_max_value() and uclamp_eff_value(). Fix those up.
Note that this doesn't lead to any obj diff using a relatively recent aarch64 compiler (8.3-2019.03). The current code of e.g. uclamp_eff_value() properly returns an 11 bit value (bits_per(1024)) and doesn't seem to do anything funny. I'm still marking this as fixing the above commit to be on the safe side.
--- kernel/sched/core.c | 6 +++--- kernel/sched/sched.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
kernel/sched/core.c +3 -3
@@ -810,7 +810,7 @@ static inline unsigned int uclamp_bucket_base_value(unsigned int clamp_value)return UCLAMP_BUCKET_DELTA *uclamp_bucket_id (clamp_value); } -static inline enum uclamp_id uclamp_none (enum uclamp_id clamp_id) +static inline unsigned int uclamp_none (enum uclamp_id clamp_id) {if (clamp_id ==UCLAMP_MIN )return 0 ;
@@ -853,7 +853,7 @@ static inline void uclamp_idle_reset(struct rq *rq, enum uclamp_id clamp_id, }static inline -enum uclamp_id uclamp_rq_max_value (struct rq *rq,enum uclamp_id clamp_id, +unsigned int uclamp_rq_max_value (struct rq *rq,enum uclamp_id clamp_id,unsigned int clamp_value) {struct uclamp_bucket *bucket = rq->uclamp[clamp_id].bucket;
@@ -918,7 +918,7 @@ uclamp_eff_get(struct task_struct *p, enum uclamp_id clamp_id)return uc_req; } -enum uclamp_id uclamp_eff_value (struct task_struct *p,enum uclamp_id clamp_id) +unsigned int uclamp_eff_value (struct task_struct *p,enum uclamp_id clamp_id) {struct uclamp_se uc_eff;
kernel/sched/sched.h +1 -1
@@ -2309,7 +2309,7 @@ static inline void cpufreq_update_util(struct rq *rq, unsigned int flags) {}#endif /* CONFIG_CPU_FREQ */ #ifdef CONFIG_UCLAMP_TASK -enum uclamp_id uclamp_eff_value (struct task_struct *p,enum uclamp_id clamp_id); +unsigned int uclamp_eff_value (struct task_struct *p,enum uclamp_id clamp_id); static __always_inline unsigned int uclamp_util_with(struct rq *rq, unsigned int util,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 320/434 ASoC: wm2200: add missed operations in remove and probe failure
In reply to Greg Kroah-HartmanFrom: Chuhong Yuan <[email protected]>
[ Upstream commit 2dab09be49a1e7a4dd13cb47d3a1441a2ef33a87 ]
This driver misses calls to pm_runtime_disable and regulator_bulk_disable in remove and a call to free_irq in probe failure.
Add the calls to fix it.
--- sound/soc/codecs/wm2200.c | 5 +++++ 1 file changed, 5 insertions(+)
sound/soc/codecs/wm2200.c +5 -0
@@ -2410,6 +2410,8 @@ static int wm2200_i2c_probe(struct i2c_client *i2c, err_pm_runtime:pm_runtime_disable (&i2c->dev); +if (i2c->irq) +free_irq (i2c->irq, wm2200); err_reset:if (wm2200->pdata.reset)gpio_set_value_cansleep (wm2200->pdata.reset,0 );
@@ -2426,12 +2428,15 @@ static int wm2200_i2c_remove(struct i2c_client *i2c) {struct wm2200_priv *wm2200 =i2c_get_clientdata (i2c); +pm_runtime_disable (&i2c->dev);if (i2c->irq)free_irq (i2c->irq, wm2200);if (wm2200->pdata.reset)gpio_set_value_cansleep (wm2200->pdata.reset,0 );if (wm2200->pdata.ldo_ena)gpio_set_value_cansleep (wm2200->pdata.ldo_ena,0 ); +regulator_bulk_disable (ARRAY_SIZE (wm2200->core_supplies), + wm2200->core_supplies);return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 321/434 spi: st-ssc4: add missed pm_runtime_disable
In reply to Greg Kroah-HartmanFrom: Chuhong Yuan <[email protected]>
[ Upstream commit cd050abeba2a95fe5374eec28ad2244617bcbab6 ]
The driver forgets to call pm_runtime_disable in probe failure and remove.
Add the missed calls to fix it.
--- drivers/spi/spi-st-ssc4.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/spi/spi-st-ssc4.c +3 -0
@@ -381,6 +381,7 @@ static int spi_st_probe(struct platform_device *pdev)return 0 ; clk_disable: +pm_runtime_disable (&pdev->dev);clk_disable_unprepare (spi_st->clk); put_master:spi_master_put (master);
@@ -392,6 +393,8 @@ static int spi_st_remove(struct platform_device *pdev)struct spi_master *master =platform_get_drvdata (pdev);struct spi_st *spi_st =spi_master_get_devdata (master); +pm_runtime_disable (&pdev->dev); +clk_disable_unprepare (spi_st->clk);pinctrl_pm_select_sleep_state (&pdev->dev);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 322/434 ASoC: wm5100: add missed pm_runtime_disable
In reply to Greg Kroah-HartmanFrom: Chuhong Yuan <[email protected]>
[ Upstream commit b1176bbb70866f24099cd2720283c7219fb4a81c ]
The driver forgets to call pm_runtime_disable in remove and probe failure.
Add the calls to fix it.
--- sound/soc/codecs/wm5100.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/codecs/wm5100.c +2 -0
@@ -2617,6 +2617,7 @@ static int wm5100_i2c_probe(struct i2c_client *i2c,return ret; err_reset: +pm_runtime_disable (&i2c->dev);if (i2c->irq)free_irq (i2c->irq, wm5100);wm5100_free_gpio (i2c);
@@ -2640,6 +2641,7 @@ static int wm5100_i2c_remove(struct i2c_client *i2c) {struct wm5100_priv *wm5100 =i2c_get_clientdata (i2c); +pm_runtime_disable (&i2c->dev);if (i2c->irq)free_irq (i2c->irq, wm5100);wm5100_free_gpio (i2c);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 323/434 perf/core: Fix the mlock accounting, again
In reply to Greg Kroah-HartmanFrom: Alexander Shishkin <[email protected]>
[ Upstream commit 36b3db03b4741b8935b68fffc7e69951d8d70a89 ]
Commit:
5e6c3c7b1ec2 ("perf/aux: Fix tracking of auxiliary trace buffer allocation")
tried to guess the correct combination of arithmetic operations that would undo the AUX buffer's mlock accounting, and failed, leaking the bottom part when an allocation needs to be charged partially to both user->locked_vm and mm->pinned_vm, eventually leaving the user with no locked bonus:
$ perf record -e intel_pt//u -m1,128 uname [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.061 MB perf.data ]
$ perf record -e intel_pt//u -m1,128 uname Permission error mapping pages. Consider increasing /proc/sys/kernel/perf_event_mlock_kb, or try again with a smaller value of -m/--mmap_pages. (current value: 1,128)
Fix this by subtracting both locked and pinned counts when AUX buffer is unmapped.
--- kernel/events/core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
kernel/events/core.c +2 -4
@@ -5607,10 +5607,8 @@ static void perf_mmap_close(struct vm_area_struct *vma)perf_pmu_output_stop (event);/* now it's safe to free the pages */ -if (!rb->aux_mmap_locked) -atomic_long_sub (rb->aux_nr_pages, &mmap_user->locked_vm); -else -atomic64_sub (rb->aux_mmap_locked, &vma->vm_mm->pinned_vm); +atomic_long_sub (rb->aux_nr_pages - rb->aux_mmap_locked, &mmap_user->locked_vm); +atomic64_sub (rb->aux_mmap_locked, &vma->vm_mm->pinned_vm);/* this has to be the last one */ rb_free_aux (rb);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 324/434 selftests, bpf: Fix test_tc_tunnel hanging
In reply to Greg Kroah-HartmanFrom: Jiri Benc <[email protected]>
[ Upstream commit 3b054b7133b4ad93671c82e8d6185258e3f1a7a5 ]
When run_kselftests.sh is run, it hangs after test_tc_tunnel.sh. The reason is test_tc_tunnel.sh ensures the server ('nc -l') is run all the time, starting it again every time it is expected to terminate. The exception is the final client_connect: the server is not started anymore, which ensures no process is kept running after the test is finished.
For a sit test, though, the script is terminated prematurely without the final client_connect and the 'nc' process keeps running. This in turn causes the run_one function in kselftest/runner.sh to hang forever, waiting for the runaway process to finish.
Ensure a remaining server is terminated on cleanup.
--- tools/testing/selftests/bpf/test_tc_tunnel.sh | 5 +++++ 1 file changed, 5 insertions(+)
tools/testing/selftests/bpf/test_tc_tunnel.sh +5 -0
@@ -62,6 +62,10 @@ cleanup() { if [[ -f "${infile}" ]]; then rm "${infile}" fi + + if [[ -n $server_pid ]]; then + kill $server_pid 2> /dev/null + fi } server_listen() {
@@ -77,6 +81,7 @@ client_connect() { verify_data() { wait "${server_pid}" + server_pid= # sha1sum returns two fields [sha1] [filepath] # convert to bash array and access first elem insum=($(sha1sum ${infile}))
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 325/434 selftests, bpf: Workaround an alu32 sub-register spilling issue
In reply to Greg Kroah-HartmanFrom: Yonghong Song <[email protected]>
[ Upstream commit 2ea2612b987ad703235c92be21d4e98ee9c2c67c ]
Currently, with latest llvm trunk, selftest test_progs failed obj file test_seg6_loop.o with the following error in verifier:
infinite loop detected at insn 76
The byte code sequence looks like below, and noted that alu32 has been turned off by default for better generated codes in general:
48: w3 = 100
49: *(u32 *)(r10 - 68) = r3
...
; if (tlv.type == SR6_TLV_PADDING) {
76: if w3 == 5 goto -18 <LBB0_19>
...
85: r1 = *(u32 *)(r10 - 68)
; for (int i = 0; i < 100; i++) {
86: w1 += -1
87: if w1 == 0 goto +5 <LBB0_20>
88: *(u32 *)(r10 - 68) = r1The main reason for verification failure is due to partial spills at r10 - 68 for induction variable "i".
Current verifier only handles spills with 8-byte values. The above 4-byte value spill to stack is treated to STACK_MISC and its content is not saved. For the above example:
w3 = 100
R3_w=inv100 fp-64_w=inv1086626730498
*(u32 *)(r10 - 68) = r3
R3_w=inv100 fp-64_w=inv1086626730498
...
r1 = *(u32 *)(r10 - 68)
R1_w=inv(id=0,umax_value=4294967295,var_off=(0x0; 0xffffffff))
fp-64=inv1086626730498To resolve this issue, verifier needs to be extended to track sub-registers in spilling, or llvm needs to enhanced to prevent sub-register spilling in register allocation phase. The former will increase verifier complexity and the latter will need some llvm "hacking".
Let us workaround this issue by declaring the induction variable as "long" type so spilling will happen at non sub-register level. We can revisit this later if sub-register spilling causes similar or other verification issues.
--- tools/testing/selftests/bpf/progs/test_seg6_loop.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/testing/selftests/bpf/progs/test_seg6_loop.c +3 -1
@@ -132,8 +132,10 @@ static __always_inline int is_valid_tlv_boundary(struct __sk_buff *skb, *pad_off =0 ;// we can only go as far as ~10 TLVs due to the BPF max stack size +// workaround: define induction variable "i" as "long" instead +// of "int" to prevent alu32 sub-register spilling. #pragma clang loop unroll(disable) -for (int i =0 ; i <100 ; i++) { +for (long i =0 ; i <100 ; i++) {struct sr6_tlv_t tlv;if (cur_off == *tlv_off)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 326/434 bnxt_en: Return proper error code for non-existent NVM variable
In reply to Greg Kroah-HartmanFrom: Vasundhara Volam <[email protected]>
[ Upstream commit 05069dd4c577f9b143dfd243d55834333c4470c5 ]
For NVM params that are not supported in the current NVM configuration, return the error as -EOPNOTSUPP.
--- drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c +8 -1
@@ -311,10 +311,17 @@ static int bnxt_hwrm_nvm_req(struct bnxt *bp, u32 param_id, void *msg, }else { rc =hwrm_send_message_silent (bp, msg, msg_len,HWRM_CMD_TIMEOUT ); -if (!rc) +if (!rc) {bnxt_copy_from_nvm_data (val, data, nvm_param.nvm_num_bits, nvm_param.dl_num_bytes); + }else { +struct hwrm_err_output *resp = bp->hwrm_cmd_resp_addr; + +if (resp->cmd_err == +NVM_GET_VARIABLE_CMD_ERR_CODE_VAR_NOT_EXIST ) + rc = -EOPNOTSUPP ; + } }dma_free_coherent (&bp->pdev->dev,sizeof (*data), data, data_dma_addr);if (rc == -EACCES )
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 327/434 net: phy: avoid matching all-ones clause 45 PHY IDs
In reply to Greg Kroah-HartmanFrom: Russell King <[email protected]>
[ Upstream commit b95e86d846b63b02ecdc94802ddbeaf9005fb6d9 ]
We currently match clause 45 PHYs using any ID read from a MMD marked as present in the "Devices in package" registers 5 and 6. However, this is incorrect. 45.2 says:
"The definition of the term package is vendor specific and could be
a chip, module, or other similar entity."
so a package could be more or less than the whole PHY - a PHY could be made up of several modules instantiated onto a single chip such as the Marvell 88x3310, or some of the MMDs could be disabled according to chip configuration, such as the Broadcom 84881.
In the case of Broadcom 84881, the "Devices in package" registers contain 0xc000009b, meaning that there is a PHYXS present in the package, but all registers in MMD 4 return 0xffff. This leads to our matching code incorrectly binding this PHY to one of our generic PHY drivers.
This patch changes the way we determine whether to attempt to match a MMD identifier, or use it to request a module - if the identifier is all-ones, then we skip over it. When reading the identifiers, we initialise phydev->c45_ids.device_ids to all-ones, only reading the device ID if the "Devices in package" registers indicates we should.
This avoids the generic drivers incorrectly matching on a PHY ID of 0xffffffff.
--- drivers/net/phy/phy_device.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/phy/phy_device.c +6 -3
@@ -488,7 +488,7 @@ static int phy_bus_match(struct device *dev, struct device_driver *drv)if (phydev->is_c45) {for (i =1 ; i < num_ids; i++) { -if (!(phydev->c45_ids.devices_in_package & (1 << i))) +if (phydev->c45_ids.device_ids[i] ==0xffffffff )continue ; if ((phydrv->phy_id & phydrv->phy_id_mask) ==
@@ -632,7 +632,7 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,int i;for (i =1 ; i < num_ids; i++) { -if (!(c45_ids->devices_in_package & (1 << i))) +if (c45_ids->device_ids[i] ==0xffffffff )continue ; ret = phy_request_driver_module(dev,
@@ -812,10 +812,13 @@ static int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id,*/ struct phy_device *get_phy_device (struct mii_bus *bus,int addr,bool is_c45) { -struct phy_c45_device_ids c45_ids = {0 }; +struct phy_c45_device_ids c45_ids;u32 phy_id =0 ;int r; + c45_ids.devices_in_package =0 ; +memset (c45_ids.device_ids,0xff ,sizeof (c45_ids.device_ids)); + r =get_phy_id (bus, addr, &phy_id, is_c45, &c45_ids);if (r)return ERR_PTR (r);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 328/434 firmware_loader: Fix labels with comma for builtin firmware
In reply to Greg Kroah-HartmanFrom: Linus Walleij <[email protected]>
[ Upstream commit 553671b7685972ca671da5f71cf6414b54376e13 ]
Some firmware images contain a comma, such as:EXTRA_FIRMWARE "brcm/brcmfmac4334-sdio.samsung,gt-s7710.txt" as Broadcom firmware simply tags the device tree compatible string at the end of the firmware parameter file. And the compatible string contains a comma.
This doesn't play well with gas:
drivers/base/firmware_loader/builtin/brcm/brcmfmac4334-sdio.samsung,gt-s7710.txt.gen.S: Assembler messages:drivers/base/firmware_loader/builtin/brcm/brcmfmac4334-sdio.samsung,gt-s7710.txt.gen.S:4: Error: bad instruction _fw_brcm_brcmfmac4334_sdio_samsung,gt_s7710_txt_bin:' drivers/base/firmware_loader/builtin/brcm/brcmfmac4334-sdio.samsung,gt-s7710.txt.gen.S:9: Error: bad instruction _fw_brcm_brcmfmac4334_sdio_samsung,gt_s7710_txt_name:' drivers/base/firmware_loader/builtin/brcm/brcmfmac4334-sdio.samsung,gt-s7710.txt.gen.S:15: Error: can't resolve .rodata' {.rodata section} - _fw_brcm_brcmfmac4334_sdio_samsung' {*UND* section} make[6]: *** [../scripts/Makefile.build:357: drivers/base/firmware_loader/builtin/brcm/brcmfmac4334-sdio.samsung,gt-s7710.txt.gen.o] Error 1
We need to get rid of the comma from the labels used by the assembly stub generator.
Replacing a comma using GNU Make subst requires a helper variable.
--- drivers/base/firmware_loader/builtin/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/base/firmware_loader/builtin/Makefile +2 -1
@@ -8,7 +8,8 @@ fwdir := $(addprefix $(srctree)/,$(filter-out /%,$(fwdir)))$(filter /%,$(fwdir)) obj-y := $(addsuffix .gen.o, $(subst $(quote),,$(CONFIG_EXTRA_FIRMWARE))) FWNAME = $(patsubst $(obj)/%.gen.S,%,$@) -FWSTR = $(subst /,_,$(subst .,_,$(subst -,_,$(FWNAME)))) +comma := , +FWSTR = $(subst $(comma),_,$(subst /,_,$(subst .,_,$(subst -,_,$(FWNAME))))) ASM_WORD = $(if $(CONFIG_64BIT),.quad,.long) ASM_ALIGN = $(if $(CONFIG_64BIT),3,2) PROGBITS = $(if $(CONFIG_ARM),%,@)progbits
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 329/434 ASoC: Intel: bytcr_rt5640: Update quirk for Acer Switch 10 SW5-012 2-in-1
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 0bb887709eb16bdc4b5baddd8337abf3de72917f ]
When the Acer Switch 10 SW5-012 quirk was added we did not have jack-detection support yet; and the builtin microphone selection of the original quirk is wrong too.
Fix the microphone-input quirk and add jack-detection info so that the internal-microphone and headphone/set jack on the Switch 10 work properly.
--- sound/soc/intel/boards/bytcr_rt5640.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
sound/soc/intel/boards/bytcr_rt5640.c +6 -4
@@ -405,10 +405,12 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {DMI_MATCH (DMI_SYS_VENDOR ,"Acer" ), DMI_MATCH(DMI_PRODUCT_NAME, "Aspire SW5-012"), }, - .driver_data = (void *)(BYT_RT5640_IN1_MAP | -BYT_RT5640_MCLK_EN | -BYT_RT5640_SSP0_AIF1 ), - + .driver_data = (void *)(BYT_RT5640_DMIC1_MAP | +BYT_RT5640_JD_SRC_JD2_IN4N | +BYT_RT5640_OVCD_TH_2000UA | +BYT_RT5640_OVCD_SF_0P75 | +BYT_RT5640_SSP0_AIF1 | + BYT_RT5640_MCLK_EN), }, { .matches = {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 330/434 x86/insn: Add some Intel instructions to the opcode map
In reply to Greg Kroah-HartmanFrom: Adrian Hunter <[email protected]>
[ Upstream commit b980be189c9badba50634671e2303e92bf28e35a ]
Add to the opcode map the following instructions:
cldemote
tpause
umonitor
umwait
movdiri
movdir64b
enqcmd
enqcmds
encls
enclu
enclv
pconfig
wbnoinvd
For information about the instructions, refer Intel SDM May 2019 (325462-070US) and Intel Architecture Instruction Set Extensions May 2019 (319433-037).
The instruction decoding can be tested using the perf tools' "x86 instruction decoder - new instructions" test as folllows:
$ perf test -v "new " 2>&1 | grep -i cldemote Decoded ok: 0f 1c 00 cldemote (%eax) Decoded ok: 0f 1c 05 78 56 34 12 cldemote 0x12345678 Decoded ok: 0f 1c 84 c8 78 56 34 12 cldemote 0x12345678(%eax,%ecx,8) Decoded ok: 0f 1c 00 cldemote (%rax) Decoded ok: 41 0f 1c 00 cldemote (%r8) Decoded ok: 0f 1c 04 25 78 56 34 12 cldemote 0x12345678 Decoded ok: 0f 1c 84 c8 78 56 34 12 cldemote 0x12345678(%rax,%rcx,8) Decoded ok: 41 0f 1c 84 c8 78 56 34 12 cldemote 0x12345678(%r8,%rcx,8) $ perf test -v "new " 2>&1 | grep -i tpause Decoded ok: 66 0f ae f3 tpause %ebx Decoded ok: 66 0f ae f3 tpause %ebx Decoded ok: 66 41 0f ae f0 tpause %r8d $ perf test -v "new " 2>&1 | grep -i umonitor Decoded ok: 67 f3 0f ae f0 umonitor %ax Decoded ok: f3 0f ae f0 umonitor %eax Decoded ok: 67 f3 0f ae f0 umonitor %eax Decoded ok: f3 0f ae f0 umonitor %rax Decoded ok: 67 f3 41 0f ae f0 umonitor %r8d $ perf test -v "new " 2>&1 | grep -i umwait Decoded ok: f2 0f ae f0 umwait %eax Decoded ok: f2 0f ae f0 umwait %eax Decoded ok: f2 41 0f ae f0 umwait %r8d $ perf test -v "new " 2>&1 | grep -i movdiri Decoded ok: 0f 38 f9 03 movdiri %eax,(%ebx) Decoded ok: 0f 38 f9 88 78 56 34 12 movdiri %ecx,0x12345678(%eax) Decoded ok: 48 0f 38 f9 03 movdiri %rax,(%rbx) Decoded ok: 48 0f 38 f9 88 78 56 34 12 movdiri %rcx,0x12345678(%rax) $ perf test -v "new " 2>&1 | grep -i movdir64b Decoded ok: 66 0f 38 f8 18 movdir64b (%eax),%ebx Decoded ok: 66 0f 38 f8 88 78 56 34 12 movdir64b 0x12345678(%eax),%ecx Decoded ok: 67 66 0f 38 f8 1c movdir64b (%si),%bx Decoded ok: 67 66 0f 38 f8 8c 34 12 movdir64b 0x1234(%si),%cx Decoded ok: 66 0f 38 f8 18 movdir64b (%rax),%rbx Decoded ok: 66 0f 38 f8 88 78 56 34 12 movdir64b 0x12345678(%rax),%rcx Decoded ok: 67 66 0f 38 f8 18 movdir64b (%eax),%ebx Decoded ok: 67 66 0f 38 f8 88 78 56 34 12 movdir64b 0x12345678(%eax),%ecx $ perf test -v "new " 2>&1 | grep -i enqcmd Decoded ok: f2 0f 38 f8 18 enqcmd (%eax),%ebx Decoded ok: f2 0f 38 f8 88 78 56 34 12 enqcmd 0x12345678(%eax),%ecx Decoded ok: 67 f2 0f 38 f8 1c enqcmd (%si),%bx Decoded ok: 67 f2 0f 38 f8 8c 34 12 enqcmd 0x1234(%si),%cx Decoded ok: f3 0f 38 f8 18 enqcmds (%eax),%ebx Decoded ok: f3 0f 38 f8 88 78 56 34 12 enqcmds 0x12345678(%eax),%ecx Decoded ok: 67 f3 0f 38 f8 1c enqcmds (%si),%bx Decoded ok: 67 f3 0f 38 f8 8c 34 12 enqcmds 0x1234(%si),%cx Decoded ok: f2 0f 38 f8 18 enqcmd (%rax),%rbx Decoded ok: f2 0f 38 f8 88 78 56 34 12 enqcmd 0x12345678(%rax),%rcx Decoded ok: 67 f2 0f 38 f8 18 enqcmd (%eax),%ebx Decoded ok: 67 f2 0f 38 f8 88 78 56 34 12 enqcmd 0x12345678(%eax),%ecx Decoded ok: f3 0f 38 f8 18 enqcmds (%rax),%rbx Decoded ok: f3 0f 38 f8 88 78 56 34 12 enqcmds 0x12345678(%rax),%rcx Decoded ok: 67 f3 0f 38 f8 18 enqcmds (%eax),%ebx Decoded ok: 67 f3 0f 38 f8 88 78 56 34 12 enqcmds 0x12345678(%eax),%ecx $ perf test -v "new " 2>&1 | grep -i enqcmds Decoded ok: f3 0f 38 f8 18 enqcmds (%eax),%ebx Decoded ok: f3 0f 38 f8 88 78 56 34 12 enqcmds 0x12345678(%eax),%ecx Decoded ok: 67 f3 0f 38 f8 1c enqcmds (%si),%bx Decoded ok: 67 f3 0f 38 f8 8c 34 12 enqcmds 0x1234(%si),%cx Decoded ok: f3 0f 38 f8 18 enqcmds (%rax),%rbx Decoded ok: f3 0f 38 f8 88 78 56 34 12 enqcmds 0x12345678(%rax),%rcx Decoded ok: 67 f3 0f 38 f8 18 enqcmds (%eax),%ebx Decoded ok: 67 f3 0f 38 f8 88 78 56 34 12 enqcmds 0x12345678(%eax),%ecx $ perf test -v "new " 2>&1 | grep -i encls Decoded ok: 0f 01 cf encls Decoded ok: 0f 01 cf encls $ perf test -v "new " 2>&1 | grep -i enclu Decoded ok: 0f 01 d7 enclu Decoded ok: 0f 01 d7 enclu $ perf test -v "new " 2>&1 | grep -i enclv Decoded ok: 0f 01 c0 enclv Decoded ok: 0f 01 c0 enclv $ perf test -v "new " 2>&1 | grep -i pconfig Decoded ok: 0f 01 c5 pconfig Decoded ok: 0f 01 c5 pconfig $ perf test -v "new " 2>&1 | grep -i wbnoinvd Decoded ok: f3 0f 09 wbnoinvd Decoded ok: f3 0f 09 wbnoinvd
--- arch/x86/lib/x86-opcode-map.txt | 18 ++++++++++++------ tools/arch/x86/lib/x86-opcode-map.txt | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-)
arch/x86/lib/x86-opcode-map.txt +12 -6
@@ -333,7 +333,7 @@ AVXcode: 1 06: CLTS 07: SYSRET (o64) 08: INVD -09: WBINVD +09: WBINVD | WBNOINVD (F3) 0a: 0b: UD2 (1B) 0c:
@@ -364,7 +364,7 @@ AVXcode: 1 # a ModR/M byte. 1a: BNDCL Gv,Ev (F3) | BNDCU Gv,Ev (F2) | BNDMOV Gv,Ev (66) | BNDLDX Gv,Ev 1b: BNDCN Gv,Ev (F2) | BNDMOV Ev,Gv (66) | BNDMK Gv,Ev (F3) | BNDSTX Ev,Gv -1c: +1c: Grp20 (1A),(1C) 1d: 1e: 1f: NOP Ev
@@ -792,6 +792,8 @@ f3: Grp17 (1A) f5: BZHI Gy,Ey,By (v) | PEXT Gy,By,Ey (F3),(v) | PDEP Gy,By,Ey (F2),(v) f6: ADCX Gy,Ey (66) | ADOX Gy,Ey (F3) | MULX By,Gy,rDX,Ey (F2),(v) f7: BEXTR Gy,Ey,By (v) | SHLX Gy,Ey,By (66),(v) | SARX Gy,Ey,By (F3),(v) | SHRX Gy,Ey,By (F2),(v) +f8: MOVDIR64B Gv,Mdqq (66) | ENQCMD Gv,Mdqq (F2) | ENQCMDS Gv,Mdqq (F3) +f9: MOVDIRI My,Gy EndTable Table: 3-byte opcode 2 (0x0f 0x3a)
@@ -943,9 +945,9 @@ GrpTable: Grp6 EndTable GrpTable: Grp7 -0: SGDT Ms | VMCALL (001),(11B) | VMLAUNCH (010),(11B) | VMRESUME (011),(11B) | VMXOFF (100),(11B) -1: SIDT Ms | MONITOR (000),(11B) | MWAIT (001),(11B) | CLAC (010),(11B) | STAC (011),(11B) -2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) +0: SGDT Ms | VMCALL (001),(11B) | VMLAUNCH (010),(11B) | VMRESUME (011),(11B) | VMXOFF (100),(11B) | PCONFIG (101),(11B) | ENCLV (000),(11B) +1: SIDT Ms | MONITOR (000),(11B) | MWAIT (001),(11B) | CLAC (010),(11B) | STAC (011),(11B) | ENCLS (111),(11B) +2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) | ENCLU (111),(11B) 3: LIDT Ms 4: SMSW Mw/Rv 5: rdpkru (110),(11B) | wrpkru (111),(11B)
@@ -1020,7 +1022,7 @@ GrpTable: Grp15 3: vstmxcsr Md (v1) | WRGSBASE Ry (F3),(11B) 4: XSAVE | ptwrite Ey (F3),(11B) 5: XRSTOR | lfence (11B) -6: XSAVEOPT | clwb (66) | mfence (11B) +6: XSAVEOPT | clwb (66) | mfence (11B) | TPAUSE Rd (66),(11B) | UMONITOR Rv (F3),(11B) | UMWAIT Rd (F2),(11B) 7: clflush | clflushopt (66) | sfence (11B) EndTable
@@ -1051,6 +1053,10 @@ GrpTable: Grp19 6: vscatterpf1qps/d Wx (66),(ev) EndTable +GrpTable: Grp20 +0: cldemote Mb +EndTable + # AMD's Prefetch Group GrpTable: GrpP 0: PREFETCH
tools/arch/x86/lib/x86-opcode-map.txt +12 -6
@@ -333,7 +333,7 @@ AVXcode: 1 06: CLTS 07: SYSRET (o64) 08: INVD -09: WBINVD +09: WBINVD | WBNOINVD (F3) 0a: 0b: UD2 (1B) 0c:
@@ -364,7 +364,7 @@ AVXcode: 1 # a ModR/M byte. 1a: BNDCL Gv,Ev (F3) | BNDCU Gv,Ev (F2) | BNDMOV Gv,Ev (66) | BNDLDX Gv,Ev 1b: BNDCN Gv,Ev (F2) | BNDMOV Ev,Gv (66) | BNDMK Gv,Ev (F3) | BNDSTX Ev,Gv -1c: +1c: Grp20 (1A),(1C) 1d: 1e: 1f: NOP Ev
@@ -792,6 +792,8 @@ f3: Grp17 (1A) f5: BZHI Gy,Ey,By (v) | PEXT Gy,By,Ey (F3),(v) | PDEP Gy,By,Ey (F2),(v) f6: ADCX Gy,Ey (66) | ADOX Gy,Ey (F3) | MULX By,Gy,rDX,Ey (F2),(v) f7: BEXTR Gy,Ey,By (v) | SHLX Gy,Ey,By (66),(v) | SARX Gy,Ey,By (F3),(v) | SHRX Gy,Ey,By (F2),(v) +f8: MOVDIR64B Gv,Mdqq (66) | ENQCMD Gv,Mdqq (F2) | ENQCMDS Gv,Mdqq (F3) +f9: MOVDIRI My,Gy EndTable Table: 3-byte opcode 2 (0x0f 0x3a)
@@ -943,9 +945,9 @@ GrpTable: Grp6 EndTable GrpTable: Grp7 -0: SGDT Ms | VMCALL (001),(11B) | VMLAUNCH (010),(11B) | VMRESUME (011),(11B) | VMXOFF (100),(11B) -1: SIDT Ms | MONITOR (000),(11B) | MWAIT (001),(11B) | CLAC (010),(11B) | STAC (011),(11B) -2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) +0: SGDT Ms | VMCALL (001),(11B) | VMLAUNCH (010),(11B) | VMRESUME (011),(11B) | VMXOFF (100),(11B) | PCONFIG (101),(11B) | ENCLV (000),(11B) +1: SIDT Ms | MONITOR (000),(11B) | MWAIT (001),(11B) | CLAC (010),(11B) | STAC (011),(11B) | ENCLS (111),(11B) +2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) | ENCLU (111),(11B) 3: LIDT Ms 4: SMSW Mw/Rv 5: rdpkru (110),(11B) | wrpkru (111),(11B)
@@ -1020,7 +1022,7 @@ GrpTable: Grp15 3: vstmxcsr Md (v1) | WRGSBASE Ry (F3),(11B) 4: XSAVE | ptwrite Ey (F3),(11B) 5: XRSTOR | lfence (11B) -6: XSAVEOPT | clwb (66) | mfence (11B) +6: XSAVEOPT | clwb (66) | mfence (11B) | TPAUSE Rd (66),(11B) | UMONITOR Rv (F3),(11B) | UMWAIT Rd (F2),(11B) 7: clflush | clflushopt (66) | sfence (11B) EndTable
@@ -1051,6 +1053,10 @@ GrpTable: Grp19 6: vscatterpf1qps/d Wx (66),(ev) EndTable +GrpTable: Grp20 +0: cldemote Mb +EndTable + # AMD's Prefetch Group GrpTable: GrpP 0: PREFETCH
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 331/434 net-af_xdp: Use correct number of channels from ethtool
In reply to Greg Kroah-HartmanFrom: Luigi Rizzo <[email protected]>
[ Upstream commit 3de88c9113f88c04abda339f1aa629397bf89e02 ]
Drivers use different fields to report the number of channels, so take the maximum of all data channels (rx, tx, combined) when determining the size of the xsk map. The current code used only 'combined' which was set to 0 in some drivers e.g. mlx4.
Tested: compiled and run xdpsock -q 3 -r -S on mlx4
--- tools/lib/bpf/xsk.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
tools/lib/bpf/xsk.c +8 -3
@@ -344,13 +344,18 @@ static int xsk_get_max_queues(struct xsk_socket *xsk) goto out; } -if (err || channels.max_combined ==0 ) +if (err) {/* If the device says it has no channels, then all traffic * is sent to a single stream, so max queues = 1. */ ret =1 ; -else - ret = channels.max_combined; + }else { +/* Take the max of rx, tx, combined. Drivers return +* the number of channels in different ways. +*/ + ret =max (channels.max_rx, channels.max_tx); + ret =max (ret, (int )channels.max_combined); + } out:close (fd);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 332/434 brcmfmac: remove monitor interface when detaching
In reply to Greg Kroah-HartmanFrom: Rafał Miłecki <[email protected]>
[ Upstream commit 4f61563da075bc8faefddfd5f8fc0cc14c49650a ]
This fixes a minor WARNING in the cfg80211:
[ 130.658034] ------------[ cut here ]------------ [ 130.662805] WARNING: CPU: 1 PID: 610 at net/wireless/core.c:954 wiphy_unregister+0xb4/0x198 [cfg80211]
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +5 -0
@@ -1350,6 +1350,11 @@ void brcmf_detach(struct device *dev)brcmf_fweh_detach (drvr);brcmf_proto_detach (drvr); +if (drvr->mon_if) { +brcmf_net_detach (drvr->mon_if->ndev, false); + drvr->mon_if =NULL ; + } +/* make sure primary interface removed last */ for (i =BRCMF_MAX_IFS -1 ; i >-1 ; i--) {if (drvr->iflist[i])
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 333/434 perf session: Fix decompression of PERF_RECORD_COMPRESSED records
In reply to Greg Kroah-HartmanFrom: Alexey Budankov <[email protected]>
[ Upstream commit bb1835a3b86c73aa534ef6430ad40223728dfbc0 ]
Avoid termination of trace loading in case the last record in the decompressed buffer partly resides in the following mmaped PERF_RECORD_COMPRESSED record.
In this case NULL value returned by fetch_mmaped_event() means to proceed to the next mmaped record then decompress it and load compressed events.
The issue can be reproduced like this:
$ perf record -z -- some_long_running_workload $ perf report --stdio -vv decomp (B): 44519 to 163000 decomp (B): 48119 to 174800 decomp (B): 65527 to 131072 fetch_mmaped_event: head=0x1ffe0 event->header_size=0x28, mmap_size=0x20000: fuzzed perf.data? Error: failed to process sample ...
Testing:
71: Zstd perf.data compression/decompression : Ok
$ tools/perf/perf report -vv --stdio decomp (B): 59593 to 262160 decomp (B): 4438 to 16512 decomp (B): 285 to 880 Looking at the vmlinux_path (8 entries long) Using vmlinux for symbols decomp (B): 57474 to 261248 prefetch_event: head=0x3fc78 event->header_size=0x28, mmap_size=0x3fc80: fuzzed or compressed perf.data? decomp (B): 25 to 32 decomp (B): 52 to 120 ...
--- tools/perf/util/session.c | 44 ++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 17 deletions(-)
tools/perf/util/session.c +27 -17
@@ -1954,8 +1954,8 @@ out_err: }static union perf_event * -fetch_mmaped_event (struct perf_session *session, -u64 head,size_t mmap_size,char *buf) +prefetch_event (char *buf,u64 head,size_t mmap_size, +bool needs_swap,union perf_event *error) {union perf_event *event;
@@ -1967,20 +1967,32 @@ fetch_mmaped_event(struct perf_session *session,return NULL ; event = (union perf_event *)(buf + head); +if (needs_swap) +perf_event_header__bswap (&event->header); -if (session->header.needs_swap) +if (head + event->header.size <= mmap_size) +return event; + +/* We're not fetching the event so swap back again */ +if (needs_swap)perf_event_header__bswap (&event->header); -if (head + event->header.size > mmap_size) { -/* We're not fetching the event so swap back again */ -if (session->header.needs_swap) -perf_event_header__bswap (&event->header); -pr_debug ("%s: head=%#" PRIx64" event->header_size=%#x, mmap_size=%#zx: fuzzed perf.data?\n" , - __func__, head, event->header.size, mmap_size); -return ERR_PTR (-EINVAL ); - } +pr_debug ("%s: head=%#" PRIx64" event->header_size=%#x, mmap_size=%#zx:" +" fuzzed or compressed perf.data?\n" ,__func__, head, event->header.size, mmap_size); -return event; +return error; +} + +static union perf_event * +fetch_mmaped_event (u64 head,size_t mmap_size,char *buf,bool needs_swap) +{ +return prefetch_event (buf, head, mmap_size, needs_swap,ERR_PTR (-EINVAL )); +} + +static union perf_event * +fetch_decomp_event (u64 head,size_t mmap_size,char *buf,bool needs_swap) +{ +return prefetch_event (buf, head, mmap_size, needs_swap,NULL ); }static int __perf_session__process_decomp_events (struct perf_session *session)
@@ -1993,10 +2005,8 @@ static int __perf_session__process_decomp_events(struct perf_session *session)return 0 ;while (decomp->head < decomp->size && !session_done ()) { -union perf_event *event =fetch_mmaped_event (session, decomp->head, decomp->size, decomp->data); - -if (IS_ERR (event)) -return PTR_ERR (event); +union perf_event *event =fetch_decomp_event (decomp->head, decomp->size, decomp->data, + session->header.needs_swap);if (!event)break ;
@@ -2096,7 +2106,7 @@ remap: } more: - event =fetch_mmaped_event (session, head, mmap_size, buf); + event =fetch_mmaped_event (head, mmap_size, buf, session->header.needs_swap);if (IS_ERR (event))return PTR_ERR (event);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 334/434 s390/crypto: Fix unsigned variable compared with zero
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 0398d4ab1677f7d8cd43aac2aa29a93dfcf9e2e3 ]
s390_crypto_shash_parmsize() return type is int, it should not be stored in a unsigned variable, which compared with zero.
--- arch/s390/crypto/sha_common.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
arch/s390/crypto/sha_common.c +5 -2
@@ -74,14 +74,17 @@ int s390_sha_final(struct shash_desc *desc, u8 *out)struct s390_sha_ctx *ctx =shash_desc_ctx (desc);unsigned int bsize =crypto_shash_blocksize (desc->tfm);u64 bits; -unsigned int n, mbl_offset; +unsigned int n; +int mbl_offset; n = ctx->count % bsize; bits = ctx->count *8 ; - mbl_offset =s390_crypto_shash_parmsize (ctx->func) /sizeof (u32); + mbl_offset =s390_crypto_shash_parmsize (ctx->func);if (mbl_offset <0 )return -EINVAL ; + mbl_offset = mbl_offset /sizeof (u32); +/* set total msg bit length (mbl) in CPACF parmblock */ switch (ctx->func) {case CPACF_KLMD_SHA_1 :
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 335/434 s390/kasan: support memcpy_real with TRACE_IRQFLAGS
In reply to Greg Kroah-HartmanFrom: Vasily Gorbik <[email protected]>
[ Upstream commit 13f9bae579c6bd051e58f326913dd09af1291208 ]
Currently if the kernel is built with CONFIG_TRACE_IRQFLAGS and KASAN and used as crash kernel it crashes itself due to trace_hardirqs_off/trace_hardirqs_on being called with DAT off. This happens because trace_hardirqs_off/trace_hardirqs_on are instrumented and kasan code tries to perform access to shadow memory to validate memory accesses. Kasan shadow memory is populated with vmemmap, so all accesses require DAT on.
memcpy_real could be called with DAT on or off (with kasan enabled DAT is set even before early code is executed).
Make sure that trace_hardirqs_off/trace_hardirqs_on are called with DAT on and only actual __memcpy_real is called with DAT off.
Also annotate __memcpy_real and _memcpy_real with __no_sanitize_address to avoid further problems due to switching DAT off.
--- arch/s390/mm/maccess.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
arch/s390/mm/maccess.c +8 -4
@@ -70,7 +70,7 @@ void notrace s390_kernel_write(void *dst, const void *src, size_t size)spin_unlock_irqrestore (&s390_kernel_write_lock, flags); } -static int __memcpy_real (void *dest,void *src,size_t count) +static int __no_sanitize_address __memcpy_real(void *dest, void *src, size_t count) { register unsigned long _dest asm("2") = (unsigned long) dest; register unsigned long _len1 asm("3") = (unsigned long) count;
@@ -91,19 +91,23 @@ static int __memcpy_real(void *dest, void *src, size_t count)return rc; } -static unsigned long _memcpy_real (unsigned long dest,unsigned long src, -unsigned long count) +static unsigned long __no_sanitize_address _memcpy_real (unsigned long dest, +unsigned long src, +unsigned long count) {int irqs_disabled, rc;unsigned long flags;if (!count)return 0 ; - flags =__arch_local_irq_stnsm (0xf8UL ); + flags =arch_local_irq_save (); irqs_disabled =arch_irqs_disabled_flags (flags);if (!irqs_disabled)trace_hardirqs_off (); +__arch_local_irq_stnsm (0xf8 );// disable DAT rc =__memcpy_real ((void *) dest, (void *) src, (size_t ) count); +if (flags &PSW_MASK_DAT ) +__arch_local_irq_stosm (0x04 );// enable DAT if (!irqs_disabled)trace_hardirqs_on ();__arch_local_irq_ssm (flags);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 336/434 bnxt_en: Improve RX buffer error handling.
In reply to Greg Kroah-HartmanFrom: Michael Chan <[email protected]>
[ Upstream commit 19b3751ffa713d04290effb26fe01009010f2206 ]
When hardware reports RX buffer errors, the latest 57500 chips do not require reset. The packet is discarded by the hardware and the ring will continue to operate.
Also, add an rx_buf_errors counter for this type of error. It can help the user to identify if the aggregation ring is too small.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 8 ++++++-- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 + drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +6 -2
@@ -1767,8 +1767,12 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, rc = -EIO ;if (rx_err &RX_CMPL_ERRORS_BUFFER_ERROR_MASK ) { -netdev_warn (bp->dev,"RX buffer error %x\n" , rx_err); -bnxt_sched_reset (bp, rxr); + bnapi->cp_ring.rx_buf_errors++; +if (!(bp->flags &BNXT_FLAG_CHIP_P5 )) { +netdev_warn (bp->dev,"RX buffer error %x\n" , + rx_err); +bnxt_sched_reset (bp, rxr); + } } goto next_rx_no_len; }
drivers/net/ethernet/broadcom/bnxt/bnxt.h +1 -0
@@ -927,6 +927,7 @@ struct bnxt_cp_ring_info {dma_addr_t hw_stats_map;u32 hw_stats_ctx_id;u64 rx_l4_csum_errors; +u64 rx_buf_errors;u64 missed_irqs;struct bnxt_ring_struct cp_ring_struct;
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +2 -0
@@ -173,6 +173,7 @@ static const char * const bnxt_ring_tpa2_stats_str[] = {static const char *const bnxt_ring_sw_stats_str[] = {"rx_l4_csum_errors" , +"rx_buf_errors" ,"missed_irqs" , };
@@ -552,6 +553,7 @@ static void bnxt_get_ethtool_stats(struct net_device *dev,for (k =0 ; k < stat_fields; j++, k++) buf[j] =le64_to_cpu (hw_stats[k]); buf[j++] = cpr->rx_l4_csum_errors; + buf[j++] = cpr->rx_buf_errors; buf[j++] = cpr->missed_irqs; bnxt_sw_func_stats[RX_TOTAL_DISCARDS].counter +=
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 337/434 iwlwifi: check kasprintf() return value
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 5974fbb5e10b018fdbe3c3b81cb4cc54e1105ab9 ]
kasprintf() can fail, we should check the return value.
--- drivers/net/wireless/intel/iwlwifi/dvm/led.c | 3 +++ drivers/net/wireless/intel/iwlwifi/mvm/led.c | 3 +++ 2 files changed, 6 insertions(+)
drivers/net/wireless/intel/iwlwifi/dvm/led.c +3 -0
@@ -171,6 +171,9 @@ void iwl_leds_init(struct iwl_priv *priv) priv->led.name =kasprintf (GFP_KERNEL ,"%s-led" ,wiphy_name (priv->hw->wiphy)); +if (!priv->led.name) +return ; + priv->led.brightness_set = iwl_led_brightness_set; priv->led.blink_set = iwl_led_blink_set; priv->led.max_brightness =1 ;
drivers/net/wireless/intel/iwlwifi/mvm/led.c +3 -0
@@ -129,6 +129,9 @@ int iwl_mvm_leds_init(struct iwl_mvm *mvm) mvm->led.name =kasprintf (GFP_KERNEL ,"%s-led" ,wiphy_name (mvm->hw->wiphy)); +if (!mvm->led.name) +return -ENOMEM ; + mvm->led.brightness_set = iwl_led_brightness_set; mvm->led.max_brightness =1 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 338/434 fbtft: Make sure string is NULL terminated
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 21f585480deb4bcf0d92b08879c35d066dfee030 ]
New GCC warns about inappropriate use of strncpy():
drivers/staging/fbtft/fbtft-core.c: In function ‘fbtft_framebuffer_alloc’:drivers/staging/fbtft/fbtft-core.c:665:2: warning: ‘strncpy’ specified bound 16 equals destination size [-Wstringop-truncation]
665 | strncpy(info->fix.id, dev->driver->name, 16);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Later on the copy is being used with the assumption to be NULL terminated. Make sure string is NULL terminated by switching to snprintf().
--- drivers/staging/fbtft/fbtft-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/fbtft/fbtft-core.c +1 -1
@@ -666,7 +666,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, fbdefio->deferred_io = fbtft_deferred_io;fb_deferred_io_init (info); -strncpy (info->fix.id, dev->driver->name,16 ); +snprintf (info->fix.id,sizeof (info->fix.id),"%s" , dev->driver->name); info->fix.type =FB_TYPE_PACKED_PIXELS ; info->fix.visual =FB_VISUAL_TRUECOLOR ; info->fix.xpanstep =0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 339/434 ASoC: soc-pcm: check symmetry before hw_params
In reply to Greg Kroah-HartmanFrom: Shengjiu Wang <[email protected]>
[ Upstream commit 5cca59516de5df9de6bdecb328dd55fb5bcccb41 ]
This reverts commit 957ce0c6b8a1f (ASoC: soc-pcm: check symmetry after hw_params).
That commit cause soc_pcm_params_symmetry can't take effect. cpu_dai->rate, cpu_dai->channels and cpu_dai->sample_bits are updated in the middle of soc_pcm_hw_params, so move soc_pcm_params_symmetry to the end of soc_pcm_hw_params is not a good solution, for judgement of symmetry in the function is always true.
FIXME:
According to the comments of that commit, I think the case described in the commit should disable symmetric_rates in Back-End, rather than changing the position of soc_pcm_params_symmetry.
--- sound/soc/soc-pcm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
sound/soc/soc-pcm.c +5 -3
@@ -877,6 +877,11 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,int i, ret =0 ;mutex_lock_nested (&rtd->card->pcm_mutex, rtd->card->pcm_subclass); + + ret =soc_pcm_params_symmetry (substream, params); +if (ret) + goto out; +if (rtd->dai_link->ops->hw_params) { ret = rtd->dai_link->ops->hw_params (substream, params);if (ret <0 ) {
@@ -958,9 +963,6 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, } component =NULL ; - ret =soc_pcm_params_symmetry (substream, params); -if (ret) - goto component_err; out:mutex_unlock (&rtd->card->pcm_mutex);return ret;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 340/434 net: ethernet: ti: ale: clean ale tbl on init and intf restart
In reply to Greg Kroah-HartmanFrom: Grygorii Strashko <[email protected]>
[ Upstream commit 7fe579dfb90fcdf0c7722f33c772d5f0d1bc7cb6 ]
Clean CPSW ALE on init and intf restart (up/down) to avoid reading obsolete or garbage entries from ALE table.
--- drivers/net/ethernet/ti/cpsw_ale.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/ti/cpsw_ale.c +2 -0
@@ -779,6 +779,7 @@ void cpsw_ale_start(struct cpsw_ale *ale)void cpsw_ale_stop (struct cpsw_ale *ale) {del_timer_sync (&ale->timer); +cpsw_ale_control_set (ale,0 ,ALE_CLEAR ,1 );cpsw_ale_control_set (ale,0 ,ALE_ENABLE ,0 ); }
@@ -862,6 +863,7 @@ struct cpsw_ale *cpsw_ale_create(struct cpsw_ale_params *params)ALE_UNKNOWNVLAN_FORCE_UNTAG_EGRESS ; } +cpsw_ale_control_set (ale,0 ,ALE_CLEAR ,1 );return ale; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 341/434 mt76: fix possible out-of-bound access in mt7615_fill_txs/mt7603_fill_txs
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit e8b970c8e367e85fab9b8ac4f36080e5d653c38e ]
Fix possible out-of-bound access of status rates array in mt7615_fill_txs/mt7603_fill_txs routines
--- drivers/net/wireless/mediatek/mt76/mt7603/mac.c | 4 +++- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7603/mac.c +3 -1
@@ -1032,8 +1032,10 @@ mt7603_fill_txs(struct mt7603_dev *dev, struct mt7603_sta *sta,if (idx && (cur_rate->idx != info->status.rates[i].idx || cur_rate->flags != info->status.rates[i].flags)) { i++; -if (i ==ARRAY_SIZE (info->status.rates)) +if (i ==ARRAY_SIZE (info->status.rates)) { + i--;break ; + } info->status.rates[i] = *cur_rate; info->status.rates[i].count =0 ;
drivers/net/wireless/mediatek/mt76/mt7615/mac.c +3 -1
@@ -914,8 +914,10 @@ static bool mt7615_fill_txs(struct mt7615_dev *dev, struct mt7615_sta *sta,if (idx && (cur_rate->idx != info->status.rates[i].idx || cur_rate->flags != info->status.rates[i].flags)) { i++; -if (i ==ARRAY_SIZE (info->status.rates)) +if (i ==ARRAY_SIZE (info->status.rates)) { + i--;break ; + } info->status.rates[i] = *cur_rate; info->status.rates[i].count =0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 342/434 s390/cpumf: Adjust registration of s390 PMU device drivers
In reply to Greg Kroah-HartmanFrom: Thomas Richter <[email protected]>
[ Upstream commit 6a82e23f45fe0aa821e7a935e39d0acb20c275c0 ]
Linux-next commit titled "perf/core: Optimize perf_init_event()" changed the semantics of PMU device driver registration. It was done to speed up the lookup/handling of PMU device driver specific events. It also enforces that only one PMU device driver will be registered of type PERF_EVENT_RAW.
This change added these line in function perf_pmu_register():
...
+ ret = idr_alloc(&pmu_idr, pmu, max, 0, GFP_KERNEL);
+ if (ret < 0)
goto free_pdc;
+
+ WARN_ON(type >= 0 && ret != type);
The warn_on generates a message. We have 3 PMU device drivers, each registered as type PERF_TYPE_RAW.
The cf_diag device driver (arch/s390/kernel/perf_cpumf_cf_diag.c) always hits the WARN_ON because it is the second PMU device driver (after sampling device driver arch/s390/kernel/perf_cpumf_sf.c) which is registered as type 4 (PERF_TYPE_RAW).
So when the sampling device driver is registered, ret has value 4. When cf_diag device driver is registered with type 4, ret has value of 5 and WARN_ON fires.
Adjust the PMU device drivers for s390 to support the new semantics required by perf_pmu_register().
--- arch/s390/kernel/perf_cpum_cf.c | 21 ++++++++++----------- arch/s390/kernel/perf_cpum_cf_diag.c | 10 +++++----- 2 files changed, 15 insertions(+), 16 deletions(-)
arch/s390/kernel/perf_cpum_cf.c +10 -11
@@ -199,7 +199,7 @@ static const int cpumf_generic_events_user[] = { [PERF_COUNT_HW_BUS_CYCLES] = -1, }; -static int __hw_perf_event_init (struct perf_event *event) +static int __hw_perf_event_init (struct perf_event *event,unsigned int type) {struct perf_event_attr *attr = &event->attr;struct hw_perf_event *hwc = &event->hw;
@@ -207,7 +207,7 @@ static int __hw_perf_event_init(struct perf_event *event)int err =0 ;u64 ev; -switch (attr->type) { +switch (type) {case PERF_TYPE_RAW :/* Raw events are used to access counters directly, * hence do not permit excludes */
@@ -294,17 +294,16 @@ static int __hw_perf_event_init(struct perf_event *event)static int cpumf_pmu_event_init (struct perf_event *event) { +unsigned int type = event->attr.type;int err; -switch (event->attr.type) { -case PERF_TYPE_HARDWARE : -case PERF_TYPE_HW_CACHE : -case PERF_TYPE_RAW : - err =__hw_perf_event_init (event); -break ; -default : +if (type ==PERF_TYPE_HARDWARE || type ==PERF_TYPE_RAW ) + err =__hw_perf_event_init (event, type); +else if (event->pmu->type == type) +/* Registered as unknown PMU */ + err =__hw_perf_event_init (event,PERF_TYPE_RAW ); +else return -ENOENT ; - }if (unlikely (err) && event->destroy) event->destroy (event);
@@ -553,7 +552,7 @@ static int __init cpumf_pmu_init(void)return -ENODEV ; cpumf_pmu.attr_groups =cpumf_cf_event_group (); - rc =perf_pmu_register (&cpumf_pmu,"cpum_cf" ,PERF_TYPE_RAW ); + rc =perf_pmu_register (&cpumf_pmu,"cpum_cf" ,-1 );if (rc)pr_err ("Registering the cpum_cf PMU failed with rc=%i\n" , rc);return rc;
arch/s390/kernel/perf_cpum_cf_diag.c +5 -5
@@ -243,13 +243,13 @@ static int cf_diag_event_init(struct perf_event *event)int err = -ENOENT ;debug_sprintf_event (cf_diag_dbg,5 , -"%s event %p cpu %d config %#llx " +"%s event %p cpu %d config %#llx type:%u " "sample_type %#llx cf_diag_events %d\n" , __func__, - event, event->cpu, attr->config, attr->sample_type, -atomic_read (&cf_diag_events)); + event, event->cpu, attr->config, event->pmu->type, + attr->sample_type,atomic_read (&cf_diag_events));if (event->attr.config !=PERF_EVENT_CPUM_CF_DIAG || - event->attr.type !=PERF_TYPE_RAW ) + event->attr.type != event->pmu->type) goto out;/* Raw events are used to access counters directly,
@@ -693,7 +693,7 @@ static int __init cf_diag_init(void) }debug_register_view (cf_diag_dbg, &debug_sprintf_view); - rc =perf_pmu_register (&cf_diag,"cpum_cf_diag" ,PERF_TYPE_RAW ); + rc =perf_pmu_register (&cf_diag,"cpum_cf_diag" ,-1 );if (rc) {debug_unregister_view (cf_diag_dbg, &debug_sprintf_view);debug_unregister (cf_diag_dbg);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 343/434 crypto: sun4i-ss - Fix 64-bit size_t warnings
In reply to Greg Kroah-HartmanFrom: Herbert Xu <[email protected]>
[ Upstream commit d6e9da21ee8246b5e556b3b153401ab045adb986 ]
If you try to compile this driver on a 64-bit platform then you will get warnings because it mixes size_t with unsigned int which only works on 32-bit.
This patch fixes all of the warnings.
--- drivers/crypto/sunxi-ss/sun4i-ss-cipher.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
drivers/crypto/sunxi-ss/sun4i-ss-cipher.c +14 -8
@@ -72,7 +72,8 @@ static int noinline_for_stack sun4i_ss_opti_poll(struct skcipher_request *areq) oi =0 ; oo =0 ; do { - todo = min3(rx_cnt, ileft, (mi.length - oi) / 4); + todo = min(rx_cnt, ileft); + todo = min_t(size_t, todo, (mi.length - oi) / 4); if (todo) { ileft -= todo; writesl(ss->base + SS_RXFIFO, mi.addr + oi, todo);
@@ -87,7 +88,8 @@ static int noinline_for_stack sun4i_ss_opti_poll(struct skcipher_request *areq) rx_cnt =SS_RXFIFO_SPACES (spaces); tx_cnt =SS_TXFIFO_SPACES (spaces); - todo =min3 (tx_cnt, oleft, (mo.length - oo) /4 ); + todo =min (tx_cnt, oleft); + todo =min_t (size_t, todo, (mo.length - oo) /4 );if (todo) { oleft -= todo;readsl (ss->base +SS_TXFIFO , mo.addr + oo, todo);
@@ -239,7 +241,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq)* todo is the number of consecutive 4byte word that we * can read from current SG */ - todo =min3 (rx_cnt, ileft /4 , (mi.length - oi) /4 ); + todo =min (rx_cnt, ileft /4 ); + todo =min_t (size_t, todo, (mi.length - oi) /4 );if (todo && !ob) {writesl (ss->base +SS_RXFIFO , mi.addr + oi, todo);
@@ -253,8 +256,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq)* we need to be able to write all buf in one * pass, so it is why we min() with rx_cnt */ - todo =min3 (rx_cnt *4 - ob, ileft, - mi.length - oi); + todo =min (rx_cnt *4 - ob, ileft); + todo =min_t (size_t, todo, mi.length - oi);memcpy (buf + ob, mi.addr + oi, todo); ileft -= todo; oi += todo;
@@ -274,7 +277,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq) spaces =readl (ss->base +SS_FCSR ); rx_cnt =SS_RXFIFO_SPACES (spaces); tx_cnt =SS_TXFIFO_SPACES (spaces); -dev_dbg (ss->dev,"%x %u/%u %u/%u cnt=%u %u/%u %u/%u cnt=%u %u\n" , +dev_dbg (ss->dev, +"%x %u/%zu %u/%u cnt=%u %u/%zu %u/%u cnt=%u %u\n" , mode, oi, mi.length, ileft, areq->cryptlen, rx_cnt, oo, mo.length, oleft, areq->cryptlen, tx_cnt, ob);
@@ -282,7 +286,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq)if (!tx_cnt)continue ;/* todo in 4bytes word */ - todo =min3 (tx_cnt, oleft /4 , (mo.length - oo) /4 ); + todo =min (tx_cnt, oleft /4 ); + todo =min_t (size_t, todo, (mo.length - oo) /4 );if (todo) {readsl (ss->base +SS_TXFIFO , mo.addr + oo, todo); oleft -= todo *4 ;
@@ -308,7 +313,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq)* no more than remaining buffer * no need to test against oleft */ - todo =min (mo.length - oo, obl - obo); + todo =min_t (size_t, + mo.length - oo, obl - obo);memcpy (mo.addr + oo, bufo + obo, todo); oleft -= todo; obo += todo;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 344/434 crypto: sun4i-ss - Fix 64-bit size_t warnings on sun4i-ss-hash.c
In reply to Greg Kroah-HartmanFrom: Corentin Labbe <[email protected]>
[ Upstream commit a7126603d46fe8f01aeedf589e071c6aaa6c6c39 ]
If you try to compile this driver on a 64-bit platform then you will get warnings because it mixes size_t with unsigned int which only works on 32-bit.
This patch fixes all of the warnings on sun4i-ss-hash.c.
--- drivers/crypto/sunxi-ss/sun4i-ss-hash.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/crypto/sunxi-ss/sun4i-ss-hash.c +6 -6
@@ -272,8 +272,8 @@ static int sun4i_hash(struct ahash_request *areq)*/ while (op->len <64 && i < end) {/* how many bytes we can read from current SG */ - in_r =min3 (mi.length - in_i, end - i, -64 - op->len); + in_r =min (end - i,64 - op->len); + in_r =min_t (size_t, mi.length - in_i, in_r);memcpy (op->buf + op->len, mi.addr + in_i, in_r); op->len += in_r; i += in_r;
@@ -293,8 +293,8 @@ static int sun4i_hash(struct ahash_request *areq) }if (mi.length - in_i >3 && i < end) {/* how many bytes we can read from current SG */ - in_r =min3 (mi.length - in_i, areq->nbytes - i, - ((mi.length - in_i) /4 ) *4 ); + in_r =min_t (size_t, mi.length - in_i, areq->nbytes - i); + in_r =min_t (size_t, ((mi.length - in_i) /4 ) *4 , in_r);/* how many bytes we can write in the device*/ todo =min3 ((u32)(end - i) /4 , rx_cnt, (u32 )in_r /4 );writesl (ss->base +SS_RXFIFO , mi.addr + in_i, todo);
@@ -320,8 +320,8 @@ static int sun4i_hash(struct ahash_request *areq)if ((areq->nbytes - i) <64 ) {while (i < areq->nbytes && in_i < mi.length && op->len <64 ) {/* how many bytes we can read from current SG */ - in_r =min3 (mi.length - in_i, areq->nbytes - i, -64 - op->len); + in_r =min (areq->nbytes - i,64 - op->len); + in_r =min_t (size_t, mi.length - in_i, in_r);memcpy (op->buf + op->len, mi.addr + in_i, in_r); op->len += in_r; i += in_r;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 345/434 mac80211: consider QoS Null frames for STA_NULLFUNC_ACKED
In reply to Greg Kroah-HartmanFrom: Thomas Pedersen <[email protected]>
[ Upstream commit 08a5bdde3812993cb8eb7aa9124703df0de28e4b ]
Commit 7b6ddeaf27ec ("mac80211: use QoS NDP for AP probing") let STAs send QoS Null frames as PS triggers if the AP was a QoS STA. However, the mac80211 PS stack relies on an interface flag IEEE80211_STA_NULLFUNC_ACKED for determining trigger frame ACK, which was not being set for acked non-QoS Null frames. The effect is an inability to trigger hardware sleep via IEEE80211_CONF_PS since the QoS Null frame was seemingly never acked.
This bug only applies to drivers which set bothIEEE80211_HW_REPORTS_TX_ACK_STATUS andIEEE80211_HW_PS_NULLFUNC_STACK.
Detect the acked QoS Null frame to restore STA power save.
--- net/mac80211/status.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mac80211/status.c +2 -1
@@ -1030,7 +1030,8 @@ static void __ieee80211_tx_status(struct ieee80211_hw *hw,I802_DEBUG_INC (local->dot11FailedCount); } -if (ieee80211_is_nullfunc (fc) &&ieee80211_has_pm (fc) && +if ((ieee80211_is_nullfunc (fc) ||ieee80211_is_qos_nullfunc (fc)) && +ieee80211_has_pm (fc) &&ieee80211_hw_check (&local->hw,REPORTS_TX_ACK_STATUS ) && !(info->flags &IEEE80211_TX_CTL_INJECTED ) && local->ps_sdata && !(local->scanning)) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 346/434 crypto: vmx - Avoid weird build failures
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
[ Upstream commit 4ee812f6143d78d8ba1399671d78c8d78bf2817c ]
In the vmx crypto Makefile we assign to a variable called TARGET and pass that to the aesp8-ppc.pl and ghashp8-ppc.pl scripts.
The variable is meant to describe what flavour of powerpc we're building for, eg. either 32 or 64-bit, and big or little endian.
Unfortunately TARGET is a fairly common name for a make variable, and if it happens that TARGET is specified as a command line parameter to make, the value specified on the command line will override our value.
In particular this can happen if the kernel Makefile is driven by an external Makefile that uses TARGET for something.
This leads to weird build failures, eg:
nonsense at /build/linux/drivers/crypto/vmx/ghashp8-ppc.pl line 45. /linux/drivers/crypto/vmx/Makefile:20: recipe for target 'drivers/crypto/vmx/ghashp8-ppc.S' failed
Which shows that we passed an empty value for $(TARGET) to the perl script, confirmed with make V=1:
perl /linux/drivers/crypto/vmx/ghashp8-ppc.pl > drivers/crypto/vmx/ghashp8-ppc.S
We can avoid this confusion by using override, to tell make that we don't want anything to override our variable, even a value specified on the command line. We can also use a less common name, given the script calls it "flavour", let's use that.
--- drivers/crypto/vmx/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/crypto/vmx/Makefile +3 -3
@@ -3,13 +3,13 @@ obj-$(CONFIG_CRYPTO_DEV_VMX_ENCRYPT) += vmx-crypto.o vmx-crypto-objs := vmx.o aesp8-ppc.o ghashp8-ppc.o aes.o aes_cbc.o aes_ctr.o aes_xts.o ghash.o ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y) -TARGET := linux-ppc64le +override flavour := linux-ppc64le else -TARGET := linux-ppc64 +override flavour := linux-ppc64 endif quiet_cmd_perl = PERL $@ - cmd_perl = $(PERL) $(<) $(TARGET) > $(@) + cmd_perl = $(PERL) $(<) $(flavour) > $(@) targets += aesp8-ppc.S ghashp8-ppc.S
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 347/434 libtraceevent: Fix memory leakage in copy_filter_type
In reply to Greg Kroah-HartmanFrom: Hewenliang <[email protected]>
[ Upstream commit 10992af6bf46a2048ad964985a5b77464e5563b1 ]
It is necessary to free the memory that we have allocated when error occurs.
--- tools/lib/traceevent/parse-filter.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
tools/lib/traceevent/parse-filter.c +7 -2
@@ -1473,8 +1473,10 @@ static int copy_filter_type(struct tep_event_filter *filter,if (strcmp (str,"TRUE" ) ==0 ||strcmp (str,"FALSE" ) ==0 ) {/* Add trivial event */ arg =allocate_arg (); -if (arg ==NULL ) +if (arg ==NULL ) { +free (str);return -1 ; + } arg->type =TEP_FILTER_ARG_BOOLEAN ;if (strcmp (str,"TRUE" ) ==0 )
@@ -1483,8 +1485,11 @@ static int copy_filter_type(struct tep_event_filter *filter, arg->boolean.value =0 ; filter_type =add_filter_type (filter, event->id); -if (filter_type ==NULL ) +if (filter_type ==NULL ) { +free (str); +free_arg (arg);return -1 ; + } filter_type->filter = arg;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 348/434 mips: fix build when "48 bits virtual memory" is enabled
In reply to Greg Kroah-HartmanFrom: Mike Rapoport <[email protected]>
[ Upstream commit 3ed6751bb8fa89c3014399bb0414348499ee202a ]
With CONFIG_MIPS_VA_BITS_48=y the build fails miserably:
CC arch/mips/kernel/asm-offsets.s
In file included from arch/mips/include/asm/pgtable.h:644,
from include/linux/mm.h:99,
from arch/mips/kernel/asm-offsets.c:15:include/asm-generic/pgtable.h:16:2: error: #error CONFIG_PGTABLE_LEVELS is not consistent with __PAGETABLE_{P4D,PUD,PMD}_FOLDED
#error CONFIG_PGTABLE_LEVELS is not consistent with __PAGETABLE_{P4D,PUD,PMD}_FOLDED
^~~~~include/asm-generic/pgtable.h:390:28: error: unknown type name 'p4d_t'; did you mean 'pmd_t'?
static inline int p4d_same(p4d_t p4d_a, p4d_t p4d_b)
^~~~~
pmd_t[ ... more such errors ... ]
scripts/Makefile.build:99: recipe for target 'arch/mips/kernel/asm-offsets.s' failed make[2]: *** [arch/mips/kernel/asm-offsets.s] Error 1
This happens because when CONFIG_MIPS_VA_BITS_48 enables 4th level of the page tables, but neither pgtable-nop4d.h nor 5level-fixup.h are included to cope with the 5th level.
Replace #ifdef conditions around includes of the pgtable-nop{m,u}d.h with explicit CONFIG_PGTABLE_LEVELS and add include of 5level-fixup.h for the case when CONFIG_PGTABLE_LEVELS==4
--- arch/mips/include/asm/pgtable-64.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/mips/include/asm/pgtable-64.h +7 -2
@@ -18,10 +18,12 @@#include <asm/fixmap.h> #define __ARCH_USE_5LEVEL_HACK -#if defined(CONFIG_PAGE_SIZE_64KB ) && !defined(CONFIG_MIPS_VA_BITS_48 ) +#if CONFIG_PGTABLE_LEVELS ==2 #include <asm-generic/pgtable-nopmd.h> -#elif !(defined(CONFIG_PAGE_SIZE_4KB ) && defined(CONFIG_MIPS_VA_BITS_48 )) +#elif CONFIG_PGTABLE_LEVELS ==3 #include <asm-generic/pgtable-nopud.h> +#else +#include <asm-generic/5level-fixup.h> #endif /*
@@ -216,6 +218,9 @@ static inline unsigned long pgd_page_vaddr(pgd_t pgd)return pgd_val (pgd); } +#define pgd_phys (pgd) virt_to_phys((void *)pgd_val(pgd)) +#define pgd_page (pgd) (pfn_to_page(pgd_phys(pgd) >> PAGE_SHIFT)) +static inline pud_t *pud_offset (pgd_t *pgd,unsigned long address) {return (pud_t *)pgd_page_vaddr (*pgd) +pud_index (address);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 349/434 drm/amdgpu: fix bad DMA from INTERRUPT_CNTL2
In reply to Greg Kroah-HartmanFrom: Sam Bobroff <[email protected]>
[ Upstream commit 3d0e3ce52ce3eb4b9de3caf9c38dbb5a4d3e13c3 ]
The INTERRUPT_CNTL2 register expects a valid DMA address, but is currently set with a GPU MC address. This can cause problems on systems that detect the resulting DMA read from an invalid address (found on a Power8 guest).
Instead, use the DMA address of the dummy page because it will always be safe.
--- drivers/gpu/drm/amd/amdgpu/si_ih.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/si_ih.c +2 -1
@@ -64,7 +64,8 @@ static int si_ih_irq_init(struct amdgpu_device *adev)u32 interrupt_cntl, ih_cntl, ih_rb_cntl;si_ih_disable_interrupts (adev); -WREG32 (INTERRUPT_CNTL2 , adev->irq.ih.gpu_addr >>8 ); +/* set dummy read address to dummy page address */ +WREG32 (INTERRUPT_CNTL2 , adev->dummy_page_addr >>8 ); interrupt_cntl =RREG32 (INTERRUPT_CNTL ); interrupt_cntl &= ~IH_DUMMY_RD_OVERRIDE ; interrupt_cntl &= ~IH_REQ_NONSNOOP_EN ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 350/434 ice: Only disable VF state when freeing each VF resources
In reply to Greg Kroah-HartmanFrom: Akeem G Abodunrin <[email protected]>
[ Upstream commit 1f9639d2fb9188a59acafae9dea626391c442a8d ]
It is wrong to set PF disable state flag for all VFs when freeing VF resources - Instead, we should set VF disable state flag for each VF with its resources being returned to the device. Right now, all VF opcodes, mailbox communication to clear its resources as well fails - since we already indicate that PF is in disable state, with all VFs not active. In addition, we don't need to notify VF that PF is intending to reset it, if it is already in disabled state.
--- drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +8 -4
@@ -317,8 +317,9 @@ void ice_free_vfs(struct ice_pf *pf) pf->num_alloc_vfs =0 ;for (i =0 ; i < tmp; i++) {if (test_bit (ICE_VF_STATE_INIT , pf->vf[i].vf_states)) { -/* disable VF qp mappings */ +/* disable VF qp mappings and set VF disable state */ ice_dis_vf_mappings (&pf->vf[i]); +set_bit (ICE_VF_STATE_DIS , pf->vf[i].vf_states);ice_free_vf_res (&pf->vf[i]); } }
@@ -1287,9 +1288,12 @@ static void ice_vc_notify_vf_reset(struct ice_vf *vf)if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs)return ; -/* verify if the VF is in either init or active before proceeding */ -if (!test_bit (ICE_VF_STATE_INIT , vf->vf_states) && - !test_bit (ICE_VF_STATE_ACTIVE , vf->vf_states)) +/* Bail out if VF is in disabled state, neither initialized, nor active +* state - otherwise proceed with notifications +*/ +if ((!test_bit (ICE_VF_STATE_INIT , vf->vf_states) && + !test_bit (ICE_VF_STATE_ACTIVE , vf->vf_states)) || +test_bit (ICE_VF_STATE_DIS , vf->vf_states))return ; pfe.event =VIRTCHNL_EVENT_RESET_IMPENDING ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 351/434 ice: Fix setting coalesce to handle DCB configuration
In reply to Greg Kroah-HartmanFrom: Brett Creeley <[email protected]>
[ Upstream commit e25f9152bc07de534b2b590ce6c052ea25dd8900 ]
Currently there can be a case where a DCB map is applied and there are more interrupt vectors (vsi->num_q_vectors) than Rx queues (vsi->num_rxq) and Tx queues (vsi->num_txq). If we try to set coalesce settings in this case it will report a false failure. Fix this by checking if vector index is valid with respect to the number of Tx and Rx queues configured.
--- drivers/net/ethernet/intel/ice/ice_ethtool.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ice/ice_ethtool.c +10 -3
@@ -3368,10 +3368,17 @@ __ice_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *ec,struct ice_vsi *vsi = np->vsi;if (q_num <0 ) { -int i; +int v_idx; + +ice_for_each_q_vector (vsi, v_idx) { +/* In some cases if DCB is configured the num_[rx|tx]q +* can be less than vsi->num_q_vectors. This check +* accounts for that so we don't report a false failure +*/ +if (v_idx >= vsi->num_rxq && v_idx >= vsi->num_txq) + goto set_complete; -ice_for_each_q_vector (vsi, i) { -if (ice_set_q_coalesce (vsi, ec, i)) +if (ice_set_q_coalesce (vsi, ec, v_idx))return -EINVAL ; } goto set_complete;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 352/434 net: phy: initialise phydev speed and duplex sanely
In reply to Greg Kroah-HartmanFrom: Russell King <[email protected]>
[ Upstream commit a5d66f810061e2dd70fb7a108dcd14e535bc639f ]
When a phydev is created, the speed and duplex are set to zero and -1 respectively, rather than using the predefined SPEED_UNKNOWN and DUPLEX_UNKNOWN constants.
There is a window at initialisation time where we may report link down using the 0/-1 values. Tidy this up and use the predefined constants, so debug doesn't complain with:
"Unsupported (update phy-core.c)/Unsupported (update phy-core.c)"
when the speed and duplex settings are printed.
--- drivers/net/phy/phy_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/phy/phy_device.c +2 -2
@@ -596,8 +596,8 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, mdiodev->device_free = phy_mdio_device_free; mdiodev->device_remove = phy_mdio_device_remove; - dev->speed =0 ; - dev->duplex =-1 ; + dev->speed =SPEED_UNKNOWN ; + dev->duplex =DUPLEX_UNKNOWN ; dev->pause =0 ; dev->asym_pause =0 ; dev->link =0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 353/434 tools, bpf: Fix build for make -s tools/bpf O=<dir>
In reply to Greg Kroah-HartmanFrom: Quentin Monnet <[email protected]>
[ Upstream commit a89b2cbf71d64b61e79bbe5cb7ff4664797eeaaf ]
Building selftests with 'make TARGETS=bpf kselftest' was fixed in commit 55d554f5d140 ("tools: bpf: Use !building_out_of_srctree to determine srctree"). However, by updating $(srctree) in tools/bpf/Makefile for in-tree builds only, we leave out the case where we pass an output directory to build BPF tools, but $(srctree) is not set. This typically happens for:
$ make -s tools/bpf O=/tmp/foo
Makefile:40: /tools/build/Makefile.feature: No such file or directoryFix it by updating $(srctree) in the Makefile not only for out-of-tree builds, but also if $(srctree) is empty.
Detected with test_bpftool_build.sh.
--- tools/bpf/Makefile | 6 ++++++ 1 file changed, 6 insertions(+)
tools/bpf/Makefile +6 -0
@@ -16,7 +16,13 @@ CFLAGS += -D__EXPORTED_HEADERS__ -I$(srctree)/include/uapi -I$(srctree)/include # isn't set and when invoked from selftests build, where srctree # is set to ".". building_out_of_srctree is undefined for in srctree # builds +ifeq ($(srctree),) +update_srctree := 1 +endif ifndef building_out_of_srctree +update_srctree := 1 +endif +ifeq ($(update_srctree),1) srctree := $(patsubst %/,%,$(dir $(CURDIR))) srctree := $(patsubst %/,%,$(dir $(srctree))) endif
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 354/434 RDMA/bnxt_re: Fix missing le16_to_cpu
In reply to Greg Kroah-HartmanFrom: Devesh Sharma <[email protected]>
[ Upstream commit fca5b9dc0986aa49b3f0a7cfe24b6c82422ac1d7 ]
Quoted 1 line
From sparse:
drivers/infiniband/hw/bnxt_re/main.c:1274:18: warning: cast from restricted __le16 drivers/infiniband/hw/bnxt_re/main.c:1275:18: warning: cast from restricted __le16 drivers/infiniband/hw/bnxt_re/main.c:1276:18: warning: cast from restricted __le16 drivers/infiniband/hw/bnxt_re/main.c:1277:21: warning: restricted __le16 degrades to integer
--- drivers/infiniband/hw/bnxt_re/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/infiniband/hw/bnxt_re/main.c +4 -4
@@ -1270,10 +1270,10 @@ static void bnxt_re_query_hwrm_intf_version(struct bnxt_re_dev *rdev)return ; } rdev->qplib_ctx.hwrm_intf_ver = - (u64 )resp.hwrm_intf_major <<48 | - (u64 )resp.hwrm_intf_minor <<32 | - (u64 )resp.hwrm_intf_build <<16 | - resp.hwrm_intf_patch; + (u64 )le16_to_cpu (resp.hwrm_intf_major) <<48 | + (u64 )le16_to_cpu (resp.hwrm_intf_minor) <<32 | + (u64 )le16_to_cpu (resp.hwrm_intf_build) <<16 | +le16_to_cpu (resp.hwrm_intf_patch); }static void bnxt_re_ib_unreg (struct bnxt_re_dev *rdev)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 355/434 RDMA/bnxt_re: Fix stat push into dma buffer on gen p5 devices
In reply to Greg Kroah-HartmanFrom: Devesh Sharma <[email protected]>
[ Upstream commit 98998ffe5216c7fa2c0225bb5b049ca5cdf8d195 ]
Due to recent advances in the firmware for Broadcom's gen p5 series of adaptors the driver code to report hardware counters has been broken w.r.t. roce devices.
The new firmware command expects dma length to be specified during stat dma buffer allocation.
--- drivers/infiniband/hw/bnxt_re/main.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/bnxt_re/main.c +1 -0
@@ -477,6 +477,7 @@ static int bnxt_re_net_stats_ctx_alloc(struct bnxt_re_dev *rdev,bnxt_re_init_hwrm_hdr (rdev, (void *)&req,HWRM_STAT_CTX_ALLOC ,-1 ,-1 ); req.update_period_ms =cpu_to_le32 (1000 ); req.stats_dma_addr =cpu_to_le64 (dma_map); + req.stats_dma_length =cpu_to_le16 (sizeof (struct ctx_hw_stats_ext )); req.stat_ctx_flags =STAT_CTX_ALLOC_REQ_STAT_CTX_FLAGS_ROCE ;bnxt_re_fill_fw_msg (&fw_msg, (void *)&req,sizeof (req), (void *)&resp,sizeof (resp),DFLT_HWRM_CMD_TIMEOUT );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 356/434 bpf: Provide better register bounds after jmp32 instructions
In reply to Greg Kroah-HartmanFrom: Yonghong Song <[email protected]>
[ Upstream commit 581738a681b6faae5725c2555439189ca81c0f1f ]
With latest llvm (trunk https://github.com/llvm/llvm-project),test_progs, which has +alu32 enabled, failed for strobemeta.o. The verifier output looks like below with edit to replace large decimal numbers with hex ones.
193: (85) call bpf_probe_read_user_str#114
R0=inv(id=0)
194: (26) if w0 > 0x1 goto pc+4
R0_w=inv(id=0,umax_value=0xffffffff00000001)
195: (6b) *(u16 *)(r7 +80) = r0
196: (bc) w6 = w0
R6_w=inv(id=0,umax_value=0xffffffff,var_off=(0x0; 0xffffffff))
197: (67) r6 <<= 32
R6_w=inv(id=0,smax_value=0x7fffffff00000000,umax_value=0xffffffff00000000,
var_off=(0x0; 0xffffffff00000000))
198: (77) r6 >>= 32
R6=inv(id=0,umax_value=0xffffffff,var_off=(0x0; 0xffffffff))
...
201: (79) r8 = *(u64 *)(r10 -416)
R8_w=map_value(id=0,off=40,ks=4,vs=13872,imm=0)
202: (0f) r8 += r6
R8_w=map_value(id=0,off=40,ks=4,vs=13872,umax_value=0xffffffff,var_off=(0x0; 0xffffffff))
203: (07) r8 += 9696
R8_w=map_value(id=0,off=9736,ks=4,vs=13872,umax_value=0xffffffff,var_off=(0x0; 0xffffffff))
...
255: (bf) r1 = r8
R1_w=map_value(id=0,off=9736,ks=4,vs=13872,umax_value=0xffffffff,var_off=(0x0; 0xffffffff))
...
257: (85) call bpf_probe_read_user_str#114
R1 unbounded memory access, make sure to bounds check any array access into a map
The value range for register r6 at insn 198 should be really just 0/1. The umax_value=0xffffffff caused later verification failure.
After jmp instructions, the current verifier already tried to use just obtained information to get better register range. The current mechanism is for 64bit register only. This patch implemented to tighten the range for 32bit sub-registers after jmp32 instructions.
With the patch, we have the below range ranges for the
above code sequence:
193: (85) call bpf_probe_read_user_str#114
R0=inv(id=0)
194: (26) if w0 > 0x1 goto pc+4
R0_w=inv(id=0,smax_value=0x7fffffff00000001,umax_value=0xffffffff00000001,
var_off=(0x0; 0xffffffff00000001))
195: (6b) *(u16 *)(r7 +80) = r0
196: (bc) w6 = w0
R6_w=inv(id=0,umax_value=0xffffffff,var_off=(0x0; 0x1))
197: (67) r6 <<= 32
R6_w=inv(id=0,umax_value=0x100000000,var_off=(0x0; 0x100000000))
198: (77) r6 >>= 32
R6=inv(id=0,umax_value=1,var_off=(0x0; 0x1))
...
201: (79) r8 = *(u64 *)(r10 -416)
R8_w=map_value(id=0,off=40,ks=4,vs=13872,imm=0)
202: (0f) r8 += r6
R8_w=map_value(id=0,off=40,ks=4,vs=13872,umax_value=1,var_off=(0x0; 0x1))
203: (07) r8 += 9696
R8_w=map_value(id=0,off=9736,ks=4,vs=13872,umax_value=1,var_off=(0x0; 0x1))
...
255: (bf) r1 = r8
R1_w=map_value(id=0,off=9736,ks=4,vs=13872,umax_value=1,var_off=(0x0; 0x1))
...
257: (85) call bpf_probe_read_user_str#114
...
At insn 194, the register R0 has better var_off.mask and smax_value. Especially, the var_off.mask ensures later lshift and rshift maintains proper value range.
--- kernel/bpf/verifier.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
kernel/bpf/verifier.c +19 -0
@@ -978,6 +978,17 @@ static void __reg_bound_offset(struct bpf_reg_state *reg) reg->umax_value)); } +static void __reg_bound_offset32 (struct bpf_reg_state *reg) +{ +u64 mask =0xffffFFFF ; +struct tnum range =tnum_range (reg->umin_value & mask, + reg->umax_value & mask); +struct tnum lo32 =tnum_cast (reg->var_off,4 ); +struct tnum hi32 =tnum_lshift (tnum_rshift (reg->var_off,32 ),32 ); + + reg->var_off =tnum_or (hi32,tnum_intersect (lo32, range)); +} +/* Reset the min/max bounds of a register */ static void __mark_reg_unbounded (struct bpf_reg_state *reg) {
@@ -5433,6 +5444,10 @@ static void reg_set_min_max(struct bpf_reg_state *true_reg,/* We might have learned some bits from the bounds. */ __reg_bound_offset (false_reg);__reg_bound_offset (true_reg); +if (is_jmp32) { +__reg_bound_offset32 (false_reg); +__reg_bound_offset32 (true_reg); + }/* Intersecting with the old var_off might have improved our bounds * slightly. e.g. if umax was 0x7f...f and var_off was (0; 0xf...fc), * then new var_off is (0; 0x7f...fc) which improves our umax.
@@ -5542,6 +5557,10 @@ static void reg_set_min_max_inv(struct bpf_reg_state *true_reg,/* We might have learned some bits from the bounds. */ __reg_bound_offset (false_reg);__reg_bound_offset (true_reg); +if (is_jmp32) { +__reg_bound_offset32 (false_reg); +__reg_bound_offset32 (true_reg); + }/* Intersecting with the old var_off might have improved our bounds * slightly. e.g. if umax was 0x7f...f and var_off was (0; 0xf...fc), * then new var_off is (0; 0x7f...fc) which improves our umax.
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 357/434 RDMA/bnxt_re: Fix chip number validation Broadcoms Gen P5 series
In reply to Greg Kroah-HartmanFrom: Luke Starrett <[email protected]>
[ Upstream commit e284b159c6881c8bec9713daba2653268f4c4948 ]
In the first version of Gen P5 ASIC, chip-id was always set to 0x1750 for all adaptor port configurations. This has been fixed in the new chip rev.
Due to this missing fix users are not able to use adaptors based on latest chip rev of Broadcom's Gen P5 adaptors.
--- drivers/infiniband/hw/bnxt_re/qplib_res.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/infiniband/hw/bnxt_re/qplib_res.h +6 -2
@@ -186,7 +186,9 @@ struct bnxt_qplib_chip_ctx {u8 chip_metal; }; -#define CHIP_NUM_57500 0x1750 +#define CHIP_NUM_57508 0x1750 +#define CHIP_NUM_57504 0x1751 +#define CHIP_NUM_57502 0x1752struct bnxt_qplib_res {struct pci_dev *pdev;
@@ -203,7 +205,9 @@ struct bnxt_qplib_res {static inline bool bnxt_qplib_is_chip_gen_p5 (struct bnxt_qplib_chip_ctx *cctx) { -return (cctx->chip_num ==CHIP_NUM_57500 ); +return (cctx->chip_num ==CHIP_NUM_57508 || + cctx->chip_num ==CHIP_NUM_57504 || + cctx->chip_num ==CHIP_NUM_57502 ); }static inline u8 bnxt_qplib_get_hwq_type (struct bnxt_qplib_res *res)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 358/434 ibmvnic: Fix completion structure initialization
In reply to Greg Kroah-HartmanFrom: Thomas Falcon <[email protected]>
[ Upstream commit 070eca955c4af1248cb78a216463ff757a5dc511 ]
Fix multiple calls to init_completion for device completion structures. Instead, initialize them during device probe and reinitialize them later as needed.
--- drivers/net/ethernet/ibm/ibmvnic.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +11 -8
@@ -176,7 +176,7 @@ static int alloc_long_term_buff(struct ibmvnic_adapter *adapter, ltb->map_id = adapter->map_id; adapter->map_id++; -init_completion (&adapter->fw_done); +reinit_completion (&adapter->fw_done); rc =send_request_map (adapter, ltb->addr, ltb->size, ltb->map_id);if (rc) {
@@ -215,7 +215,7 @@ static int reset_long_term_buff(struct ibmvnic_adapter *adapter,memset (ltb->buff,0 , ltb->size); -init_completion (&adapter->fw_done); +reinit_completion (&adapter->fw_done); rc =send_request_map (adapter, ltb->addr, ltb->size, ltb->map_id);if (rc)return rc;
@@ -943,7 +943,7 @@ static int ibmvnic_get_vpd(struct ibmvnic_adapter *adapter)if (adapter->vpd->buff) len = adapter->vpd->len; -init_completion (&adapter->fw_done); +reinit_completion (&adapter->fw_done); crq.get_vpd_size.first =IBMVNIC_CRQ_CMD ; crq.get_vpd_size.cmd =GET_VPD_SIZE ; rc =ibmvnic_send_crq (adapter, &crq);
@@ -1689,7 +1689,7 @@ static int __ibmvnic_set_mac(struct net_device *netdev, u8 *dev_addr) crq.change_mac_addr.cmd =CHANGE_MAC_ADDR ;ether_addr_copy (&crq.change_mac_addr.mac_addr[0 ], dev_addr); -init_completion (&adapter->fw_done); +reinit_completion (&adapter->fw_done); rc =ibmvnic_send_crq (adapter, &crq);if (rc) { rc = -EIO ;
@@ -2316,7 +2316,7 @@ static int wait_for_reset(struct ibmvnic_adapter *adapter) adapter->fallback.rx_entries = adapter->req_rx_add_entries_per_subcrq; adapter->fallback.tx_entries = adapter->req_tx_entries_per_subcrq; -init_completion (&adapter->reset_done); +reinit_completion (&adapter->reset_done); adapter->wait_for_reset = true; rc =ibmvnic_reset (adapter,VNIC_RESET_CHANGE_PARAM );if (rc)
@@ -2332,7 +2332,7 @@ static int wait_for_reset(struct ibmvnic_adapter *adapter) adapter->desired.rx_entries = adapter->fallback.rx_entries; adapter->desired.tx_entries = adapter->fallback.tx_entries; -init_completion (&adapter->reset_done); +reinit_completion (&adapter->reset_done); adapter->wait_for_reset = true; rc =ibmvnic_reset (adapter,VNIC_RESET_CHANGE_PARAM );if (rc)
@@ -2603,7 +2603,7 @@ static void ibmvnic_get_ethtool_stats(struct net_device *dev,cpu_to_be32 (sizeof (struct ibmvnic_statistics ));/* Wait for data to be written */ -init_completion (&adapter->stats_done); +reinit_completion (&adapter->stats_done); rc =ibmvnic_send_crq (adapter, &crq);if (rc)return ;
@@ -4408,7 +4408,7 @@ static int send_query_phys_parms(struct ibmvnic_adapter *adapter)memset (&crq,0 ,sizeof (crq)); crq.query_phys_parms.first =IBMVNIC_CRQ_CMD ; crq.query_phys_parms.cmd =QUERY_PHYS_PARMS ; -init_completion (&adapter->fw_done); +reinit_completion (&adapter->fw_done); rc =ibmvnic_send_crq (adapter, &crq);if (rc)return rc;
@@ -4960,6 +4960,9 @@ static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id)INIT_LIST_HEAD (&adapter->rwi_list);spin_lock_init (&adapter->rwi_lock);init_completion (&adapter->init_done); +init_completion (&adapter->fw_done); +init_completion (&adapter->reset_done); +init_completion (&adapter->stats_done);clear_bit (0 , &adapter->resetting); do {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 359/434 net: wireless: intel: iwlwifi: fix GRO_NORMAL packet stalling
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
[ Upstream commit b167191e2a851cb2e4c6ef8b91c83ff73ef41872 ]
Commit 6570bc79c0df ("net: core: use listified Rx for GRO_NORMAL in napi_gro_receive()") has applied batched GRO_NORMAL packets processing to all napi_gro_receive() users, including mac80211-based drivers.
However, this change has led to a regression in iwlwifi driver [1][2] as it is required for NAPI users to call napi_complete_done() or napi_complete() and the end of every polling iteration, whilst iwlwifi doesn't use NAPI scheduling at all and just calls napi_gro_flush(). In that particular case, packets which have not been already flushed from napi->rx_list stall in it until at least next Rx cycle.
Fix this by adding a manual flushing of the list to iwlwifi driver right before napi_gro_flush() call to mimic napi_complete() logics.
I prefer to open-code gro_normal_list() rather than exporting it for 2 reasons:
* to prevent from using it and napi_gro_flush() in any new drivers, as it is the *really* bad way to use NAPI that should be avoided;
* to keep gro_normal_list() static and don't lose any CC optimizations.
I also don't add the "Fixes:" tag as the mentioned commit was only a trigger that only exposed an improper usage of NAPI in this particular driver.
[1] https://lore.kernel.org/netdev/PSXP216MB04388962C411CD0B17A86F47804A0@PSXP216MB0438.KORP216.PROD.OUTLOOK.COM
[2] https://bugzilla.kernel.org/show_bug.cgi?id=205647
--- drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/pcie/rx.c +11 -2
@@ -1429,6 +1429,7 @@ out_err:static void iwl_pcie_rx_handle (struct iwl_trans *trans,int queue) {struct iwl_trans_pcie *trans_pcie =IWL_TRANS_GET_PCIE_TRANS (trans); +struct napi_struct *napi;struct iwl_rxq *rxq;u32 r, i, count =0 ;bool emergency = false;
@@ -1534,8 +1535,16 @@ out:if (unlikely (emergency && count))iwl_pcie_rxq_alloc_rbs (trans,GFP_ATOMIC , rxq); -if (rxq->napi.poll) -napi_gro_flush (&rxq->napi, false); + napi = &rxq->napi; +if (napi->poll) { +if (napi->rx_count) { +netif_receive_skb_list (&napi->rx_list); +INIT_LIST_HEAD (&napi->rx_list); + napi->rx_count =0 ; + } + +napi_gro_flush (napi, false); + }iwl_pcie_rxq_restock (trans, rxq); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 360/434 MIPS: futex: Restore \n after sync instructions
In reply to Greg Kroah-HartmanFrom: Paul Burton <[email protected]>
[ Upstream commit fd7710cb491f900eb63d2ce5aac0e682003e84e9 ]
Commit 3c1d3f097972 ("MIPS: futex: Emit Loongson3 sync workarounds within asm") inadvertently removed the newlines following __WEAK_LLSC_MB, which causes build failures for configurations in which __WEAK_LLSC_MB expands to a sync instruction:
{standard input}: Assembler messages:
{standard input}:9346: Error: symbol sync3' is already defined {standard input}:9380: Error: symbol sync3' is already defined
...
Fix this by restoring the newlines to separate the sync instruction from anything following it (such as the 3: label), preventing inadvertent concatenation.
--- arch/mips/include/asm/futex.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/mips/include/asm/futex.h +3 -3
@@ -33,7 +33,7 @@" .set arch=r4000 \n" \"2: sc $1, %2 \n" \" beqzl $1, 1b \n" \ - __stringify(__WEAK_LLSC_MB) \ + __stringify(__WEAK_LLSC_MB) " \n" \"3: \n" \" .insn \n" \" .set pop \n" \
@@ -63,7 +63,7 @@" .set " MIPS_ISA_ARCH_LEVEL " \n" \ "2: "user_sc("$1", "%2")" \n" \" beqz $1, 1b \n" \ - __stringify(__WEAK_LLSC_MB) \ + __stringify(__WEAK_LLSC_MB) " \n" \"3: \n" \" .insn \n" \" .set pop \n" \
@@ -148,7 +148,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr," .set arch=r4000 \n" "2: sc $1, %2 \n" " beqzl $1, 1b \n" - __stringify(__WEAK_LLSC_MB) + __stringify(__WEAK_LLSC_MB) " \n""3: \n" " .insn \n" " .set pop \n"
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 361/434 btrfs: dont prematurely free work in reada_start_machine_worker()
In reply to Greg Kroah-HartmanFrom: Omar Sandoval <[email protected]>
[ Upstream commit e732fe95e4cad35fc1df278c23a32903341b08b3 ]
Currently, reada_start_machine_worker() frees the reada_machine_work and then calls __reada_start_machine() to do readahead. This is another potential instance of the bug in "btrfs: don't prematurely free work in run_ordered_work()".
There _might_ already be a deadlock here: reada_start_machine_worker() can depend on itself through stacked filesystems (__read_start_machine() -> reada_start_machine_dev() -> reada_tree_block_flagged() -> read_extent_buffer_pages() -> submit_one_bio() -> btree_submit_bio_hook() -> btrfs_map_bio() -> submit_stripe_bio() -> submit_bio() onto a loop device can trigger readahead on the lower filesystem).
Either way, let's fix it by freeing the work at the end.
--- fs/btrfs/reada.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
fs/btrfs/reada.c +4 -6
@@ -752,21 +752,19 @@ static int reada_start_machine_dev(struct btrfs_device *dev)static void reada_start_machine_worker (struct btrfs_work *work) {struct reada_machine_work *rmw; -struct btrfs_fs_info *fs_info;int old_ioprio; rmw = container_of(work, struct reada_machine_work, work); - fs_info = rmw->fs_info; - -kfree (rmw); old_ioprio =IOPRIO_PRIO_VALUE (task_nice_ioclass (current),task_nice_ioprio (current));set_task_ioprio (current,BTRFS_IOPRIO_READA ); -__reada_start_machine (fs_info); +__reada_start_machine (rmw->fs_info);set_task_ioprio (current, old_ioprio); -atomic_dec (&fs_info->reada_works_cnt); +atomic_dec (&rmw->fs_info->reada_works_cnt); + +kfree (rmw); }static void __reada_start_machine (struct btrfs_fs_info *fs_info)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 362/434 btrfs: dont prematurely free work in scrub_missing_raid56_worker()
In reply to Greg Kroah-HartmanFrom: Omar Sandoval <[email protected]>
[ Upstream commit 57d4f0b863272ba04ba85f86bfdc0f976f0af91c ]
Currently, scrub_missing_raid56_worker() puts and potentially frees sblock (which embeds the work item) and then submits a bio through scrub_wr_submit(). This is another potential instance of the bug in "btrfs: don't prematurely free work in run_ordered_work()". Fix it by dropping the reference after we submit the bio.
--- fs/btrfs/scrub.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/btrfs/scrub.c +1 -2
@@ -2149,14 +2149,13 @@ static void scrub_missing_raid56_worker(struct btrfs_work *work)scrub_write_block_to_dev_replace (sblock); } -scrub_block_put (sblock); -if (sctx->is_dev_replace && sctx->flush_all_writes) {mutex_lock (&sctx->wr_lock);scrub_wr_submit (sctx);mutex_unlock (&sctx->wr_lock); } +scrub_block_put (sblock);scrub_pending_bio_dec (sctx); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 363/434 Revert "mmc: sdhci: Fix incorrect switch to HS mode"
In reply to Greg Kroah-HartmanFrom: Faiz Abbas <[email protected]>
commit 07bcc411567cb96f9d1fc84fff8d387118a2920d upstream.
This reverts commit c894e33ddc1910e14d6f2a2016f60ab613fd8b37.
This commit aims to treat SD High speed and SDR25 as the same while setting UHS Timings in HOST_CONTROL2 which leads to failures with some SD cards in AM65x. Revert this commit.
The issue this commit was trying to fix can be implemented in a platform specific callback instead of common sdhci code.
--- drivers/mmc/host/sdhci.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mmc/host/sdhci.c +1 -3
@@ -1871,9 +1871,7 @@ void sdhci_set_uhs_signaling(struct sdhc ctrl_2 |=SDHCI_CTRL_UHS_SDR104 ; else if (timing == MMC_TIMING_UHS_SDR12) ctrl_2 |= SDHCI_CTRL_UHS_SDR12; - else if (timing == MMC_TIMING_SD_HS || - timing == MMC_TIMING_MMC_HS || - timing == MMC_TIMING_UHS_SDR25) + else if (timing == MMC_TIMING_UHS_SDR25) ctrl_2 |= SDHCI_CTRL_UHS_SDR25; else if (timing == MMC_TIMING_UHS_SDR50) ctrl_2 |= SDHCI_CTRL_UHS_SDR50;
Greg Kroah-Hartman
maintainerPATCH 364/434 mmc: mediatek: fix CMD_TA to 2 for MT8173 HS200/HS400 mode
In reply to Greg Kroah-HartmanFrom: Chaotian Jing <[email protected]>
commit 8f34e5bd7024d1ffebddd82d7318b1be17be9e9a upstream.
there is a chance that always get response CRC error after HS200 tuning, the reason is that need set CMD_TA to 2. this modification is only for MT8173.
--- drivers/mmc/host/mtk-sd.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/mmc/host/mtk-sd.c +2 -0
@@ -228,6 +228,7 @@#define MSDC_PATCH_BIT_SPCPUSH (0x1 << 29)/* RW */ #define MSDC_PATCH_BIT_DECRCTMO (0x1 << 30)/* RW */ +#define MSDC_PATCH_BIT1_CMDTA (0x7 << 3)/* RW */ #define MSDC_PATCH_BIT1_STOP_DLY (0xf << 8)/* RW */ #define MSDC_PATCH_BIT2_CFGRESP (0x1 << 15)/* RW */
@@ -1881,6 +1882,7 @@ static int hs400_tune_response(struct mm/* select EMMC50 PAD CMD tune */ sdr_set_bits (host->base +PAD_CMD_TUNE ,BIT (0 )); +sdr_set_field (host->base +MSDC_PATCH_BIT1 ,MSDC_PATCH_BIT1_CMDTA ,2 );if (mmc->ios.timing ==MMC_TIMING_MMC_HS200 || mmc->ios.timing ==MMC_TIMING_UHS_SDR104 )
Greg Kroah-Hartman
maintainerPATCH 365/434 tpm_tis: reserve chip for duration of tpm_tis_core_init
In reply to Greg Kroah-HartmanFrom: Jerry Snitselaar <[email protected]>
commit 21df4a8b6018b842d4db181a8b24166006bad3cd upstream.
Instead of repeatedly calling tpm_chip_start/tpm_chip_stop when issuing commands to the tpm during initialization, just reserve the chip after wait_startup, and release it when we are ready to call tpm_chip_register.
--- drivers/char/tpm/tpm_tis_core.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-)
drivers/char/tpm/tpm_tis_core.c +18 -17
@@ -899,13 +899,13 @@ int tpm_tis_core_init(struct device *devif (wait_startup (chip,0 ) !=0 ) { rc = -ENODEV ; - goto out_err; + goto err_start; }/* Take control of the TPM's interrupt hardware and shut it off */ rc =tpm_tis_read32 (priv,TPM_INT_ENABLE (priv->locality), &intmask);if (rc <0 ) - goto out_err; + goto err_start; intmask |=TPM_INTF_CMD_READY_INT |TPM_INTF_LOCALITY_CHANGE_INT |TPM_INTF_DATA_AVAIL_INT |TPM_INTF_STS_VALID_INT ;
@@ -914,21 +914,21 @@ int tpm_tis_core_init(struct device *dev rc =tpm_chip_start (chip);if (rc) - goto out_err; + goto err_start; + rc =tpm2_probe (chip); -tpm_chip_stop (chip);if (rc) - goto out_err; + goto err_probe; rc =tpm_tis_read32 (priv,TPM_DID_VID (0 ), &vendor);if (rc <0 ) - goto out_err; + goto err_probe; priv->manufacturer_id = vendor; rc =tpm_tis_read8 (priv,TPM_RID (0 ), &rid);if (rc <0 ) - goto out_err; + goto err_probe; dev_info(dev, "%s TPM (device-id 0x%X, rev-id %d)\n", (chip->flags & TPM_CHIP_FLAG_TPM2) ? "2.0" : "1.2",
@@ -937,13 +937,13 @@ int tpm_tis_core_init(struct device *dev probe =probe_itpm (chip);if (probe <0 ) { rc = -ENODEV ; - goto out_err; + goto err_probe; }/* Figure out the capabilities */ rc =tpm_tis_read32 (priv,TPM_INTF_CAPS (priv->locality), &intfcaps);if (rc <0 ) - goto out_err; + goto err_probe;dev_dbg (dev,"TPM interface capabilities (0x%x):\n" , intfcaps);
@@ -977,10 +977,9 @@ int tpm_tis_core_init(struct device *devif (tpm_get_timeouts (chip)) {dev_err (dev,"Could not get TPM timeouts and durations\n" ); rc = -ENODEV ; - goto out_err; + goto err_probe; } -tpm_chip_start (chip); chip->flags |=TPM_CHIP_FLAG_IRQ ;if (irq) { tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED,
@@ -991,18 +990,20 @@ int tpm_tis_core_init(struct device *dev }else {tpm_tis_probe_irq (chip, intmask); } -tpm_chip_stop (chip); } +tpm_chip_stop (chip); + rc =tpm_chip_register (chip);if (rc) - goto out_err; - -if (chip->ops->clk_enable !=NULL ) - chip->ops->clk_enable (chip, false); + goto err_start;return 0 ; -out_err: + +err_probe: +tpm_chip_stop (chip); + +err_start:if ((chip->ops !=NULL ) && (chip->ops->clk_enable !=NULL )) chip->ops->clk_enable (chip, false);
Greg Kroah-Hartman
maintainerPATCH 366/434 tpm: fix invalid locking in NONBLOCKING mode
In reply to Greg Kroah-HartmanFrom: Tadeusz Struk <[email protected]>
commit d23d12484307b40eea549b8a858f5fffad913897 upstream.
When an application sends TPM commands in NONBLOCKING mode the driver holds chip->tpm_mutex returning from write(), which triggers: "WARNING: lock held when returning to user space". To fix this issue the driver needs to release the mutex before returning and acquire it again in tpm_dev_async_work() before sending the command.
--- drivers/char/tpm/tpm-dev-common.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/char/tpm/tpm-dev-common.c +8 -0
@@ -61,6 +61,12 @@ static void tpm_dev_async_work(struct womutex_lock (&priv->buffer_mutex); priv->command_enqueued = false; + ret =tpm_try_get_ops (priv->chip); +if (ret) { + priv->response_length = ret; + goto out; + } + ret =tpm_dev_transmit (priv->chip, priv->space, priv->data_buffer,sizeof (priv->data_buffer));tpm_put_ops (priv->chip);
@@ -68,6 +74,7 @@ static void tpm_dev_async_work(struct wo priv->response_length = ret;mod_timer (&priv->user_read_timer, jiffies + (120 *HZ )); } +out:mutex_unlock (&priv->buffer_mutex);wake_up_interruptible (&priv->async_wait); }
@@ -204,6 +211,7 @@ ssize_t tpm_common_write(struct file *fiif (file->f_flags &O_NONBLOCK ) { priv->command_enqueued = true;queue_work (tpm_dev_wq, &priv->async_work); +tpm_put_ops (priv->chip);mutex_unlock (&priv->buffer_mutex);return size; }
Greg Kroah-Hartman
maintainerPATCH 367/434 iommu: fix KASAN use-after-free in iommu_insert_resv_region
In reply to Greg Kroah-HartmanFrom: Eric Auger <[email protected]>
commit 4c80ba392bf603d468ea827d902f8e7b2505fbf4 upstream.
In case the new region gets merged into another one, the nr list node is freed. Checking its type while completing the merge algorithm leads to a use-after-free. Use new->type instead.
--- drivers/iommu/iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iommu/iommu.c +2 -2
@@ -312,8 +312,8 @@ int iommu_insert_resv_region(struct iommlist_for_each_entry_safe (iter, tmp, regions, list) {phys_addr_t top_end, iter_end = iter->start + iter->length -1 ; -/* no merge needed on elements of different types than @nr */ -if (iter->type != nr->type) { +/* no merge needed on elements of different types than @new */ +if (iter->type != new->type) {list_move_tail (&iter->list, &stack);continue ; }
Greg Kroah-Hartman
maintainerPATCH 368/434 iommu: set group default domain before creating direct mappings
In reply to Greg Kroah-HartmanFrom: Jerry Snitselaar <[email protected]>
commit d360211524bece6db9920f32c91808235290b51c upstream.
iommu_group_create_direct_mappings uses group->default_domain, but right after it is called, request_default_domain_for_dev calls iommu_domain_free for the default domain, and sets the group default domain to a different domain. Move the iommu_group_create_direct_mappings call to after the group default domain is set, so the direct mappings get associated with that domain.
--- drivers/iommu/iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iommu/iommu.c +2 -2
@@ -2221,13 +2221,13 @@ request_default_domain_for_dev(struct de goto out; } -iommu_group_create_direct_mappings (group, dev); -/* Make the domain the default for this group */ if (group->default_domain)iommu_domain_free (group->default_domain); group->default_domain = domain; +iommu_group_create_direct_mappings (group, dev); +dev_info (dev,"Using iommu %s mapping\n" , type ==IOMMU_DOMAIN_DMA ?"dma" :"direct" );
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Greg Kroah-Hartman
maintainerPATCH 369/434 iommu/vt-d: Fix dmar pte read access not set error
In reply to Greg Kroah-HartmanFrom: Lu Baolu <[email protected]>
commit 75d18385394f56db76845d91a192532aba421875 upstream.
If the default DMA domain of a group doesn't fit a device, it will still sit in the group but use a private identity domain. When map/unmap/iova_to_phys come through iommu API, the driver should still serve them, otherwise, other devices in the same group will be impacted. Since identity domain has been mapped with the whole available memory space and RMRRs, we don't need to worry about the impact on it.
--- drivers/iommu/intel-iommu.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/iommu/intel-iommu.c +0 -8
@@ -5447,9 +5447,6 @@ static int intel_iommu_map(struct iommu_int prot =0 ;int ret; -if (dmar_domain->flags &DOMAIN_FLAG_LOSE_CHILDREN ) -return -EINVAL ; -if (iommu_prot &IOMMU_READ ) prot |=DMA_PTE_READ ;if (iommu_prot &IOMMU_WRITE )
@@ -5492,8 +5489,6 @@ static size_t intel_iommu_unmap(struct i/* Cope with horrid API which requires us to unmap more than the size argument if it happens to be a large-page mapping. */ BUG_ON (!pfn_to_dma_pte (dmar_domain, iova >>VTD_PAGE_SHIFT , &level)); -if (dmar_domain->flags &DOMAIN_FLAG_LOSE_CHILDREN ) -return 0 ;if (size <VTD_PAGE_SIZE <<level_to_offset_bits (level)) size =VTD_PAGE_SIZE <<level_to_offset_bits (level);
@@ -5525,9 +5520,6 @@ static phys_addr_t intel_iommu_iova_to_pint level =0 ;u64 phys =0 ; -if (dmar_domain->flags &DOMAIN_FLAG_LOSE_CHILDREN ) -return 0 ; - pte =pfn_to_dma_pte (dmar_domain, iova >>VTD_PAGE_SHIFT , &level);if (pte) phys =dma_pte_addr (pte);
Greg Kroah-Hartman
maintainerPATCH 370/434 iommu/vt-d: Set ISA bridge reserved region as relaxable
In reply to Greg Kroah-HartmanFrom: Alex Williamson <[email protected]>
commit d8018a0e9195ba9f0fb9cf0fd3843807c8b952d5 upstream.
Commit d850c2ee5fe2 ("iommu/vt-d: Expose ISA direct mapping region via iommu_get_resv_regions") created a direct-mapped reserved memory region in order to replace the static identity mapping of the ISA address space, where the latter was then removed in commit df4f3c603aeb ("iommu/vt-d: Remove static identity map code"). According to the history of this code and the Kconfig option surrounding it, this direct mapping exists for the benefit of legacy ISA drivers that are not compatible with the DMA API.
In conjuntion with commit 9b77e5c79840 ("vfio/type1: check dma map request is within a valid iova range") this change introduced a regression where the vfio IOMMU backend enforces reserved memory regions per IOMMU group, preventing userspace from creating IOMMU mappings conflicting with prescribed reserved regions. A necessary prerequisite for the vfio change was the introduction of "relaxable" direct mappings introduced by commit adfd37382090 ("iommu: Introduce IOMMU_RESV_DIRECT_RELAXABLE reserved memory regions"). These relaxable direct mappings provide the same identity mapping support in the default domain, but also indicate that the reservation is software imposed and may be relaxed under some conditions, such as device assignment.
Convert the ISA bridge direct-mapped reserved region to relaxable to reflect that the restriction is self imposed and need not be enforced by drivers such as vfio.
--- drivers/iommu/intel-iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/intel-iommu.c +1 -1
@@ -5698,7 +5698,7 @@ static void intel_iommu_get_resv_regionsif ((pdev->class >>8 ) ==PCI_CLASS_BRIDGE_ISA ) { reg =iommu_alloc_resv_region (0 ,1UL <<24 ,0 , -IOMMU_RESV_DIRECT ); +IOMMU_RESV_DIRECT_RELAXABLE );if (reg)list_add_tail (®->list, head); }
Greg Kroah-Hartman
maintainerPATCH 371/434 iommu/vt-d: Allocate reserved region for ISA with correct permission
In reply to Greg Kroah-HartmanFrom: Jerry Snitselaar <[email protected]>
commit cde9319e884eb6267a0df446f3c131fe1108defb upstream.
Currently the reserved region for ISA is allocated with no permissions. If a dma domain is being used, mapping this region will fail. Set the permissions to DMA_PTE_READ|DMA_PTE_WRITE.
--- drivers/iommu/intel-iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/intel-iommu.c +1 -1
@@ -5697,7 +5697,7 @@ static void intel_iommu_get_resv_regionsstruct pci_dev *pdev =to_pci_dev (device);if ((pdev->class >>8 ) ==PCI_CLASS_BRIDGE_ISA ) { - reg =iommu_alloc_resv_region (0 ,1UL <<24 ,0 , + reg =iommu_alloc_resv_region (0 ,1UL <<24 , prot,IOMMU_RESV_DIRECT_RELAXABLE );if (reg)list_add_tail (®->list, head);
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Greg Kroah-Hartman
maintainerPATCH 372/434 can: xilinx_can: Fix missing Rx can packets on CANFD2.0
In reply to Greg Kroah-HartmanFrom: Srinivas Neeli <[email protected]>
commit 9ab79b06ddf3cdf6484d60b3e5fe113e733145c8 upstream.
CANFD2.0 core uses BRAM for storing acceptance filter ID(AFID) and MASK (AFMASK)registers. So by default AFID and AFMASK registers contain random data. Due to random data, we are not able to receive all CAN ids.
Initializing AFID and AFMASK registers with Zero before enabling acceptance filter to receive all packets irrespective of ID and Mask.
--- drivers/net/can/xilinx_can.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/can/xilinx_can.c +7 -0
@@ -60,6 +60,8 @@ enum xcan_reg {XCAN_TXMSG_BASE_OFFSET =0x0100 ,/* TX Message Space */ XCAN_RXMSG_BASE_OFFSET =0x1100 ,/* RX Message Space */ XCAN_RXMSG_2_BASE_OFFSET =0x2100 ,/* RX Message Space */ +XCAN_AFR_2_MASK_OFFSET =0x0A00 ,/* Acceptance Filter MASK */ + XCAN_AFR_2_ID_OFFSET = 0x0A04, /* Acceptance Filter ID */ };#define XCAN_FRAME_ID_OFFSET (frame_base) ((frame_base) + 0x00)
@@ -1803,6 +1805,11 @@ static int xcan_probe(struct platform_depm_runtime_put (&pdev->dev); +if (priv->devtype.flags &XCAN_FLAG_CANFD_2 ) { + priv->write_reg (priv,XCAN_AFR_2_ID_OFFSET ,0x00000000 ); + priv->write_reg (priv,XCAN_AFR_2_MASK_OFFSET ,0x00000000 ); + } +netdev_dbg (ndev,"reg_base=0x%p irq=%d clock=%d, tx buffers: actual %d, using %d\n" , priv->reg_base, ndev->irq, priv->can.clock.freq, hw_tx_max, priv->tx_max);
Greg Kroah-Hartman
maintainerPATCH 373/434 can: m_can: tcan4x5x: add required delay after reset
In reply to Greg Kroah-HartmanFrom: Sean Nyekjaer <[email protected]>
commit 60552253e29c8860ee5bf1e6064591b0917c0394 upstream.
According to section "8.3.8 RST Pin" in the datasheet we are required to wait >700us after the device is reset.
--- drivers/net/can/m_can/tcan4x5x.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/can/m_can/tcan4x5x.c +2 -0
@@ -354,6 +354,8 @@ static int tcan4x5x_parse_config(structif (IS_ERR (tcan4x5x->reset_gpio)) tcan4x5x->reset_gpio =NULL ; +usleep_range (700 ,1000 ); + tcan4x5x->device_state_gpio =devm_gpiod_get_optional (cdev->dev,"device-state" ,GPIOD_IN );
Greg Kroah-Hartman
maintainerPATCH 374/434 can: j1939: j1939_sk_bind(): take priv after lock is held
In reply to Greg Kroah-HartmanFrom: Oleksij Rempel <[email protected]>
commit 00d4e14d2e4caf5f7254a505fee5eeca8cd37bd4 upstream.
syzbot reproduced following crash:
===============================================================================
kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] PREEMPT SMP KASAN CPU: 0 PID: 9844 Comm: syz-executor.0 Not tainted 5.4.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:__lock_acquire+0x1254/0x4a00 kernel/locking/lockdep.c:3828 Code: 00 0f 85 96 24 00 00 48 81 c4 f0 00 00 00 5b 41 5c 41 5d 41 5e 41 5f 5d c3 48 b8 00 00 00 00 00 fc ff df 4c 89 f2 48 c1 ea 03 <80> 3c 02 00 0f 85 0b 28 00 00 49 81 3e 20 19 78 8a 0f 84 5f ee ff RSP: 0018:ffff888099c3fb48 EFLAGS: 00010006 RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 0000000000000000 RDX: 0000000000000218 RSI: 0000000000000000 RDI: 0000000000000001 RBP: ffff888099c3fc60 R08: 0000000000000001 R09: 0000000000000001 R10: fffffbfff146e1d0 R11: ffff888098720400 R12: 00000000000010c0 R13: 0000000000000000 R14: 00000000000010c0 R15: 0000000000000000 FS: 00007f0559e98700(0000) GS:ffff8880ae800000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fe4d89e0000 CR3: 0000000099606000 CR4: 00000000001406f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: lock_acquire+0x190/0x410 kernel/locking/lockdep.c:4485 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline] _raw_spin_lock_bh+0x33/0x50 kernel/locking/spinlock.c:175 spin_lock_bh include/linux/spinlock.h:343 [inline] j1939_jsk_del+0x32/0x210 net/can/j1939/socket.c:89 j1939_sk_bind+0x2ea/0x8f0 net/can/j1939/socket.c:448 __sys_bind+0x239/0x290 net/socket.c:1648 __do_sys_bind net/socket.c:1659 [inline] __se_sys_bind net/socket.c:1657 [inline] __x64_sys_bind+0x73/0xb0 net/socket.c:1657 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x45a679 Code: ad b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89
f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f0559e97c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000031
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 000000000045a679
RDX: 0000000000000018 RSI: 0000000020000240 RDI: 0000000000000003
RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f0559e986d4
R13: 00000000004c09e9 R14: 00000000004d37d0 R15: 00000000ffffffff
Modules linked in: ------------[ cut here ]------------ WARNING: CPU: 0 PID: 9844 at kernel/locking/mutex.c:1419 mutex_trylock+0x279/0x2f0 kernel/locking/mutex.c:1427 ===============================================================================
This issues was caused by null pointer deference. Where j1939_sk_bind() was using currently not existing priv.
Possible scenario may look as following:
cpu0 cpu1bind()
bind()
j1939_sk_bind()
j1939_sk_bind()
priv = jsk->priv;
priv = jsk->priv;
lock_sock(sock->sk);
priv = j1939_netdev_start(ndev);
j1939_jsk_add(priv, jsk);
jsk->priv = priv;
relase_sock(sock->sk);
lock_sock(sock->sk);
j1939_jsk_del(priv, jsk);
..... ooops ......With this patch we move "priv = jsk->priv;" after the lock, to avoid assigning of wrong priv pointer.
--- net/can/j1939/socket.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
net/can/j1939/socket.c +7 -3
@@ -423,9 +423,9 @@ static int j1939_sk_bind(struct socket * {struct sockaddr_can *addr = (struct sockaddr_can *)uaddr;struct j1939_sock *jsk =j1939_sk (sock->sk); -struct j1939_priv *priv = jsk->priv; -struct sock *sk = sock->sk; -struct net *net =sock_net (sk); +struct j1939_priv *priv; +struct sock *sk; +struct net *net;int ret =0 ; ret =j1939_sk_sanity_check (addr, len);
@@ -434,6 +434,10 @@ static int j1939_sk_bind(struct socket *lock_sock (sock->sk); + priv = jsk->priv; + sk = sock->sk; + net =sock_net (sk); +/* Already bound to an interface? */ if (jsk->state &J1939_SOCK_BOUND ) {/* A re-bind() to a different interface is not
Greg Kroah-Hartman
maintainerPATCH 375/434 can: flexcan: fix possible deadlock and out-of-order reception after wakeup
In reply to Greg Kroah-HartmanFrom: Sean Nyekjaer <[email protected]>
commit e707180ae2df1c87e26ec7a6fd70d07483bde7fd upstream.
When suspending, and there is still CAN traffic on the interfaces the flexcan immediately wakes the platform again. As it should :-). But it throws this error msg:
[ 3169.378661] PM: noirq suspend of devices failed
On the way down to suspend the interface that throws the error message calls flexcan_suspend() but fails to call flexcan_noirq_suspend(). That means flexcan_enter_stop_mode() is called, but on the way out of suspend the driver only calls flexcan_resume() and skips flexcan_noirq_resume(), thus it doesn't call flexcan_exit_stop_mode(). This leaves the flexcan in stop mode, and with the current driver it can't recover from this even with a soft reboot, it requires a hard reboot.
This patch fixes the deadlock when using self wakeup, by calling flexcan_exit_stop_mode() from flexcan_resume() instead of flexcan_noirq_resume().
This also fixes another issue: CAN frames are received out-of-order in first IRQ handler run after wakeup.
The problem is that the wakeup latency from frame reception to the IRQ handler (where the CAN frames are sorted by timestamp) is much bigger than the time stamp counter wrap around time. This means it's impossible to sort the CAN frames by timestamp.
The reason is that the controller exits stop mode during noirq resume, which means it receives frames immediately, but interrupt handling is still not possible.
So exit stop mode during resume stage instead of noirq resume fixes this issue.
--- drivers/net/can/flexcan.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/net/can/flexcan.c +4 -6
@@ -1703,6 +1703,9 @@ static int __maybe_unused flexcan_resumenetif_start_queue (dev);if (device_may_wakeup (device)) {disable_irq_wake (dev->irq); + err =flexcan_exit_stop_mode (priv); +if (err) +return err; }else { err =pm_runtime_force_resume (device);if (err)
@@ -1748,14 +1751,9 @@ static int __maybe_unused flexcan_noirq_ {struct net_device *dev =dev_get_drvdata (device);struct flexcan_priv *priv =netdev_priv (dev); -int err; -if (netif_running (dev) &&device_may_wakeup (device)) { +if (netif_running (dev) &&device_may_wakeup (device))flexcan_enable_wakeup_irq (priv, false); - err =flexcan_exit_stop_mode (priv); -if (err) -return err; - }return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 376/434 can: flexcan: poll MCR_LPM_ACK instead of GPR ACK for stop mode acknowledgment
In reply to Greg Kroah-HartmanFrom: Joakim Zhang <[email protected]>
commit 048e3a34a2e7669bf475eb56c7345ad9d8d2b8e3 upstream.
Stop Mode is entered when Stop Mode is requested at chip level and MCR[LPM_ACK] is asserted by the FlexCAN.
Double check with IP owner, the MCR[LPM_ACK] bit should be polled for stop mode acknowledgment, not the acknowledgment from chip level which is used to gate flexcan clocks.
This patch depends on:
b7603d080ffc ("can: flexcan: add low power enter/exit acknowledgment helper")
--- drivers/net/can/flexcan.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-)
drivers/net/can/flexcan.c +2 -15
@@ -407,7 +407,6 @@ static void flexcan_enable_wakeup_irq(ststatic inline int flexcan_enter_stop_mode (struct flexcan_priv *priv) {struct flexcan_regs __iomem *regs = priv->regs; -unsigned int ackval;u32 reg_mcr; reg_mcr = priv->read (®s->mcr);
@@ -418,36 +417,24 @@ static inline int flexcan_enter_stop_modregmap_update_bits (priv->stm.gpr, priv->stm.req_gpr,1 << priv->stm.req_bit,1 << priv->stm.req_bit); -/* get stop acknowledgment */ -if (regmap_read_poll_timeout (priv->stm.gpr, priv->stm.ack_gpr, - ackval, ackval & (1 << priv->stm.ack_bit), -0 ,FLEXCAN_TIMEOUT_US )) -return -ETIMEDOUT ; - -return 0 ; +return flexcan_low_power_enter_ack (priv); }static inline int flexcan_exit_stop_mode (struct flexcan_priv *priv) {struct flexcan_regs __iomem *regs = priv->regs; -unsigned int ackval;u32 reg_mcr;/* remove stop request */ regmap_update_bits (priv->stm.gpr, priv->stm.req_gpr,1 << priv->stm.req_bit,0 ); -/* get stop acknowledgment */ -if (regmap_read_poll_timeout (priv->stm.gpr, priv->stm.ack_gpr, - ackval, !(ackval & (1 << priv->stm.ack_bit)), -0 ,FLEXCAN_TIMEOUT_US )) -return -ETIMEDOUT ; reg_mcr = priv->read (®s->mcr); reg_mcr &= ~FLEXCAN_MCR_SLF_WAK ; priv->write (reg_mcr, ®s->mcr); -return 0 ; +return flexcan_low_power_exit_ack (priv); }static inline void flexcan_error_irq_enable (const struct flexcan_priv *priv)
Greg Kroah-Hartman
maintainerPATCH 377/434 can: kvaser_usb: kvaser_usb_leaf: Fix some info-leaks to USB devices
In reply to Greg Kroah-HartmanFrom: Xiaolong Huang <[email protected]>
commit da2311a6385c3b499da2ed5d9be59ce331fa93e9 upstream.
Uninitialized Kernel memory can leak to USB devices.
Fix this by using kzalloc() instead of kmalloc().
--- drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +3 -3
@@ -608,7 +608,7 @@ static int kvaser_usb_leaf_simple_cmd_asstruct kvaser_cmd *cmd;int err; - cmd =kmalloc (sizeof (*cmd),GFP_ATOMIC ); + cmd =kzalloc (sizeof (*cmd),GFP_ATOMIC );if (!cmd)return -ENOMEM ;
@@ -1140,7 +1140,7 @@ static int kvaser_usb_leaf_set_opt_mode(struct kvaser_cmd *cmd;int rc; - cmd =kmalloc (sizeof (*cmd),GFP_KERNEL ); + cmd =kzalloc (sizeof (*cmd),GFP_KERNEL );if (!cmd)return -ENOMEM ;
@@ -1206,7 +1206,7 @@ static int kvaser_usb_leaf_flush_queue(sstruct kvaser_cmd *cmd;int rc; - cmd =kmalloc (sizeof (*cmd),GFP_KERNEL ); + cmd =kzalloc (sizeof (*cmd),GFP_KERNEL );if (!cmd)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 378/434 selftests: net: tls: remove recv_rcvbuf test
In reply to Greg Kroah-HartmanFrom: Thadeu Lima de Souza Cascardo <[email protected]>
[ Upstream commit 6dd504b0fd1039c6e5d391e97cf5c4ee592aefcb ]
This test only works when [1] is applied, which was rejected.
Basically, the errors are reported and cleared. In this particular case of tls sockets, following reads will block.
The test case was originally submitted with the rejected patch, but, then, was included as part of a different patchset, possibly by mistake.
[1] https://lore.kernel.org/netdev/[email protected]/#t
Thanks Paolo Pisati for pointing out the original patchset where this appeared.
--- tools/testing/selftests/net/tls.c | 28 ---------------------------- 1 file changed, 28 deletions(-)
tools/testing/selftests/net/tls.c +0 -28
@@ -722,34 +722,6 @@ TEST_F(tls, recv_lowat)EXPECT_EQ (memcmp (send_mem, recv_mem +10 ,5 ),0 ); } -TEST_F(tls, recv_rcvbuf) -{ -char send_mem[4096 ]; -char recv_mem[4096 ]; -int rcv_buf =1024 ; - -memset (send_mem,0x1c ,sizeof (send_mem)); - -EXPECT_EQ (setsockopt (self->cfd,SOL_SOCKET ,SO_RCVBUF , - &rcv_buf,sizeof (rcv_buf)),0 ); - -EXPECT_EQ (send (self->fd, send_mem,512 ,0 ),512 ); -memset (recv_mem,0 ,sizeof (recv_mem)); -EXPECT_EQ (recv (self->cfd, recv_mem,sizeof (recv_mem),0 ),512 ); -EXPECT_EQ (memcmp (send_mem, recv_mem,512 ),0 ); - -if (self->notls) -return ; - -EXPECT_EQ (send (self->fd, send_mem,4096 ,0 ),4096 ); -memset (recv_mem,0 ,sizeof (recv_mem)); -EXPECT_EQ (recv (self->cfd, recv_mem,sizeof (recv_mem),0 ),-1 ); -EXPECT_EQ (errno,EMSGSIZE ); - -EXPECT_EQ (recv (self->cfd, recv_mem,sizeof (recv_mem),0 ),-1 ); -EXPECT_EQ (errno,EMSGSIZE ); -} - TEST_F(tls, bidir) {char const *test_str ="test_read" ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 379/434 spi: dw: Correct handling of native chipselect
In reply to Greg Kroah-HartmanFrom: Charles Keepax <[email protected]>
[ Upstream commit ada9e3fcc175db4538f5b5e05abf5dedf626e550 ]
This patch reverts commit 6e0a32d6f376 ("spi: dw: Fix default polarity of native chipselect").
The SPI framework always called the set_cs callback with the logic level it desired on the chip select line, which is what the drivers original handling supported. commit f3186dd87669 ("spi: Optionally use GPIO descriptors for CS GPIOs") changed these symantics, but only in the case of drivers that also support GPIO chip selects, to true meaning apply slave select rather than logic high. This left things in an odd state where a driver that only supports hardware chip selects, the core would handle polarity but if the driver supported GPIOs as well the driver should handle polarity. At this point the reverted change was applied to change the logic in the driver to match new system.
This was then broken by commit 3e5ec1db8bfe ("spi: Fix SPI_CS_HIGH setting when using native and GPIO CS") which reverted the core back to consistently calling set_cs with a logic level.
This fix reverts the driver code back to its original state to match the current core code. This is probably a better fix as a) the set_cs callback is always called with consistent symantics and b) the inversion for SPI_CS_HIGH can be handled in the core and doesn't need to be coded in each driver supporting it.
--- drivers/spi/spi-dw.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/spi/spi-dw.c +3 -2
@@ -129,10 +129,11 @@ void dw_spi_set_cs(struct spi_device *spi, bool enable)struct dw_spi *dws =spi_controller_get_devdata (spi->controller);struct chip_data *chip =spi_get_ctldata (spi); +/* Chip select logic is inverted from spi_set_cs() */ if (chip && chip->cs_control) - chip->cs_control (enable); + chip->cs_control (!enable); -if (enable) +if (!enable)dw_writel (dws,DW_SPI_SER ,BIT (spi->chip_select));else if (dws->cs_override)dw_writel (dws,DW_SPI_SER ,0 );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 380/434 spi: cadence: Correct handling of native chipselect
In reply to Greg Kroah-HartmanFrom: Charles Keepax <[email protected]>
[ Upstream commit 61acd19f9c56fa0809285346bd0bd4a926ab0da0 ]
To fix a regression on the Cadence SPI driver, this patch reverts commit 6046f5407ff0 ("spi: cadence: Fix default polarity of native chipselect").
This patch was not the correct fix for the issue. The SPI framework calls the set_cs line with the logic level it desires on the chip select line, as such the old is_high handling was correct. However, this was broken by the fact that before commit 3e5ec1db8bfe ("spi: Fix SPI_CS_HIGH setting when using native and GPIO CS") all controllers that offered the use of a GPIO chip select had SPI_CS_HIGH applied, even for hardware chip selects. This caused the value passed into the driver to be inverted. Which unfortunately makes it look like a logical enable the chip select value.
Since the core was corrected to not unconditionally apply SPI_CS_HIGH, the Cadence driver, whilst using the hardware chip select, will deselect the chip select every time we attempt to communicate with the device, which results in failed communications.
--- drivers/spi/spi-cadence.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/spi/spi-cadence.c +3 -3
@@ -168,16 +168,16 @@ static void cdns_spi_init_hw(struct cdns_spi *xspi)/** * cdns_spi_chipselect - Select or deselect the chip select line * @spi: Pointer to the spi_device structure -* @enable: Select (1) or deselect (0) the chip select line +* @is_high: Select(0) or deselect (1) the chip select line */ -static void cdns_spi_chipselect (struct spi_device *spi,bool enable) +static void cdns_spi_chipselect (struct spi_device *spi,bool is_high) {struct cdns_spi *xspi =spi_master_get_devdata (spi->master);u32 ctrl_reg; ctrl_reg =cdns_spi_read (xspi,CDNS_SPI_CR ); -if (!enable) { +if (is_high) {/* Deselect the slave */ ctrl_reg |=CDNS_SPI_CR_SSCTRL ; }else {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 381/434 usb: xhci: Fix build warning seen with CONFIG_PM=n
In reply to Greg Kroah-HartmanFrom: Guenter Roeck <[email protected]>
[ Upstream commit 6056a0f8ede27b296d10ef46f7f677cc9d715371 ]
The following build warning is seen if CONFIG_PM is disabled.
drivers/usb/host/xhci-pci.c:498:13: warning:
unused function 'xhci_pci_shutdown'
--- drivers/usb/host/xhci-pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci-pci.c +1 -1
@@ -519,7 +519,6 @@ static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated) retval =xhci_resume (xhci, hibernated);return retval; } -#endif /* CONFIG_PM */ static void xhci_pci_shutdown (struct usb_hcd *hcd) {
@@ -532,6 +531,7 @@ static void xhci_pci_shutdown(struct usb_hcd *hcd)if (xhci->quirks &XHCI_SPURIOUS_WAKEUP ) pci_set_power_state(pdev, PCI_D3hot); } +#endif /* CONFIG_PM */ /*-------------------------------------------------------------------------*/
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 382/434 drm/amdgpu: fix uninitialized variable pasid_mapping_needed
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 17cf678a33c6196a3df4531fe5aec91384c9eeb5 ]
The boolean variable pasid_mapping_needed is not initialized and there are code paths that do not assign it any value before it is is read later. Fix this by initializing pasid_mapping_needed to false.
Addresses-Coverity: ("Uninitialized scalar variable")
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
@@ -1035,7 +1035,7 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job, bool need_ id->oa_size != job->oa_size);bool vm_flush_needed = job->vm_needs_flush;struct dma_fence *fence =NULL ; -bool pasid_mapping_needed; +bool pasid_mapping_needed = false;unsigned patch_offset =0 ;int r;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 383/434 ath10k: Revert "ath10k: add cleanup in ath10k_sta_state()"
In reply to Greg Kroah-HartmanFrom: Bjorn Andersson <[email protected]>
[ Upstream commit f4fe2e53349f1072d33c69f484dbf9d77bb8f45a ]
This reverts commit 334f5b61a6f29834e881923b98d1e27e5ce9620d.
This caused ath10k_snoc on Qualcomm MSM8998, SDM845 and QCS404 platforms to trigger an assert in the firmware:
err_qdi.c:456:EF:wlan_process:1:cmnos_thread.c:3900:Asserted in wlan_vdev.c:_wlan_vdev_up:3219
Revert the offending commit for now.
--- drivers/net/wireless/ath/ath10k/mac.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/net/wireless/ath/ath10k/mac.c +1 -5
@@ -6551,12 +6551,8 @@ static int ath10k_sta_state(struct ieee80211_hw *hw,spin_unlock_bh (&ar->data_lock); -if (!sta->tdls) { -ath10k_peer_delete (ar, arvif->vdev_id, sta->addr); -ath10k_mac_dec_num_stations (arvif, sta); -kfree (arsta->tx_stats); +if (!sta->tdls) goto exit; - } ret =ath10k_wmi_update_fw_tdls_state (ar, arvif->vdev_id,WMI_TDLS_ENABLE_ACTIVE );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 384/434 RDMA/siw: Fix post_recv QP state locking
In reply to Greg Kroah-HartmanFrom: Bernard Metzler <[email protected]>
[ Upstream commit 0edefddbae396e50eb7887d279d0c4bb4d7a6384 ]
Do not release qp state lock if not previously acquired.
--- drivers/infiniband/sw/siw/siw_verbs.c | 1 - 1 file changed, 1 deletion(-)
drivers/infiniband/sw/siw/siw_verbs.c +0 -1
@@ -988,7 +988,6 @@ int siw_post_receive(struct ib_qp *base_qp, const struct ib_recv_wr *wr, }if (!qp->kernel_verbs) {siw_dbg_qp (qp,"no kernel post_recv for user mapped sq\n" ); -up_read (&qp->state_lock); *bad_wr = wr;return -EINVAL ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 385/434 md: avoid invalid memory access for array sb->dev_roles
In reply to Greg Kroah-HartmanFrom: Yufen Yu <[email protected]>
[ Upstream commit 228fc7d76db68732677230a3c64337908fd298e3 ]
we need to gurantee 'desc_nr' valid before access array of sb->dev_roles.
In addition, we should avoid .load_super always return '0' when level is LEVEL_MULTIPATH, which is not expected.
Addresses-Coverity-ID: 1487373 ("Memory - illegal accesses")
--- drivers/md/md.c | 51 +++++++++++++++++++------------------------------ 1 file changed, 20 insertions(+), 31 deletions(-)
drivers/md/md.c +20 -31
@@ -1105,6 +1105,7 @@ static int super_90_load(struct md_rdev *rdev, struct md_rdev *refdev, int minorchar b[BDEVNAME_SIZE ], b2[BDEVNAME_SIZE ];mdp_super_t *sb;int ret; +bool spare_disk = true;/* * Calculate the position of the superblock (512byte sectors),
@@ -1155,13 +1156,15 @@ static int super_90_load(struct md_rdev *rdev, struct md_rdev *refdev, int minorelse rdev->desc_nr = sb->this_disk.number; +/* not spare disk, or LEVEL_MULTIPATH */ +if (sb->level ==LEVEL_MULTIPATH || + (rdev->desc_nr >=0 && + sb->disks[rdev->desc_nr].state & + ((1 <<MD_DISK_SYNC ) | (1 <<MD_DISK_ACTIVE )))) + spare_disk = false; +if (!refdev) { -/* -* Insist on good event counter while assembling, except -* for spares (which don't need an event count) -*/ -if (sb->disks[rdev->desc_nr].state & ( - (1 <<MD_DISK_SYNC ) | (1 <<MD_DISK_ACTIVE ))) +if (!spare_disk) ret =1 ;else ret =0 ;
@@ -1181,13 +1184,7 @@ static int super_90_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor ev1 =md_event (sb); ev2 =md_event (refsb); -/* -* Insist on good event counter while assembling, except -* for spares (which don't need an event count) -*/ -if (sb->disks[rdev->desc_nr].state & ( - (1 <<MD_DISK_SYNC ) | (1 <<MD_DISK_ACTIVE )) && - (ev1 > ev2)) +if (!spare_disk && ev1 > ev2) ret =1 ;else ret =0 ;
@@ -1547,7 +1544,7 @@ static int super_1_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor_sector_t sectors;char b[BDEVNAME_SIZE ], b2[BDEVNAME_SIZE ];int bmask; -__u64 role; +bool spare_disk = true;/* * Calculate the position of the superblock in 512byte sectors.
@@ -1681,17 +1678,16 @@ static int super_1_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor_ sb->level != 0)return -EINVAL ; - role =le16_to_cpu (sb->dev_roles[rdev->desc_nr]); +/* not spare disk, or LEVEL_MULTIPATH */ +if (sb->level ==cpu_to_le32 (LEVEL_MULTIPATH ) || + (rdev->desc_nr >=0 && + rdev->desc_nr <le32_to_cpu (sb->max_dev) && + (le16_to_cpu (sb->dev_roles[rdev->desc_nr]) <MD_DISK_ROLE_MAX || +le16_to_cpu (sb->dev_roles[rdev->desc_nr]) ==MD_DISK_ROLE_JOURNAL ))) + spare_disk = false;if (!refdev) { -/* -* Insist of good event counter while assembling, except for -* spares (which don't need an event count) -*/ -if (rdev->desc_nr >=0 && - rdev->desc_nr <le32_to_cpu (sb->max_dev) && - (role <MD_DISK_ROLE_MAX || - role ==MD_DISK_ROLE_JOURNAL )) +if (!spare_disk) ret =1 ;else ret =0 ;
@@ -1711,14 +1707,7 @@ static int super_1_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor_ ev1 =le64_to_cpu (sb->events); ev2 =le64_to_cpu (refsb->events); -/* -* Insist of good event counter while assembling, except for -* spares (which don't need an event count) -*/ -if (rdev->desc_nr >=0 && - rdev->desc_nr <le32_to_cpu (sb->max_dev) && - (role <MD_DISK_ROLE_MAX || - role ==MD_DISK_ROLE_JOURNAL ) && ev1 > ev2) +if (!spare_disk && ev1 > ev2) ret =1 ;else ret =0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 386/434 s390/ftrace: fix endless recursion in function_graph tracer
In reply to Greg Kroah-HartmanFrom: Sven Schnelle <[email protected]>
[ Upstream commit 6feeee8efc53035c3195b02068b58ae947538aa4 ]
The following sequence triggers a kernel stack overflow on s390x:
mount -t tracefs tracefs /sys/kernel/tracing
cd /sys/kernel/tracing
echo function_graph > current_tracer
[crash]
This is because preempt_count_{add,sub} are in the list of traced functions, which can be demonstrated by:
echo preempt_count_add >set_ftrace_filter
echo function_graph > current_tracer
[crash]
The stack overflow happens because get_tod_clock_monotonic() gets called by ftrace but itself calls preempt_{disable,enable}(), which leads to a endless recursion. Fix this by using preempt_{disable,enable}_notrace().
--- arch/s390/include/asm/timex.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/s390/include/asm/timex.h +2 -2
@@ -195,9 +195,9 @@ static inline unsigned long long get_tod_clock_monotonic(void) {unsigned long long tod; -preempt_disable (); +preempt_disable_notrace (); tod =get_tod_clock () - *(unsigned long long *) &tod_clock_base[1 ]; -preempt_enable (); +preempt_enable_notrace ();return tod; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 387/434 ARM: dts: Fix vcsi regulator to be always-on for droid4 to prevent hangs
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit ddb52945999dcf35787bf221b62108806182578d ]
In addition to using vcsi regulator for the display, looks like droid4 is using vcsi regulator to trigger off mode internally with the PMIC firmware when the SoC enters deeper idle states. This is configured in the Motorola Mapphone Linux kernel sources as "zerov_regulator".
As we currently don't support off mode during idle for omap4, we must prevent vcsi from being disabled when the display is blanked to prevent the PMIC change to off mode. Otherwise the device will hang on entering idle when the display is blanked.
Before commit 089b3f61ecfc ("regulator: core: Let boot-on regulators be powered off"), the boot-on regulators never got disabled like they should and vcsi did not get turned off on idle.
Let's fix the issue by setting vcsi to always-on for now. Later on we may want to claim the vcsi regulator also in the PM code if needed.
--- arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi +2 -2
@@ -160,12 +160,12 @@ regulator-enable-ramp-delay = <1000>; }; - /* Used by DSS */ + /* Used by DSS and is the "zerov_regulator" trigger for SoC off mode */ vcsi: VCSI { regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>; regulator-enable-ramp-delay = <1000>; - regulator-boot-on; + regulator-always-on; }; vdac: VDAC {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 388/434 can: flexcan: add low power enter/exit acknowledgment helper
In reply to Greg Kroah-HartmanFrom: Joakim Zhang <[email protected]>
[ Upstream commit b7603d080ffcf8689ec91ca300caf84d8dbed317 ]
The MCR[LPMACK] read-only bit indicates that FlexCAN is in a lower-power mode (Disabled mode, Doze mode, Stop mode).
The CPU can poll this bit to know when FlexCAN has actually entered low power mode. The low power enter/exit acknowledgment helper will reduce code duplication for disabled mode, doze mode and stop mode.
--- drivers/net/can/flexcan.c | 46 +++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 16 deletions(-)
drivers/net/can/flexcan.c +30 -16
@@ -389,6 +389,34 @@ static struct flexcan_mb __iomem *flexcan_get_mb(const struct flexcan_priv *priv (&priv->regs->mb[bank][priv->mb_size * mb_index]); } +static int flexcan_low_power_enter_ack (struct flexcan_priv *priv) +{ +struct flexcan_regs __iomem *regs = priv->regs; +unsigned int timeout =FLEXCAN_TIMEOUT_US /10 ; + +while (timeout-- && !(priv->read (®s->mcr) &FLEXCAN_MCR_LPM_ACK )) +udelay (10 ); + +if (!(priv->read (®s->mcr) &FLEXCAN_MCR_LPM_ACK )) +return -ETIMEDOUT ; + +return 0 ; +} + +static int flexcan_low_power_exit_ack (struct flexcan_priv *priv) +{ +struct flexcan_regs __iomem *regs = priv->regs; +unsigned int timeout =FLEXCAN_TIMEOUT_US /10 ; + +while (timeout-- && (priv->read (®s->mcr) &FLEXCAN_MCR_LPM_ACK )) +udelay (10 ); + +if (priv->read (®s->mcr) &FLEXCAN_MCR_LPM_ACK ) +return -ETIMEDOUT ; + +return 0 ; +} +static void flexcan_enable_wakeup_irq (struct flexcan_priv *priv,bool enable) {struct flexcan_regs __iomem *regs = priv->regs;
@@ -493,39 +521,25 @@ static inline int flexcan_transceiver_disable(const struct flexcan_priv *priv)static int flexcan_chip_enable (struct flexcan_priv *priv) {struct flexcan_regs __iomem *regs = priv->regs; -unsigned int timeout =FLEXCAN_TIMEOUT_US /10 ;u32 reg; reg = priv->read (®s->mcr); reg &= ~FLEXCAN_MCR_MDIS ; priv->write (reg, ®s->mcr); -while (timeout-- && (priv->read (®s->mcr) &FLEXCAN_MCR_LPM_ACK )) -udelay (10 ); - -if (priv->read (®s->mcr) &FLEXCAN_MCR_LPM_ACK ) -return -ETIMEDOUT ; - -return 0 ; +return flexcan_low_power_exit_ack (priv); }static int flexcan_chip_disable (struct flexcan_priv *priv) {struct flexcan_regs __iomem *regs = priv->regs; -unsigned int timeout =FLEXCAN_TIMEOUT_US /10 ;u32 reg; reg = priv->read (®s->mcr); reg |=FLEXCAN_MCR_MDIS ; priv->write (reg, ®s->mcr); -while (timeout-- && !(priv->read (®s->mcr) &FLEXCAN_MCR_LPM_ACK )) -udelay (10 ); - -if (!(priv->read (®s->mcr) &FLEXCAN_MCR_LPM_ACK )) -return -ETIMEDOUT ; - -return 0 ; +return flexcan_low_power_enter_ack (priv); }static int flexcan_chip_freeze (struct flexcan_priv *priv)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 389/434 usbip: Fix receive error in vhci-hcd when using scatter-gather
In reply to Greg Kroah-HartmanFrom: Suwan Kim <[email protected]>
commit d986294ee55d719562b20aabe15a39bf8f863415 upstream.
When vhci uses SG and receives data whose size is smaller than SG buffer size, it tries to receive more data even if it acutally receives all the data from the server. If then, it erroneously adds error event and triggers connection shutdown.
vhci-hcd should check if it received all the data even if there are more SG entries left. So, check if it receivces all the data from the server in for_each_sg() loop.
--- drivers/usb/usbip/usbip_common.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/usbip/usbip_common.c +3 -0
@@ -727,6 +727,9 @@ int usbip_recv_xbuff(struct usbip_device copy -= recv; ret += recv; + +if (!copy) +break ; }if (ret != size)
Greg Kroah-Hartman
maintainerPATCH 390/434 usbip: Fix error path of vhci_recv_ret_submit()
In reply to Greg Kroah-HartmanFrom: Suwan Kim <[email protected]>
commit aabb5b833872524eaf28f52187e5987984982264 upstream.
If a transaction error happens in vhci_recv_ret_submit(), event handler closes connection and changes port status to kick hub_event. Then hub tries to flush the endpoint URBs, but that causes infinite loop between usb_hub_flush_endpoint() and vhci_urb_dequeue() because "vhci_priv" in vhci_urb_dequeue() was already released by vhci_recv_ret_submit() before a transmission error occurred. Thus, vhci_urb_dequeue() terminates early and usb_hub_flush_endpoint() continuously calls vhci_urb_dequeue().
The root cause of this issue is that vhci_recv_ret_submit() terminates early without giving back URB when transaction error occurs in vhci_recv_ret_submit(). That causes the error URB to still be linked at endpoint list without “vhci_priv".
So, in the case of transaction error in vhci_recv_ret_submit(), unlink URB from the endpoint, insert proper error code in urb->status and give back URB.
--- drivers/usb/usbip/vhci_rx.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/usb/usbip/vhci_rx.c +9 -4
@@ -77,16 +77,21 @@ static void vhci_recv_ret_submit(structusbip_pack_pdu (pdu, urb,USBIP_RET_SUBMIT ,0 );/* recv transfer buffer */ -if (usbip_recv_xbuff (ud, urb) <0 ) -return ; +if (usbip_recv_xbuff (ud, urb) <0 ) { + urb->status = -EPROTO ; + goto error; + }/* recv iso_packet_descriptor */ -if (usbip_recv_iso (ud, urb) <0 ) -return ; +if (usbip_recv_iso (ud, urb) <0 ) { + urb->status = -EPROTO ; + goto error; + }/* restore the padding in iso packets */ usbip_pad_iso (ud, urb); +error:if (usbip_dbg_flag_vhci_rx)usbip_dump_urb (urb);
Greg Kroah-Hartman
maintainerPATCH 391/434 spi: fsl: dont map irq during probe
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
commit 3194d2533efffae8b815d84729ecc58b6a9000ab upstream.
With lastest kernel, the following warning is observed at startup:
[ 1.500609] ------------[ cut here ]------------ [ 1.505225] remove_proc_entry: removing non-empty directory 'irq/22', leaking at least 'fsl_spi' [ 1.514234] WARNING: CPU: 0 PID: 1 at fs/proc/generic.c:682 remove_proc_entry+0x198/0x1c0 [ 1.522403] CPU: 0 PID: 1 Comm: swapper Not tainted 5.4.0-s3k-dev-02248-g93532430a4ff #2564 [ 1.530724] NIP: c0197694 LR: c0197694 CTR: c0050d80 [ 1.535762] REGS: df4a5af0 TRAP: 0700 Not tainted (5.4.0-02248-g93532430a4ff) [ 1.543818] MSR: 00029032 <EE,ME,IR,DR,RI> CR: 22028222 XER: 00000000 [ 1.550524] [ 1.550524] GPR00: c0197694 df4a5ba8 df4a0000 00000054 00000000 00000000 00004a38 00000010 [ 1.550524] GPR08: c07c5a30 00000800 00000000 00001032 22000208 00000000 c0004b14 00000000 [ 1.550524] GPR16: 00000000 00000000 00000000 00000000 00000000 00000000 c0830000 c07fc078 [ 1.550524] GPR24: c08e8ca0 df665d10 df60ea98 c07c9db8 00000001 df5d5ae3 df5d5a80 df43f8e3 [ 1.585327] NIP [c0197694] remove_proc_entry+0x198/0x1c0 [ 1.590628] LR [c0197694] remove_proc_entry+0x198/0x1c0 [ 1.595829] Call Trace: [ 1.598280] [df4a5ba8] [c0197694] remove_proc_entry+0x198/0x1c0 (unreliable) [ 1.605321] [df4a5bd8] [c0067acc] unregister_irq_proc+0x5c/0x70 [ 1.611238] [df4a5bf8] [c005fbc4] free_desc+0x3c/0x80 [ 1.616286] [df4a5c18] [c005fe2c] irq_free_descs+0x70/0xa8 [ 1.621778] [df4a5c38] [c033d3fc] of_fsl_spi_probe+0xdc/0x3cc [ 1.627525] [df4a5c88] [c02f0f64] platform_drv_probe+0x44/0xa4 [ 1.633350] [df4a5c98] [c02eee44] really_probe+0x1ac/0x418 [ 1.638829] [df4a5cc8] [c02ed3e8] bus_for_each_drv+0x64/0xb0 [ 1.644481] [df4a5cf8] [c02ef950] __device_attach+0xd4/0x128 [ 1.650132] [df4a5d28] [c02ed61c] bus_probe_device+0xa0/0xbc [ 1.655783] [df4a5d48] [c02ebbe8] device_add+0x544/0x74c [ 1.661096] [df4a5d88] [c0382b78] of_platform_device_create_pdata+0xa4/0x100 [ 1.668131] [df4a5da8] [c0382cf4] of_platform_bus_create+0x120/0x20c [ 1.674474] [df4a5df8] [c0382d50] of_platform_bus_create+0x17c/0x20c [ 1.680818] [df4a5e48] [c0382e88] of_platform_bus_probe+0x9c/0xf0 [ 1.686907] [df4a5e68] [c0751404] __machine_initcall_cmpcpro_cmpcpro_declare_of_platform_devices+0x74/0x1a4 [ 1.696629] [df4a5e98] [c072a4cc] do_one_initcall+0x8c/0x1d4 [ 1.702282] [df4a5ef8] [c072a768] kernel_init_freeable+0x154/0x204 [ 1.708455] [df4a5f28] [c0004b2c] kernel_init+0x18/0x110 [ 1.713769] [df4a5f38] [c00122ac] ret_from_kernel_thread+0x14/0x1c [ 1.719926] Instruction dump: [ 1.722889] 2c030000 4182004c 3863ffb0 3c80c05f 80e3005c 388436a0 3c60c06d 7fa6eb78 [ 1.730630] 7fe5fb78 38840280 38634178 4be8c611 <0fe00000> 4bffff6c 3c60c071 7fe4fb78 [ 1.738556] ---[ end trace 05d0720bf2e352e2 ]---
The problem comes from the error path which calls irq_dispose_mapping() while the IRQ has been requested with devm_request_irq().
IRQ doesn't need to be mapped with irq_of_parse_and_map(). The only need is to get the IRQ virtual number. For that, use of_irq_to_resource() instead of the irq_of_parse_and_map()/irq_dispose_mapping() pair.
--- drivers/spi/spi-fsl-spi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/spi/spi-fsl-spi.c +2 -3
@@ -736,8 +736,8 @@ static int of_fsl_spi_probe(struct platfif (ret) goto err; - irq =irq_of_parse_and_map (np,0 ); -if (!irq) { + irq =of_irq_to_resource (np,0 ,NULL ); +if (irq <=0 ) { ret = -EINVAL ; goto err; }
@@ -751,7 +751,6 @@ static int of_fsl_spi_probe(struct platfreturn 0 ; err: -irq_dispose_mapping (irq);return ret; }
Greg Kroah-Hartman
maintainerPATCH 392/434 spi: fsl: use platform_get_irq() instead of of_irq_to_resource()
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
commit 63aa6a692595d47a0785297b481072086b9272d2 upstream.
Unlike irq_of_parse_and_map() which has a dummy definition on SPARC, of_irq_to_resource() hasn't.
But as platform_get_irq() can be used instead and is generic, use it.
--- drivers/spi/spi-fsl-spi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/spi/spi-fsl-spi.c +3 -3
@@ -736,9 +736,9 @@ static int of_fsl_spi_probe(struct platfif (ret) goto err; - irq =of_irq_to_resource (np,0 ,NULL ); -if (irq <=0 ) { - ret = -EINVAL ; + irq =platform_get_irq (ofdev,0 ); +if (irq <0 ) { + ret = irq; goto err; }
Greg Kroah-Hartman
maintainerPATCH 393/434 efi/memreserve: Register reservations as reserved in /proc/iomem
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
commit ab0eb16205b43ece4c78e2259e681ff3d645ea66 upstream.
Memory regions that are reserved using efi_mem_reserve_persistent() are recorded in a special EFI config table which survives kexec, allowing the incoming kernel to honour them as well. However, such reservations are not visible in /proc/iomem, and so the kexec tools that load the incoming kernel and its initrd into memory may overwrite these reserved regions before the incoming kernel has a chance to reserve them from further use.
Address this problem by adding these reservations to /proc/iomem as they are created. Note that reservations that are inherited from a previous kernel are memblock_reserve()'d early on, so they are already visible in /proc/iomem.
--- drivers/firmware/efi/efi.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-)
drivers/firmware/efi/efi.c +26 -2
@@ -970,6 +970,24 @@ static int __init efi_memreserve_map_rooreturn 0 ; } +static int efi_mem_reserve_iomem (phys_addr_t addr,u64 size) +{ +struct resource *res, *parent; + + res =kzalloc (sizeof (struct resource ),GFP_ATOMIC ); +if (!res) +return -ENOMEM ; + + res->name ="reserved" ; + res->flags =IORESOURCE_MEM ; + res->start = addr; + res->end = addr + size -1 ; + +/* we expect a conflict with a 'System RAM' region */ + parent =request_resource_conflict (&iomem_resource, res); +return parent ?request_resource (parent, res) :0 ; +} +int __ref efi_mem_reserve_persistent (phys_addr_t addr,u64 size) {struct linux_efi_memreserve *rsv;
@@ -994,7 +1012,7 @@ int __ref efi_mem_reserve_persistent(phy rsv->entry[index].size = size;memunmap (rsv); -return 0 ; +return efi_mem_reserve_iomem (addr, size); }memunmap (rsv); }
@@ -1004,6 +1022,12 @@ int __ref efi_mem_reserve_persistent(phyif (!rsv)return -ENOMEM ; + rc =efi_mem_reserve_iomem (__pa (rsv),SZ_4K ); +if (rc) { +free_page ((unsigned long )rsv); +return rc; + } +/* * The memremap() call above assumes that a linux_efi_memreserve entry * never crosses a page boundary, so let's ensure that this remains true
@@ -1020,7 +1044,7 @@ int __ref efi_mem_reserve_persistent(phy efi_memreserve_root->next =__pa (rsv);spin_unlock (&efi_mem_reserve_persistent_lock); -return 0 ; +return efi_mem_reserve_iomem (addr, size); }static int __init efi_memreserve_root_init (void )
Greg Kroah-Hartman
maintainerPATCH 394/434 cpufreq: Avoid leaving stale IRQ work items during CPU offline
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
commit 85572c2c4a45a541e880e087b5b17a48198b2416 upstream.
The scheduler code calling cpufreq_update_util() may run during CPU offline on the target CPU after the IRQ work lists have been flushed for it, so the target CPU should be prevented from running code that may queue up an IRQ work item on it at that point.
Unfortunately, that may not be the case if dvfs_possible_from_any_cpu is set for at least one cpufreq policy in the system, because that allows the CPU going offline to run the utilization update callback of the cpufreq governor on behalf of another (online) CPU in some cases.
If that happens, the cpufreq governor callback may queue up an IRQ work on the CPU running it, which is going offline, and the IRQ work may not be flushed after that point. Moreover, that IRQ work cannot be flushed until the "offlining" CPU goes back online, so if any other CPU calls irq_work_sync() to wait for the completion of that IRQ work, it will have to wait until the "offlining" CPU is back online and that may not happen forever. In particular, a system-wide deadlock may occur during CPU online as a result of that.
The failing scenario is as follows. CPU0 is the boot CPU, so it creates a cpufreq policy and becomes the "leader" of it (policy->cpu). It cannot go offline, because it is the boot CPU. Next, other CPUs join the cpufreq policy as they go online and they leave it when they go offline. The last CPU to go offline, say CPU3, may queue up an IRQ work while running the governor callback on behalf of CPU0 after leaving the cpufreq policy because of the dvfs_possible_from_any_cpu effect described above. Then, CPU0 is the only online CPU in the system and the stale IRQ work is still queued on CPU3. When, say, CPU1 goes back online, it will run irq_work_sync() to wait for that IRQ work to complete and so it will wait for CPU3 to go back online (which may never happen even in principle), but (worse yet) CPU0 is waiting for CPU1 at that point too and a system-wide deadlock occurs.
To address this problem notice that CPUs which cannot run cpufreq utilization update code for themselves (for example, because they have left the cpufreq policies that they belonged to), should also be prevented from running that code on behalf of the other CPUs that belong to a cpufreq policy with dvfs_possible_from_any_cpu set and so in that case the cpufreq_update_util_data pointer of the CPU running the code must not be NULL as well as for the CPU which is the target of the cpufreq utilization update in progress.
Accordingly, change cpufreq_this_cpu_can_update() into a regular function in kernel/sched/cpufreq.c (instead of a static inline in a header file) and make it check the cpufreq_update_util_data pointer of the local CPU if dvfs_possible_from_any_cpu is set for the target cpufreq policy.
Also update the schedutil governor to do the cpufreq_this_cpu_can_update() check in the non-fast-switch case too to avoid the stale IRQ work issues.
--- include/linux/cpufreq.h | 11 ----------- include/linux/sched/cpufreq.h | 3 +++ kernel/sched/cpufreq.c | 18 ++++++++++++++++++ kernel/sched/cpufreq_schedutil.c | 8 +++----- 4 files changed, 24 insertions(+), 16 deletions(-)
include/linux/cpufreq.h +0 -11
@@ -595,17 +595,6 @@ struct governor_attr { size_t count); }; -static inline bool cpufreq_this_cpu_can_update (struct cpufreq_policy *policy) -{ -/* -* Allow remote callbacks if: -* - dvfs_possible_from_any_cpu flag is set -* - the local and remote CPUs share cpufreq policy -*/ -return policy->dvfs_possible_from_any_cpu || -cpumask_test_cpu (smp_processor_id (), policy->cpus); -} -/********************************************************************* * FREQUENCY TABLE HELPERS * *********************************************************************/
include/linux/sched/cpufreq.h +3 -0
@@ -12,6 +12,8 @@#define SCHED_CPUFREQ_MIGRATION (1U << 1)#ifdef CONFIG_CPU_FREQ +struct cpufreq_policy ; +struct update_util_data {void (*func)(struct update_util_data *data,u64 time,unsigned int flags); };
@@ -20,6 +22,7 @@ void cpufreq_add_update_util_hook(int cpvoid (*func)(struct update_util_data *data,u64 time, unsigned int flags));void cpufreq_remove_update_util_hook (int cpu); +bool cpufreq_this_cpu_can_update (struct cpufreq_policy *policy);static inline unsigned long map_util_freq (unsigned long util,unsigned long freq,unsigned long cap)
kernel/sched/cpufreq.c +18 -0
@@ -5,6 +5,8 @@* Copyright (C) 2016, Intel Corporation * Author: Rafael J. Wysocki <[email protected]> */ +#include <linux/cpufreq.h> +#include "sched.h" DEFINE_PER_CPU(struct update_util_data __rcu *, cpufreq_update_util_data);
@@ -57,3 +59,19 @@ void cpufreq_remove_update_util_hook(intrcu_assign_pointer (per_cpu (cpufreq_update_util_data, cpu),NULL ); }EXPORT_SYMBOL_GPL (cpufreq_remove_update_util_hook); + +/** +* cpufreq_this_cpu_can_update - Check if cpufreq policy can be updated. +* @policy: cpufreq policy to check. +* +* Return 'true' if: +* - the local and remote CPUs share @policy, +* - dvfs_possible_from_any_cpu is set in @policy and the local CPU is not going +* offline (in which case it is not expected to run cpufreq updates any more). +*/ +bool cpufreq_this_cpu_can_update (struct cpufreq_policy *policy) +{ +return cpumask_test_cpu (smp_processor_id (), policy->cpus) || + (policy->dvfs_possible_from_any_cpu && +rcu_dereference_sched (*this_cpu_ptr (&cpufreq_update_util_data))); +}
kernel/sched/cpufreq_schedutil.c +3 -5
@@ -82,12 +82,10 @@ static bool sugov_should_update_freq(str* by the hardware, as calculating the frequency is pointless if * we cannot in fact act on it. * -* For the slow switching platforms, the kthread is always scheduled on -* the right set of CPUs and any CPU can find the next frequency and -* schedule the kthread. +* This is needed on the slow switching platforms too to prevent CPUs +* going offline from leaving stale IRQ work items behind. */ -if (sg_policy->policy->fast_switch_enabled && - !cpufreq_this_cpu_can_update (sg_policy->policy)) +if (!cpufreq_this_cpu_can_update (sg_policy->policy))return false;if (unlikely (sg_policy->limits_changed)) {
Greg Kroah-Hartman
maintainerPATCH 395/434 KEYS: asymmetric: return ENOMEM if akcipher_request_alloc() fails
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
commit bea37414453eb08d4ceffeb60a9d490dbc930cea upstream.
No error code was being set on this error path.
--- crypto/asymmetric_keys/asym_tpm.c | 1 + crypto/asymmetric_keys/public_key.c | 1 + 2 files changed, 2 insertions(+)
crypto/asymmetric_keys/asym_tpm.c +1 -0
@@ -486,6 +486,7 @@ static int tpm_key_encrypt(struct tpm_keif (ret <0 ) goto error_free_tfm; + ret = -ENOMEM ; req =akcipher_request_alloc (tfm,GFP_KERNEL );if (!req) goto error_free_tfm;
crypto/asymmetric_keys/public_key.c +1 -0
@@ -184,6 +184,7 @@ static int software_key_eds_op(struct keif (IS_ERR (tfm))return PTR_ERR (tfm); + ret = -ENOMEM ; req =akcipher_request_alloc (tfm,GFP_KERNEL );if (!req) goto error_free_tfm;
Greg Kroah-Hartman
maintainerPATCH 396/434 mm: vmscan: protect shrinker idr replace with CONFIG_MEMCG
In reply to Greg Kroah-HartmanFrom: Yang Shi <[email protected]>
commit 42a9a53bb394a1de2247ef78f0b802ae86798122 upstream.
Since commit 0a432dcbeb32 ("mm: shrinker: make shrinker not depend on memcg kmem"), shrinkers' idr is protected by CONFIG_MEMCG instead of CONFIG_MEMCG_KMEM, so it makes no sense to protect shrinker idr replace with CONFIG_MEMCG_KMEM.
And in the CONFIG_MEMCG && CONFIG_SLOB case, shrinker_idr contains only shrinker, and it is deferred_split_shrinker. But it is never actually called, since idr_replace() is never compiled due to the wrong #ifdef. The deferred_split_shrinker all the time is staying in half-registered state, and it's never called for subordinate mem cgroups.
--- mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/vmscan.c +1 -1
@@ -422,7 +422,7 @@ void register_shrinker_prepared(struct s {down_write (&shrinker_rwsem);list_add_tail (&shrinker->list, &shrinker_list); -#ifdef CONFIG_MEMCG_KMEM +#ifdef CONFIG_MEMCG if (shrinker->flags &SHRINKER_MEMCG_AWARE )idr_replace (&shrinker_idr, shrinker, shrinker->id);#endif
Greg Kroah-Hartman
maintainerPATCH 397/434 USB: EHCI: Do not return -EPIPE when hub is disconnected
In reply to Greg Kroah-HartmanFrom: Erkka Talvitie <[email protected]>
commit 64cc3f12d1c7dd054a215bc1ff9cc2abcfe35832 upstream.
When disconnecting a USB hub that has some child device(s) connected to it (such as a USB mouse), then the stack tries to clear halt and reset device(s) which are _already_ physically disconnected.
The issue has been reproduced with:
CPU: IMX6D5EYM10AD or MCIMX6D5EYM10AE.
SW: U-Boot 2019.07 and kernel 4.19.40.
CPU: HP Proliant Microserver Gen8.
SW: Linux version 4.2.3-300.fc23.x86_64
In this situation there will be error bit for MMF active yet the CERR equals EHCI_TUNE_CERR + halt. Existing implementation interprets this as a stall [1] (chapter 8.4.5).
The possible conditions when the MMF will be active + halt can be found from [2] (Table 4-13).
Fix for the issue is to check whether MMF is active and PID Code is IN before checking for the stall. If these conditions are true then it is not a stall.
What happens after the fix is that when disconnecting a hub with attached device(s) the situation is not interpret as a stall.
[1] [https://www.usb.org/document-library/usb-20-specification, usb_20.pdf]
[2] [https://www.intel.com/content/dam/www/public/us/en/documents/
technical-specifications/ehci-specification-for-usb.pdf]
--- drivers/usb/host/ehci-q.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/usb/host/ehci-q.c +12 -1
@@ -27,6 +27,10 @@/*-------------------------------------------------------------------------*/ +/* PID Codes that are used here, from EHCI specification, Table 3-16. */ +#define PID_CODE_IN 1 +#define PID_CODE_SETUP 2 +/* fill a qtd, returning how much of the buffer we were able to queue up */ static int
@@ -190,7 +194,7 @@ static int qtd_copy_status (int status = -EINPROGRESS ;/* count IN/OUT bytes, not SETUP (even short packets) */ -if (likely (QTD_PID (token) !=2 )) +if (likely (QTD_PID (token) !=PID_CODE_SETUP )) urb->actual_length += length -QTD_LENGTH (token);/* don't modify error codes */
@@ -206,6 +210,13 @@ static int qtd_copy_status (if (token &QTD_STS_BABBLE ) {/* FIXME "must" disable babbling device's port too */ status = -EOVERFLOW ; +/* +* When MMF is active and PID Code is IN, queue is halted. +* EHCI Specification, Table 4-13. +*/ + }else if ((token &QTD_STS_MMF ) && + (QTD_PID (token) ==PID_CODE_IN )) { + status = -EPROTO ;/* CERR nonzero + halt --> stall */ }else if (QTD_CERR (token)) { status = -EPIPE ;
Greg Kroah-Hartman
maintainerPATCH 398/434 intel_th: pci: Add Comet Lake PCH-V support
In reply to Greg Kroah-HartmanFrom: Alexander Shishkin <[email protected]>
commit e4de2a5d51f97a6e720a1c0911f93e2d8c2f1c08 upstream.
This adds Intel(R) Trace Hub PCI ID for Comet Lake PCH-V.
--- drivers/hwtracing/intel_th/pci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/hwtracing/intel_th/pci.c +5 -0
@@ -205,6 +205,11 @@ static const struct pci_device_id intel_ .driver_data = (kernel_ulong_t)&intel_th_2x, }, { +/* Comet Lake PCH-V */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa3a6), + .driver_data = (kernel_ulong_t)&intel_th_2x, + }, + {/* Ice Lake NNPI */ PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0x45c5 ), .driver_data = (kernel_ulong_t)&intel_th_2x,
Greg Kroah-Hartman
maintainerPATCH 399/434 intel_th: pci: Add Elkhart Lake SOC support
In reply to Greg Kroah-HartmanFrom: Alexander Shishkin <[email protected]>
commit 88385866bab8d5e18c7f45d1023052c783572e03 upstream.
This adds support for Intel Trace Hub in Elkhart Lake.
--- drivers/hwtracing/intel_th/pci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/hwtracing/intel_th/pci.c +5 -0
@@ -234,6 +234,11 @@ static const struct pci_device_id intel_ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4da6), .driver_data = (kernel_ulong_t)&intel_th_2x, }, + { +/* Elkhart Lake */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4b26), + .driver_data = (kernel_ulong_t)&intel_th_2x, + }, { 0 }, };
Greg Kroah-Hartman
maintainerPATCH 400/434 intel_th: Fix freeing IRQs
In reply to Greg Kroah-HartmanFrom: Alexander Shishkin <[email protected]>
commit ab832e38e4f0f45b16c3633714d868b7ec6b33b4 upstream.
Commit aac8da65174a ("intel_th: msu: Start handling IRQs") implicitly relies on the use of devm_request_irq() to subsequently free the irqs on device removal, but in case of the pci_free_irq_vectors() API, the handlers need to be freed before it is called. Therefore, at the moment the driver's remove path trips a BUG_ON(irq_has_action()):
Quoted 18 lines
kernel BUG at
drivers/pci/msi.c:375!
invalid opcode: 0000 1 SMPCPU: 2 PID: 818 Comm: rmmod Not tainted 5.5.0-rc1+ #1 RIP: 0010:free_msi_irqs+0x67/0x1c0 pci_disable_msi+0x116/0x150 pci_free_irq_vectors+0x1b/0x20 intel_th_pci_remove+0x22/0x30 [intel_th_pci] pci_device_remove+0x3e/0xb0 device_release_driver_internal+0xf0/0x1c0 driver_detach+0x4c/0x8f bus_remove_driver+0x5c/0xd0 driver_unregister+0x31/0x50 pci_unregister_driver+0x40/0x90 intel_th_pci_driver_exit+0x10/0xad6 [intel_th_pci] __x64_sys_delete_module+0x147/0x290 ? exit_to_usermode_loop+0xd7/0x120 do_syscall_64+0x57/0x1b0 entry_SYSCALL_64_after_hwframe+0x44/0xa9
Fix this by explicitly freeing irqs before freeing the vectors. We keep using the devm_* variants because they are still useful in early error paths.
--- drivers/hwtracing/intel_th/core.c | 7 ++++--- drivers/hwtracing/intel_th/intel_th.h | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-)
drivers/hwtracing/intel_th/core.c +4 -3
@@ -834,9 +834,6 @@ static irqreturn_t intel_th_irq(int irq, ret |= d->irq (th->thdev[i]); } -if (ret ==IRQ_NONE ) -pr_warn_ratelimited ("nobody cared for irq\n" ); -return ret; }
@@ -887,6 +884,7 @@ intel_th_alloc(struct device *dev, strucif (th->irq ==-1 ) th->irq = devres[r].start; + th->num_irqs++;break ;default : dev_warn(dev, "Unknown resource type %lx\n",
@@ -940,6 +938,9 @@ void intel_th_free(struct intel_th *th) th->num_thdevs =0 ; +for (i =0 ; i < th->num_irqs; i++) +devm_free_irq (th->dev, th->irq + i, th); +pm_runtime_get_sync (th->dev);pm_runtime_forbid (th->dev);
drivers/hwtracing/intel_th/intel_th.h +2 -0
@@ -261,6 +261,7 @@ enum th_mmio_idx {* @num_thdevs: number of devices in the @thdev array * @num_resources: number of resources in the @resource array * @irq: irq number +* @num_irqs: number of IRQs is use * @id: this Intel TH controller's device ID in the system * @major: device node major for output devices */
@@ -277,6 +278,7 @@ struct intel_th {unsigned int num_thdevs;unsigned int num_resources;int irq; +int num_irqs;int id;int major;
Greg Kroah-Hartman
maintainerPATCH 401/434 intel_th: msu: Fix window switching without windows
In reply to Greg Kroah-HartmanFrom: Alexander Shishkin <[email protected]>
commit 05b686b573cfb35a227c30787083a6631ff0f0c9 upstream.
Commit 6cac7866c2741 ("intel_th: msu: Add a sysfs attribute to trigger window switch") adds a NULL pointer dereference in the case when there are no windows allocated:
Quoted 10 lines
BUG: kernel NULL pointer dereference, address: 0000000000000000 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 0 P4D 0 Oops: 0000 1 SMP CPU: 5 PID: 1110 Comm: bash Not tainted 5.5.0-rc1+ #1 RIP: 0010:msc_win_switch+0xa/0x80 [intel_th_msu] Call Trace: ? win_switch_store+0x9b/0xc0 [intel_th_msu] dev_attr_store+0x17/0x30
Quoted 8 lines
sysfs_kf_write+0x3e/0x50 kernfs_fop_write+0xda/0x1b0 __vfs_write+0x1b/0x40 vfs_write+0xb9/0x1a0 ksys_write+0x67/0xe0 __x64_sys_write+0x1a/0x20 do_syscall_64+0x57/0x1d0 entry_SYSCALL_64_after_hwframe+0x44/0xa9
Fix that by disallowing window switching with multiwindow buffers without windows.
--- drivers/hwtracing/intel_th/msu.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/hwtracing/intel_th/msu.c +9 -5
@@ -1676,10 +1676,13 @@ static int intel_th_msc_init(struct mscreturn 0 ; } -static void msc_win_switch (struct msc *msc) +static int msc_win_switch (struct msc *msc) {struct msc_window *first; +if (list_empty (&msc->win_list)) +return -EINVAL ; + first = list_first_entry(&msc->win_list, struct msc_window, entry);if (msc_is_last_win (msc->cur_win))
@@ -1691,6 +1694,8 @@ static void msc_win_switch(struct msc *m msc->base_addr =msc_win_base_dma (msc->cur_win);intel_th_trace_switch (msc->thdev); + +return 0 ; }/**
@@ -2025,16 +2030,15 @@ win_switch_store(struct device *dev, strif (val !=1 )return -EINVAL ; + ret = -EINVAL ;mutex_lock (&msc->buf_mutex);/* * Window switch can only happen in the "multi" mode. * If a external buffer is engaged, they have the full * control over window switching. */ -if (msc->mode !=MSC_MODE_MULTI || msc->mbuf) - ret = -ENOTSUPP ; -else -msc_win_switch (msc); +if (msc->mode ==MSC_MODE_MULTI && !msc->mbuf) + ret =msc_win_switch (msc);mutex_unlock (&msc->buf_mutex);return ret ? ret : size;
Greg Kroah-Hartman
maintainerPATCH 402/434 platform/x86: hp-wmi: Make buffer for HPWMI_FEATURE2_QUERY 128 bytes
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
commit 133b2acee3871ae6bf123b8fe34be14464aa3d2c upstream.
At least on the HP Envy x360 15-cp0xxx model the WMI interface for HPWMI_FEATURE2_QUERY requires an outsize of at least 128 bytes, otherwise it fails with an error code 5 (HPWMI_RET_INVALID_PARAMETERS):
Dec 06 00:59:38 kernel: hp_wmi: query 0xd returned error 0x5
We do not care about the contents of the buffer, we just want to know if the HPWMI_FEATURE2_QUERY command is supported.
This commits bumps the buffer size, fixing the error.
--- drivers/platform/x86/hp-wmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/hp-wmi.c +1 -1
@@ -300,7 +300,7 @@ static int __init hp_wmi_bios_2008_laterstatic int __init hp_wmi_bios_2009_later (void ) { -int state =0 ; +u8 state[128 ];int ret =hp_wmi_perform_query (HPWMI_FEATURE2_QUERY ,HPWMI_READ , &state,sizeof (state),sizeof (state));if (!ret)
Greg Kroah-Hartman
maintainerPATCH 403/434 staging: comedi: gsc_hpdi: check dma_alloc_coherent() return value
In reply to Greg Kroah-HartmanFrom: Ian Abbott <[email protected]>
commit ab42b48f32d4c766420c3499ee9c0289b7028182 upstream.
The "auto-attach" handler function gsc_hpdi_auto_attach() calls dma_alloc_coherent() in a loop to allocate some DMA data buffers, and also calls it to allocate a buffer for a DMA descriptor chain. However, it does not check the return value of any of these calls. Change gsc_hpdi_auto_attach() to return -ENOMEM if any of these dma_alloc_coherent() calls fail. This will result in the comedi core calling the "detach" handler gsc_hpdi_detach() as part of the clean-up, which will call gsc_hpdi_free_dma() to free any allocated DMA coherent memory buffers.
--- drivers/staging/comedi/drivers/gsc_hpdi.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/staging/comedi/drivers/gsc_hpdi.c +10 -0
@@ -623,6 +623,11 @@ static int gsc_hpdi_auto_attach(struct cdma_alloc_coherent (&pcidev->dev,DMA_BUFFER_SIZE , &devpriv->dio_buffer_phys_addr[i],GFP_KERNEL ); +if (!devpriv->dio_buffer[i]) { +dev_warn (dev->class_dev, +"failed to allocate DMA buffer\n" ); +return -ENOMEM ; + } }/* allocate dma descriptors */ devpriv->dma_desc = dma_alloc_coherent(&pcidev->dev,
@@ -630,6 +635,11 @@ static int gsc_hpdi_auto_attach(struct cNUM_DMA_DESCRIPTORS , &devpriv->dma_desc_phys_addr, GFP_KERNEL); +if (!devpriv->dma_desc) { +dev_warn (dev->class_dev, +"failed to allocate DMA descriptors\n" ); +return -ENOMEM ; + }if (devpriv->dma_desc_phys_addr &0xf ) {dev_warn (dev->class_dev," dma descriptors not quad-word aligned (bug)\n" );
Greg Kroah-Hartman
maintainerPATCH 404/434 tty/serial: atmel: fix out of range clock divider handling
In reply to Greg Kroah-HartmanFrom: David Engraf <[email protected]>
commit cb47b9f8630ae3fa3f5fbd0c7003faba7abdf711 upstream.
Use MCK_DIV8 when the clock divider is > 65535. Unfortunately the mode register was already written thus the clock selection is ignored.
Fix by doing the baud rate calulation before setting the mode.
--- drivers/tty/serial/atmel_serial.c | 43 +++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 21 deletions(-)
drivers/tty/serial/atmel_serial.c +22 -21
@@ -2270,27 +2270,6 @@ static void atmel_set_termios(struct uar mode |=ATMEL_US_USMODE_NORMAL ; } -/* set the mode, clock divisor, parity, stop bits and data size */ -atmel_uart_writel (port,ATMEL_US_MR , mode); - -/* -* when switching the mode, set the RTS line state according to the -* new mode, otherwise keep the former state -*/ -if ((old_mode &ATMEL_US_USMODE ) != (mode &ATMEL_US_USMODE )) { -unsigned int rts_state; - -if ((mode &ATMEL_US_USMODE ) ==ATMEL_US_USMODE_HWHS ) { -/* let the hardware control the RTS line */ - rts_state =ATMEL_US_RTSDIS ; - }else { -/* force RTS line to low level */ - rts_state =ATMEL_US_RTSEN ; - } - -atmel_uart_writel (port,ATMEL_US_CR , rts_state); - } -/* * Set the baud rate: * Fractional baudrate allows to setup output frequency more
@@ -2317,6 +2296,28 @@ static void atmel_set_termios(struct uarif (!(port->iso7816.flags &SER_ISO7816_ENABLED ))atmel_uart_writel (port,ATMEL_US_BRGR , quot); + +/* set the mode, clock divisor, parity, stop bits and data size */ +atmel_uart_writel (port,ATMEL_US_MR , mode); + +/* +* when switching the mode, set the RTS line state according to the +* new mode, otherwise keep the former state +*/ +if ((old_mode &ATMEL_US_USMODE ) != (mode &ATMEL_US_USMODE )) { +unsigned int rts_state; + +if ((mode &ATMEL_US_USMODE ) ==ATMEL_US_USMODE_HWHS ) { +/* let the hardware control the RTS line */ + rts_state =ATMEL_US_RTSDIS ; + }else { +/* force RTS line to low level */ + rts_state =ATMEL_US_RTSEN ; + } + +atmel_uart_writel (port,ATMEL_US_CR , rts_state); + } +atmel_uart_writel (port,ATMEL_US_CR ,ATMEL_US_RSTSTA |ATMEL_US_RSTRX );atmel_uart_writel (port,ATMEL_US_CR ,ATMEL_US_TXEN |ATMEL_US_RXEN ); atmel_port->tx_stopped = false;
Greg Kroah-Hartman
maintainerPATCH 405/434 serial: sprd: Add clearing break interrupt operation
In reply to Greg Kroah-HartmanFrom: Yonghan Ye <[email protected]>
commit abeb2e9414d7e3a0d8417bc3b13d7172513ea8a0 upstream.
A break interrupt will be generated if the RX line was pulled low, which means some abnomal behaviors occurred of the UART. In this case, we still need to clear this break interrupt status, otherwise it will cause irq storm to crash the whole system.
--- drivers/tty/serial/sprd_serial.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/tty/serial/sprd_serial.c +3 -0
@@ -679,6 +679,9 @@ static irqreturn_t sprd_handle_irq(int iif (ims &SPRD_IMSR_TIMEOUT )serial_out (port,SPRD_ICLR ,SPRD_ICLR_TIMEOUT ); +if (ims &SPRD_IMSR_BREAK_DETECT ) +serial_out (port,SPRD_ICLR ,SPRD_IMSR_BREAK_DETECT ); +if (ims & (SPRD_IMSR_RX_FIFO_FULL |SPRD_IMSR_BREAK_DETECT |SPRD_IMSR_TIMEOUT ))sprd_rx (port);
Greg Kroah-Hartman
maintainerPATCH 406/434 pinctrl: baytrail: Really serialize all register accesses
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
commit 40ecab551232972a39cdd8b6f17ede54a3fdb296 upstream.
Commit 39ce8150a079 ("pinctrl: baytrail: Serialize all register access") added a spinlock around all register accesses because:
"There is a hardware issue in Intel Baytrail where concurrent GPIO register
access might result reads of 0xffffffff and writes might get dropped completely."
Testing has shown that this does not catch all cases, there are still 2 problems remaining
1) The original fix uses a spinlock per byt_gpio device / struct, additional testing has shown that this is not sufficient concurent accesses to 2 different GPIO banks also suffer from the same problem.
This commit fixes this by moving to a single global lock.
2) The original fix did not add a lock around the register accesses in the suspend/resume handling.
Since pinctrl-baytrail.c is using normal suspend/resume handlers, interrupts are still enabled during suspend/resume handling. Nothing should be using the GPIOs when they are being taken down, _but_ the GPIOs themselves may still cause interrupts, which are likely to use (read) the triggering GPIO. So we need to protect against concurrent GPIO register accesses in the suspend/resume handlers too.
This commit fixes this by adding the missing spin_lock / unlock calls.
The 2 fixes together fix the Acer Switch 10 SW5-012 getting completely confused after a suspend resume. The DSDT for this device has a bug in its _LID method which reprograms the home and power button trigger- flags requesting both high and low _level_ interrupts so the IRQs for these 2 GPIOs continuously fire. This combined with the saving of registers during suspend, triggers concurrent GPIO register accesses resulting in saving 0xffffffff as pconf0 value during suspend and then when restoring this on resume the pinmux settings get all messed up, resulting in various I2C busses being stuck, the wifi no longer working and often the tablet simply not coming out of suspend at all.
--- drivers/pinctrl/intel/pinctrl-baytrail.c | 81 ++++++++++++++++--------------- 1 file changed, 44 insertions(+), 37 deletions(-)
drivers/pinctrl/intel/pinctrl-baytrail.c +44 -37
@@ -110,7 +110,6 @@ struct byt_gpio {struct platform_device *pdev;struct pinctrl_dev *pctl_dev;struct pinctrl_desc pctl_desc; -raw_spinlock_t lock;const struct intel_pinctrl_soc_data *soc_data;struct intel_community *communities_copy;struct byt_gpio_pin_context *saved_context;
@@ -549,6 +548,8 @@ static const struct intel_pinctrl_soc_da NULL }; +static DEFINE_RAW_SPINLOCK (byt_lock); +static struct intel_community *byt_get_community (struct byt_gpio *vg,unsigned int pin) {
@@ -658,7 +659,7 @@ static void byt_set_group_simple_mux(strunsigned long flags;int i; -raw_spin_lock_irqsave (&vg->lock, flags); +raw_spin_lock_irqsave (&byt_lock, flags);for (i =0 ; i < group.npins; i++) {void __iomem *padcfg0;
@@ -678,7 +679,7 @@ static void byt_set_group_simple_mux(strwritel (value, padcfg0); } -raw_spin_unlock_irqrestore (&vg->lock, flags); +raw_spin_unlock_irqrestore (&byt_lock, flags); } static void byt_set_group_mixed_mux(struct byt_gpio *vg,
@@ -688,7 +689,7 @@ static void byt_set_group_mixed_mux(struunsigned long flags;int i; -raw_spin_lock_irqsave (&vg->lock, flags); +raw_spin_lock_irqsave (&byt_lock, flags);for (i =0 ; i < group.npins; i++) {void __iomem *padcfg0;
@@ -708,7 +709,7 @@ static void byt_set_group_mixed_mux(struwritel (value, padcfg0); } -raw_spin_unlock_irqrestore (&vg->lock, flags); +raw_spin_unlock_irqrestore (&byt_lock, flags); } static int byt_set_mux(struct pinctrl_dev *pctldev, unsigned int func_selector,
@@ -749,11 +750,11 @@ static void byt_gpio_clear_triggering(stunsigned long flags;u32 value; -raw_spin_lock_irqsave (&vg->lock, flags); +raw_spin_lock_irqsave (&byt_lock, flags); value =readl (reg); value &= ~(BYT_TRIG_POS |BYT_TRIG_NEG |BYT_TRIG_LVL );writel (value, reg); -raw_spin_unlock_irqrestore (&vg->lock, flags); +raw_spin_unlock_irqrestore (&byt_lock, flags); } static int byt_gpio_request_enable(struct pinctrl_dev *pctl_dev,
@@ -765,7 +766,7 @@ static int byt_gpio_request_enable(strucu32 value, gpio_mux;unsigned long flags; -raw_spin_lock_irqsave (&vg->lock, flags); +raw_spin_lock_irqsave (&byt_lock, flags);/* * In most cases, func pin mux 000 means GPIO function.
@@ -787,7 +788,7 @@ static int byt_gpio_request_enable(struc "pin %u forcibly re-configured as GPIO\n", offset); } -raw_spin_unlock_irqrestore (&vg->lock, flags); +raw_spin_unlock_irqrestore (&byt_lock, flags);pm_runtime_get (&vg->pdev->dev);
@@ -815,7 +816,7 @@ static int byt_gpio_set_direction(structunsigned long flags;u32 value; -raw_spin_lock_irqsave (&vg->lock, flags); +raw_spin_lock_irqsave (&byt_lock, flags); value =readl (val_reg); value &= ~BYT_DIR_MASK ;
@@ -832,7 +833,7 @@ static int byt_gpio_set_direction(struct "Potential Error: Setting GPIO with direct_irq_en to output");writel (value, val_reg); -raw_spin_unlock_irqrestore (&vg->lock, flags); +raw_spin_unlock_irqrestore (&byt_lock, flags);return 0 ; }
@@ -901,11 +902,11 @@ static int byt_pin_config_get(struct pinu32 conf, pull, val, debounce;u16 arg =0 ; -raw_spin_lock_irqsave (&vg->lock, flags); +raw_spin_lock_irqsave (&byt_lock, flags); conf =readl (conf_reg); pull = conf &BYT_PULL_ASSIGN_MASK ; val =readl (val_reg); -raw_spin_unlock_irqrestore (&vg->lock, flags); +raw_spin_unlock_irqrestore (&byt_lock, flags);switch (param) {case PIN_CONFIG_BIAS_DISABLE :
@@ -932,9 +933,9 @@ static int byt_pin_config_get(struct pinif (!(conf &BYT_DEBOUNCE_EN ))return -EINVAL ; -raw_spin_lock_irqsave (&vg->lock, flags); +raw_spin_lock_irqsave (&byt_lock, flags); debounce =readl (db_reg); -raw_spin_unlock_irqrestore (&vg->lock, flags); +raw_spin_unlock_irqrestore (&byt_lock, flags);switch (debounce &BYT_DEBOUNCE_PULSE_MASK ) {case BYT_DEBOUNCE_PULSE_375US :
@@ -986,7 +987,7 @@ static int byt_pin_config_set(struct pinu32 conf, val, debounce;int i, ret =0 ; -raw_spin_lock_irqsave (&vg->lock, flags); +raw_spin_lock_irqsave (&byt_lock, flags); conf =readl (conf_reg); val =readl (val_reg);
@@ -1094,7 +1095,7 @@ static int byt_pin_config_set(struct pinif (!ret)writel (conf, conf_reg); -raw_spin_unlock_irqrestore (&vg->lock, flags); +raw_spin_unlock_irqrestore (&byt_lock, flags);return ret; }
@@ -1119,9 +1120,9 @@ static int byt_gpio_get(struct gpio_chipunsigned long flags;u32 val; -raw_spin_lock_irqsave (&vg->lock, flags); +raw_spin_lock_irqsave (&byt_lock, flags); val =readl (reg); -raw_spin_unlock_irqrestore (&vg->lock, flags); +raw_spin_unlock_irqrestore (&byt_lock, flags);return !!(val &BYT_LEVEL ); }
@@ -1136,13 +1137,13 @@ static void byt_gpio_set(struct gpio_chiif (!reg)return ; -raw_spin_lock_irqsave (&vg->lock, flags); +raw_spin_lock_irqsave (&byt_lock, flags); old_val =readl (reg);if (value)writel (old_val |BYT_LEVEL , reg);else writel (old_val & ~BYT_LEVEL , reg); -raw_spin_unlock_irqrestore (&vg->lock, flags); +raw_spin_unlock_irqrestore (&byt_lock, flags); }static int byt_gpio_get_direction (struct gpio_chip *chip,unsigned int offset)
@@ -1155,9 +1156,9 @@ static int byt_gpio_get_direction(structif (!reg)return -EINVAL ; -raw_spin_lock_irqsave (&vg->lock, flags); +raw_spin_lock_irqsave (&byt_lock, flags); value =readl (reg); -raw_spin_unlock_irqrestore (&vg->lock, flags); +raw_spin_unlock_irqrestore (&byt_lock, flags);if (!(value &BYT_OUTPUT_EN ))return 0 ;
@@ -1200,14 +1201,14 @@ static void byt_gpio_dbg_show(struct seqconst char *label;unsigned int pin; -raw_spin_lock_irqsave (&vg->lock, flags); +raw_spin_lock_irqsave (&byt_lock, flags); pin = vg->soc_data->pins[i].number; reg =byt_gpio_reg (vg, pin,BYT_CONF0_REG );if (!reg) {seq_printf (s,"Could not retrieve pin %i conf0 reg\n" , pin); -raw_spin_unlock_irqrestore (&vg->lock, flags); +raw_spin_unlock_irqrestore (&byt_lock, flags);continue ; } conf0 =readl (reg);
@@ -1216,11 +1217,11 @@ static void byt_gpio_dbg_show(struct seqif (!reg) {seq_printf (s,"Could not retrieve pin %i val reg\n" , pin); -raw_spin_unlock_irqrestore (&vg->lock, flags); +raw_spin_unlock_irqrestore (&byt_lock, flags);continue ; } val =readl (reg); -raw_spin_unlock_irqrestore (&vg->lock, flags); +raw_spin_unlock_irqrestore (&byt_lock, flags); comm =byt_get_community (vg, pin);if (!comm) {
@@ -1304,9 +1305,9 @@ static void byt_irq_ack(struct irq_dataif (!reg)return ; -raw_spin_lock (&vg->lock); +raw_spin_lock (&byt_lock);writel (BIT (offset %32 ), reg); -raw_spin_unlock (&vg->lock); +raw_spin_unlock (&byt_lock); }static void byt_irq_mask (struct irq_data *d)
@@ -1330,7 +1331,7 @@ static void byt_irq_unmask(struct irq_daif (!reg)return ; -raw_spin_lock_irqsave (&vg->lock, flags); +raw_spin_lock_irqsave (&byt_lock, flags); value =readl (reg);switch (irqd_get_trigger_type (d)) {
@@ -1353,7 +1354,7 @@ static void byt_irq_unmask(struct irq_dawritel (value, reg); -raw_spin_unlock_irqrestore (&vg->lock, flags); +raw_spin_unlock_irqrestore (&byt_lock, flags); }static int byt_irq_type (struct irq_data *d,unsigned int type)
@@ -1367,7 +1368,7 @@ static int byt_irq_type(struct irq_dataif (!reg || offset >= vg->chip.ngpio)return -EINVAL ; -raw_spin_lock_irqsave (&vg->lock, flags); +raw_spin_lock_irqsave (&byt_lock, flags); value =readl (reg); WARN(value & BYT_DIRECT_IRQ_EN,
@@ -1389,7 +1390,7 @@ static int byt_irq_type(struct irq_dataelse if (type &IRQ_TYPE_LEVEL_MASK )irq_set_handler_locked (d, handle_level_irq); -raw_spin_unlock_irqrestore (&vg->lock, flags); +raw_spin_unlock_irqrestore (&byt_lock, flags);return 0 ; }
@@ -1425,9 +1426,9 @@ static void byt_gpio_irq_handler(structcontinue ; } -raw_spin_lock (&vg->lock); +raw_spin_lock (&byt_lock); pending =readl (reg); -raw_spin_unlock (&vg->lock); +raw_spin_unlock (&byt_lock);for_each_set_bit (pin, &pending,32 ) { virq =irq_find_mapping (vg->chip.irq.domain, base + pin);generic_handle_irq (virq);
@@ -1638,8 +1639,6 @@ static int byt_pinctrl_probe(struct platreturn PTR_ERR (vg->pctl_dev); } -raw_spin_lock_init (&vg->lock); - ret =byt_gpio_probe (vg);if (ret)return ret;
@@ -1654,8 +1653,11 @@ static int byt_pinctrl_probe(struct platstatic int byt_gpio_suspend (struct device *dev) {struct byt_gpio *vg =dev_get_drvdata (dev); +unsigned long flags;int i; +raw_spin_lock_irqsave (&byt_lock, flags); +for (i =0 ; i < vg->soc_data->npins; i++) {void __iomem *reg;u32 value;
@@ -1676,14 +1678,18 @@ static int byt_gpio_suspend(struct devic vg->saved_context[i].val = value; } +raw_spin_unlock_irqrestore (&byt_lock, flags);return 0 ; }static int byt_gpio_resume (struct device *dev) {struct byt_gpio *vg =dev_get_drvdata (dev); +unsigned long flags;int i; +raw_spin_lock_irqsave (&byt_lock, flags); +for (i =0 ; i < vg->soc_data->npins; i++) {void __iomem *reg;u32 value;
@@ -1721,6 +1727,7 @@ static int byt_gpio_resume(struct device } } +raw_spin_unlock_irqrestore (&byt_lock, flags);return 0 ; }#endif
Greg Kroah-Hartman
maintainerPATCH 407/434 clk: imx: clk-imx7ulp: Add missing sentinel of ulp_div_table
In reply to Greg Kroah-HartmanFrom: Peng Fan <[email protected]>
commit ed11e31709d7ddb19d4dc451d5bbfb15129f4cad upstream.
There should be a sentinel of ulp_div_table, otherwise _get_table_div may access data out of the array.
--- drivers/clk/imx/clk-imx7ulp.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/imx/clk-imx7ulp.c +1 -0
@@ -40,6 +40,7 @@ static const struct clk_div_table ulp_di { .val = 5, .div = 16, }, { .val = 6, .div = 32, }, { .val = 7, .div = 64, }, + { /* sentinel */ }, }; static const int pcc2_uart_clk_ids[] __initconst = {
Greg Kroah-Hartman
maintainerPATCH 408/434 clk: imx: clk-composite-8m: add lock to gate/mux
In reply to Greg Kroah-HartmanFrom: Peng Fan <[email protected]>
commit 073a01e8d7c23b3efb59a3d4c20aa546f9ec29a9 upstream.
There is a lock to divider in the composite driver, but that's not enough. lock to gate/mux are also needed to provide exclusive access to the register.
--- drivers/clk/imx/clk-composite-8m.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/imx/clk-composite-8m.c +2 -0
@@ -142,6 +142,7 @@ struct clk *imx8m_clk_composite_flags(co mux->reg = reg; mux->shift =PCG_PCS_SHIFT ; mux->mask =PCG_PCS_MASK ; + mux->lock = &imx_ccm_lock; div =kzalloc (sizeof (*div),GFP_KERNEL );if (!div)
@@ -161,6 +162,7 @@ struct clk *imx8m_clk_composite_flags(co gate_hw = &gate->hw; gate->reg = reg; gate->bit_idx =PCG_CGC_SHIFT ; + gate->lock = &imx_ccm_lock; hw = clk_hw_register_composite(NULL, name, parent_names, num_parents, mux_hw, &clk_mux_ops, div_hw,
Greg Kroah-Hartman
maintainerPATCH 409/434 clk: imx: pll14xx: fix clk_pll14xx_wait_lock
In reply to Greg Kroah-HartmanFrom: Peng Fan <[email protected]>
commit c3a5fd15ed0c1494435e4e35fbee734ae46b5073 upstream.
The usage of readl_poll_timeout is wrong, the 3rd parameter(cond) should be "val & LOCK_STATUS" not "val & LOCK_TIMEOUT_US", It is not check whether the pll locked, LOCK_STATUS reflects the mask, not LOCK_TIMEOUT_US.
--- drivers/clk/imx/clk-pll14xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/imx/clk-pll14xx.c +1 -1
@@ -153,7 +153,7 @@ static int clk_pll14xx_wait_lock(struct {u32 val; -return readl_poll_timeout (pll->base, val, val &LOCK_TIMEOUT_US ,0 , +return readl_poll_timeout (pll->base, val, val &LOCK_STATUS ,0 ,LOCK_TIMEOUT_US ); }
Greg Kroah-Hartman
maintainerPATCH 410/434 ext4: fix ext4_empty_dir() for directories with holes
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit 64d4ce892383b2ad6d782e080d25502f91bf2a38 upstream.
Function ext4_empty_dir() doesn't correctly handle directories with holes and crashes on bh->b_data dereference when bh is NULL. Reorganize the loop to use 'offset' variable all the times instead of comparing pointers to current direntry with bh->b_data pointer. Also add more strict checking of '.' and '..' directory entries to avoid entering loop in possibly invalid state on corrupted filesystems.
--- fs/ext4/namei.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-)
fs/ext4/namei.c +18 -14
@@ -2808,7 +2808,7 @@ bool ext4_empty_dir(struct inode *inode) {unsigned int offset;struct buffer_head *bh; -struct ext4_dir_entry_2 *de, *de1; +struct ext4_dir_entry_2 *de;struct super_block *sb;if (ext4_has_inline_data (inode)) {
@@ -2833,19 +2833,25 @@ bool ext4_empty_dir(struct inode *inode)return true; de = (struct ext4_dir_entry_2 *) bh->b_data; - de1 =ext4_next_entry (de, sb->s_blocksize); -if (le32_to_cpu (de->inode) != inode->i_ino || -le32_to_cpu (de1->inode) ==0 || -strcmp ("." , de->name) ||strcmp (".." , de1->name)) { -ext4_warning_inode (inode,"directory missing '.' and/or '..'" ); +if (ext4_check_dir_entry (inode,NULL , de, bh, bh->b_data, bh->b_size, +0 ) || +le32_to_cpu (de->inode) != inode->i_ino ||strcmp ("." , de->name)) { +ext4_warning_inode (inode,"directory missing '.'" );brelse (bh);return true; } - offset =ext4_rec_len_from_disk (de->rec_len, sb->s_blocksize) + -ext4_rec_len_from_disk (de1->rec_len, sb->s_blocksize); - de =ext4_next_entry (de1, sb->s_blocksize); + offset =ext4_rec_len_from_disk (de->rec_len, sb->s_blocksize); + de =ext4_next_entry (de, sb->s_blocksize); +if (ext4_check_dir_entry (inode,NULL , de, bh, bh->b_data, bh->b_size, + offset) || +le32_to_cpu (de->inode) ==0 ||strcmp (".." , de->name)) { +ext4_warning_inode (inode,"directory missing '..'" ); +brelse (bh); +return true; + } + offset +=ext4_rec_len_from_disk (de->rec_len, sb->s_blocksize);while (offset < inode->i_size) { -if ((void *) de >= (void *) (bh->b_data+sb->s_blocksize)) { +if (!(offset & (sb->s_blocksize -1 ))) {unsigned int lblock;brelse (bh); lblock = offset >>EXT4_BLOCK_SIZE_BITS (sb);
@@ -2856,12 +2862,11 @@ bool ext4_empty_dir(struct inode *inode) }if (IS_ERR (bh))return true; - de = (struct ext4_dir_entry_2 *) bh->b_data; } + de = (struct ext4_dir_entry_2 *) (bh->b_data + + (offset & (sb->s_blocksize -1 )));if (ext4_check_dir_entry (inode,NULL , de, bh, bh->b_data, bh->b_size, offset)) { - de = (struct ext4_dir_entry_2 *)(bh->b_data + - sb->s_blocksize); offset = (offset | (sb->s_blocksize -1 )) +1 ;continue ; }
@@ -2870,7 +2875,6 @@ bool ext4_empty_dir(struct inode *inode)return false; } offset +=ext4_rec_len_from_disk (de->rec_len, sb->s_blocksize); - de =ext4_next_entry (de, sb->s_blocksize); }brelse (bh);return true;
Greg Kroah-Hartman
maintainerPATCH 411/434 ext4: check for directory entries too close to block end
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit 109ba779d6cca2d519c5dd624a3276d03e21948e upstream.
ext4_check_dir_entry() currently does not catch a case when a directory entry ends so close to the block end that the header of the next directory entry would not fit in the remaining space. This can lead to directory iteration code trying to access address beyond end of current buffer head leading to oops.
--- fs/ext4/dir.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/ext4/dir.c +5 -0
@@ -81,6 +81,11 @@ int __ext4_check_dir_entry(const char *f error_msg ="rec_len is too small for name_len" ; else if (unlikely(((char *) de - buf) + rlen > size)) error_msg ="directory entry overrun" ; + else if (unlikely(((char *) de - buf) + rlen > + size - EXT4_DIR_REC_LEN(1) && + ((char *) de - buf) + rlen != size)) { + error_msg ="directory entry too close to block end" ; + } else if (unlikely(le32_to_cpu(de->inode) > le32_to_cpu(EXT4_SB(dir->i_sb)->s_es->s_inodes_count))) error_msg ="inode out of bounds" ;
Greg Kroah-Hartman
maintainerPATCH 412/434 ext4: unlock on error in ext4_expand_extra_isize()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit 7f420d64a08c1dcd65b27be82a27cf2bdb2e7847 upstream.
We need to unlock the xattr before returning on this error path.
--- fs/ext4/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ext4/inode.c +2 -2
@@ -6035,7 +6035,7 @@ int ext4_expand_extra_isize(struct inode error =ext4_journal_get_write_access (handle, iloc->bh);if (error) {brelse (iloc->bh); - goto out_stop; + goto out_unlock; } error = __ext4_expand_extra_isize(inode, new_extra_isize, iloc,
@@ -6045,8 +6045,8 @@ int ext4_expand_extra_isize(struct inodeif (!error) error = rc; +out_unlock:ext4_write_unlock_xattr (inode, &no_expand); -out_stop:ext4_journal_stop (handle);return error; }
Greg Kroah-Hartman
maintainerPATCH 413/434 ext4: validate the debug_want_extra_isize mount option at parse time
In reply to Greg Kroah-HartmanFrom: Theodore Ts'o <[email protected]>
commit 9803387c55f7d2ce69aa64340c5fdc6b3027dbc8 upstream.
Instead of setting s_want_extra_size and then making sure that it is a valid value afterwards, validate the field before we set it. This avoids races and other problems when remounting the file system.
--- fs/ext4/super.c | 143 +++++++++++++++++++++++++++----------------------------- 1 file changed, 69 insertions(+), 74 deletions(-)
fs/ext4/super.c +69 -74
@@ -1887,6 +1887,13 @@ static int handle_mount_opt(struct super } sbi->s_commit_interval =HZ * arg; }else if (token == Opt_debug_want_extra_isize) { +if ((arg &1 ) || + (arg <4 ) || + (arg > (sbi->s_inode_size -EXT4_GOOD_OLD_INODE_SIZE ))) { +ext4_msg (sb,KERN_ERR , +"Invalid want_extra_isize %d" , arg); +return -1 ; + } sbi->s_want_extra_isize = arg; }else if (token == Opt_max_batch_time) { sbi->s_max_batch_time = arg;
@@ -3551,40 +3558,6 @@ int ext4_calculate_overhead(struct superreturn 0 ; } -static void ext4_clamp_want_extra_isize (struct super_block *sb) -{ -struct ext4_sb_info *sbi =EXT4_SB (sb); -struct ext4_super_block *es = sbi->s_es; -unsigned def_extra_isize =sizeof (struct ext4_inode ) - -EXT4_GOOD_OLD_INODE_SIZE ; - -if (sbi->s_inode_size ==EXT4_GOOD_OLD_INODE_SIZE ) { - sbi->s_want_extra_isize =0 ; -return ; - } -if (sbi->s_want_extra_isize <4 ) { - sbi->s_want_extra_isize = def_extra_isize; -if (ext4_has_feature_extra_isize (sb)) { -if (sbi->s_want_extra_isize < -le16_to_cpu (es->s_want_extra_isize)) - sbi->s_want_extra_isize = -le16_to_cpu (es->s_want_extra_isize); -if (sbi->s_want_extra_isize < -le16_to_cpu (es->s_min_extra_isize)) - sbi->s_want_extra_isize = -le16_to_cpu (es->s_min_extra_isize); - } - } -/* Check if enough inode space is available */ -if ((sbi->s_want_extra_isize > sbi->s_inode_size) || - (EXT4_GOOD_OLD_INODE_SIZE + sbi->s_want_extra_isize > - sbi->s_inode_size)) { - sbi->s_want_extra_isize = def_extra_isize; -ext4_msg (sb,KERN_INFO , -"required extra inode space not available" ); - } -} -static void ext4_set_resv_clusters (struct super_block *sb) {ext4_fsblk_t resv_clusters;
@@ -3792,6 +3765,68 @@ static int ext4_fill_super(struct super_*/ sbi->s_li_wait_mult =EXT4_DEF_LI_WAIT_MULT ; +if (le32_to_cpu (es->s_rev_level) ==EXT4_GOOD_OLD_REV ) { + sbi->s_inode_size =EXT4_GOOD_OLD_INODE_SIZE ; + sbi->s_first_ino =EXT4_GOOD_OLD_FIRST_INO ; + }else { + sbi->s_inode_size =le16_to_cpu (es->s_inode_size); + sbi->s_first_ino =le32_to_cpu (es->s_first_ino); +if (sbi->s_first_ino <EXT4_GOOD_OLD_FIRST_INO ) { +ext4_msg (sb,KERN_ERR ,"invalid first ino: %u" , + sbi->s_first_ino); + goto failed_mount; + } +if ((sbi->s_inode_size <EXT4_GOOD_OLD_INODE_SIZE ) || + (!is_power_of_2 (sbi->s_inode_size)) || + (sbi->s_inode_size > blocksize)) { +ext4_msg (sb,KERN_ERR , +"unsupported inode size: %d" , + sbi->s_inode_size); + goto failed_mount; + } +/* +* i_atime_extra is the last extra field available for +* [acm]times in struct ext4_inode. Checking for that +* field should suffice to ensure we have extra space +* for all three. +*/ +if (sbi->s_inode_size >= offsetof(struct ext4_inode , i_atime_extra) + +sizeof (((struct ext4_inode *)0 )->i_atime_extra)) { + sb->s_time_gran =1 ; + sb->s_time_max =EXT4_EXTRA_TIMESTAMP_MAX ; + }else { + sb->s_time_gran =NSEC_PER_SEC ; + sb->s_time_max =EXT4_NON_EXTRA_TIMESTAMP_MAX ; + } + sb->s_time_min =EXT4_TIMESTAMP_MIN ; + } +if (sbi->s_inode_size >EXT4_GOOD_OLD_INODE_SIZE ) { + sbi->s_want_extra_isize =sizeof (struct ext4_inode ) - +EXT4_GOOD_OLD_INODE_SIZE ; +if (ext4_has_feature_extra_isize (sb)) { +unsigned v, max = (sbi->s_inode_size - +EXT4_GOOD_OLD_INODE_SIZE ); + + v =le16_to_cpu (es->s_want_extra_isize); +if (v > max) { +ext4_msg (sb,KERN_ERR , +"bad s_want_extra_isize: %d" , v); + goto failed_mount; + } +if (sbi->s_want_extra_isize < v) + sbi->s_want_extra_isize = v; + + v =le16_to_cpu (es->s_min_extra_isize); +if (v > max) { +ext4_msg (sb,KERN_ERR , +"bad s_min_extra_isize: %d" , v); + goto failed_mount; + } +if (sbi->s_want_extra_isize < v) + sbi->s_want_extra_isize = v; + } + } +if (sbi->s_es->s_mount_opts[0 ]) { char *s_mount_opts = kstrndup(sbi->s_es->s_mount_opts, sizeof(sbi->s_es->s_mount_opts),
@@ -4030,42 +4065,6 @@ static int ext4_fill_super(struct super_ has_huge_files); sb->s_maxbytes =ext4_max_size (sb->s_blocksize_bits, has_huge_files); -if (le32_to_cpu (es->s_rev_level) ==EXT4_GOOD_OLD_REV ) { - sbi->s_inode_size =EXT4_GOOD_OLD_INODE_SIZE ; - sbi->s_first_ino =EXT4_GOOD_OLD_FIRST_INO ; - }else { - sbi->s_inode_size =le16_to_cpu (es->s_inode_size); - sbi->s_first_ino =le32_to_cpu (es->s_first_ino); -if (sbi->s_first_ino <EXT4_GOOD_OLD_FIRST_INO ) { -ext4_msg (sb,KERN_ERR ,"invalid first ino: %u" , - sbi->s_first_ino); - goto failed_mount; - } -if ((sbi->s_inode_size <EXT4_GOOD_OLD_INODE_SIZE ) || - (!is_power_of_2 (sbi->s_inode_size)) || - (sbi->s_inode_size > blocksize)) { -ext4_msg (sb,KERN_ERR , -"unsupported inode size: %d" , - sbi->s_inode_size); - goto failed_mount; - } -/* -* i_atime_extra is the last extra field available for [acm]times in -* struct ext4_inode. Checking for that field should suffice to ensure -* we have extra space for all three. -*/ -if (sbi->s_inode_size >= offsetof(struct ext4_inode , i_atime_extra) + -sizeof (((struct ext4_inode *)0 )->i_atime_extra)) { - sb->s_time_gran =1 ; - sb->s_time_max =EXT4_EXTRA_TIMESTAMP_MAX ; - }else { - sb->s_time_gran =NSEC_PER_SEC ; - sb->s_time_max =EXT4_NON_EXTRA_TIMESTAMP_MAX ; - } - - sb->s_time_min =EXT4_TIMESTAMP_MIN ; - } - sbi->s_desc_size =le16_to_cpu (es->s_desc_size);if (ext4_has_feature_64bit (sb)) { if (sbi->s_desc_size < EXT4_MIN_DESC_SIZE_64BIT ||
@@ -4521,8 +4520,6 @@ no_journal: }else if (ret) goto failed_mount4a; -ext4_clamp_want_extra_isize (sb); -ext4_set_resv_clusters (sb); err =ext4_setup_system_zone (sb);
@@ -5310,8 +5307,6 @@ static int ext4_remount(struct super_blo goto restore_opts; } -ext4_clamp_want_extra_isize (sb); -if ((old_opts.s_mount_opt &EXT4_MOUNT_JOURNAL_CHECKSUM ) ^test_opt (sb,JOURNAL_CHECKSUM )) { ext4_msg(sb, KERN_ERR, "changing journal_checksum "
Greg Kroah-Hartman
maintainerPATCH 414/434 iocost: over-budget forced IOs should schedule async delay
In reply to Greg Kroah-HartmanFrom: Tejun Heo <[email protected]>
commit d7bd15a138aef3be227818aad9c501e43c89c8c5 upstream.
When over-budget IOs are force-issued through root cgroup, iocg_kick_delay() adjusts the async delay accordingly but doesn't actually schedule async throttle for the issuing task. This bug is pretty well masked because sooner or later the offending threads are gonna get directly throttled on regular IOs or have async delay scheduled by mem_cgroup_throttle_swaprate().
However, it can affect control quality on filesystem metadata heavy operations. Let's fix it by invoking blkcg_schedule_throttle() when iocg_kick_delay() says async delay is needed.
--- block/blk-iocost.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
block/blk-iocost.c +8 -5
@@ -1212,7 +1212,7 @@ static enum hrtimer_restart iocg_waitq_treturn HRTIMER_NORESTART ; } -static void iocg_kick_delay (struct ioc_gq *iocg,struct ioc_now *now,u64 cost) +static bool iocg_kick_delay (struct ioc_gq *iocg,struct ioc_now *now,u64 cost) {struct ioc *ioc = iocg->ioc;struct blkcg_gq *blkg =iocg_to_blkg (iocg);
@@ -1229,11 +1229,11 @@ static void iocg_kick_delay(struct ioc_g/* clear or maintain depending on the overage */ if (time_before_eq64 (vtime, now->vnow)) {blkcg_clear_delay (blkg); -return ; +return false; }if (!atomic_read (&blkg->use_delay) &&time_before_eq64 (vtime, now->vnow + vmargin)) -return ; +return false;/* use delay */ if (cost) {
@@ -1250,10 +1250,11 @@ static void iocg_kick_delay(struct ioc_g oexpires =ktime_to_ns (hrtimer_get_softexpires (&iocg->delay_timer));if (hrtimer_is_queued (&iocg->delay_timer) &&abs (oexpires - expires) <= margin_ns /4 ) -return ; +return true;hrtimer_start_range_ns (&iocg->delay_timer,ns_to_ktime (expires), margin_ns /4 ,HRTIMER_MODE_ABS ); +return true; }static enum hrtimer_restart iocg_delay_timer_fn (struct hrtimer *timer)
@@ -1739,7 +1740,9 @@ static void ioc_rqos_throttle(struct rq_*/ if (bio_issue_as_root_blkg (bio) ||fatal_signal_pending (current)) {atomic64_add (abs_cost, &iocg->abs_vdebt); -iocg_kick_delay (iocg, &now, cost); +if (iocg_kick_delay (iocg, &now, cost)) +blkcg_schedule_throttle (rqos->q, + (bio->bi_opf &REQ_SWAP ) ==REQ_SWAP );return ; }
Greg Kroah-Hartman
maintainerPATCH 415/434 KVM: PPC: Book3S HV: Fix regression on big endian hosts
In reply to Greg Kroah-HartmanFrom: Marcus Comstedt <[email protected]>
commit 228b607d8ea1b7d4561945058d5692709099d432 upstream.
VCPU_CR is the offset of arch.regs.ccr in kvm_vcpu. arch/powerpc/include/asm/kvm_host.h defines arch.regs as a struct pt_regs, and arch/powerpc/include/asm/ptrace.h defines the ccr field of pt_regs as "unsigned long ccr". Since unsigned long is 64 bits, a 64-bit load needs to be used to load it, unless an endianness specific correction offset is added to access the desired subpart. In this case there is no reason to _not_ use a 64 bit load though.
--- arch/powerpc/kvm/book3s_hv_rmhandlers.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kvm/book3s_hv_rmhandlers.S +2 -2
@@ -1117,7 +1117,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300) ld r7, VCPU_GPR(R7)(r4) bne ret_to_ultra - lwz r0, VCPU_CR(r4) + ld r0, VCPU_CR(r4) mtcr r0 ld r0, VCPU_GPR(R0)(r4)
@@ -1137,7 +1137,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300) * R3 = UV_RETURN */ ret_to_ultra: - lwz r0, VCPU_CR(r4) + ld r0, VCPU_CR(r4) mtcr r0 ld r0, VCPU_GPR(R3)(r4)
Greg Kroah-Hartman
maintainerPATCH 416/434 kvm: x86: Host feature SSBD doesnt imply guest feature SPEC_CTRL_SSBD
In reply to Greg Kroah-HartmanFrom: Jim Mattson <[email protected]>
commit 396d2e878f92ec108e4293f1c77ea3bc90b414ff upstream.
The host reports support for the synthetic feature X86_FEATURE_SSBD when any of the three following hardware features are set:
CPUID.(EAX=7,ECX=0):EDX.SSBD[bit 31] CPUID.80000008H:EBX.AMD_SSBD[bit 24] CPUID.80000008H:EBX.VIRT_SSBD[bit 25]
Either of the first two hardware features implies the existence of the IA32_SPEC_CTRL MSR, but CPUID.80000008H:EBX.VIRT_SSBD[bit 25] does not. Therefore, CPUID.(EAX=7,ECX=0):EDX.SSBD[bit 31] should only be set in the guest if CPUID.(EAX=7,ECX=0):EDX.SSBD[bit 31] or CPUID.80000008H:EBX.AMD_SSBD[bit 24] is set on the host.
--- arch/x86/kvm/cpuid.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kvm/cpuid.c +2 -1
@@ -402,7 +402,8 @@ static inline void do_cpuid_7_mask(struc entry->edx |=F (SPEC_CTRL );if (boot_cpu_has (X86_FEATURE_STIBP )) entry->edx |=F (INTEL_STIBP ); -if (boot_cpu_has (X86_FEATURE_SSBD )) +if (boot_cpu_has (X86_FEATURE_SPEC_CTRL_SSBD ) || +boot_cpu_has (X86_FEATURE_AMD_SSBD )) entry->edx |=F (SPEC_CTRL_SSBD );/* * We emulate ARCH_CAPABILITIES in software even
Greg Kroah-Hartman
maintainerPATCH 417/434 kvm: x86: Host feature SSBD doesnt imply guest feature AMD_SSBD
In reply to Greg Kroah-HartmanFrom: Jim Mattson <[email protected]>
commit 8715f05269bfbc6453e25e80825d781a82902f8e upstream.
The host reports support for the synthetic feature X86_FEATURE_SSBD when any of the three following hardware features are set:
CPUID.(EAX=7,ECX=0):EDX.SSBD[bit 31] CPUID.80000008H:EBX.AMD_SSBD[bit 24] CPUID.80000008H:EBX.VIRT_SSBD[bit 25]
Either of the first two hardware features implies the existence of the IA32_SPEC_CTRL MSR, but CPUID.80000008H:EBX.VIRT_SSBD[bit 25] does not. Therefore, CPUID.80000008H:EBX.AMD_SSBD[bit 24] should only be set in the guest if CPUID.(EAX=7,ECX=0):EDX.SSBD[bit 31] or CPUID.80000008H:EBX.AMD_SSBD[bit 24] is set on the host.
--- arch/x86/kvm/cpuid.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kvm/cpuid.c +2 -1
@@ -760,7 +760,8 @@ static inline int __do_cpuid_func(struct entry->ebx |=F (AMD_IBRS );if (boot_cpu_has (X86_FEATURE_STIBP )) entry->ebx |=F (AMD_STIBP ); -if (boot_cpu_has (X86_FEATURE_SSBD )) +if (boot_cpu_has (X86_FEATURE_SPEC_CTRL_SSBD ) || +boot_cpu_has (X86_FEATURE_AMD_SSBD )) entry->ebx |=F (AMD_SSBD );if (!boot_cpu_has_bug (X86_BUG_SPEC_STORE_BYPASS )) entry->ebx |=F (AMD_SSB_NO );
Greg Kroah-Hartman
maintainerPATCH 418/434 KVM: arm/arm64: Properly handle faulting of device mappings
In reply to Greg Kroah-HartmanFrom: Marc Zyngier <[email protected]>
commit 6d674e28f642e3ff676fbae2d8d1b872814d32b6 upstream.
A device mapping is normally always mapped at Stage-2, since there is very little gain in having it faulted in.
Nonetheless, it is possible to end-up in a situation where the device mapping has been removed from Stage-2 (userspace munmaped the VFIO region, and the MMU notifier did its job), but present in a userspace mapping (userpace has mapped it back at the same address). In such a situation, the device mapping will be demand-paged as the guest performs memory accesses.
This requires to be careful when dealing with mapping size, cache management, and to handle potential execution of a device mapping.
--- virt/kvm/arm/mmu.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
virt/kvm/arm/mmu.c +17 -4
@@ -38,6 +38,11 @@ static unsigned long io_map_base;#define KVM_S2PTE_FLAG_IS_IOMAP (1UL << 0)#define KVM_S2_FLAG_LOGGING_ACTIVE (1UL << 1) +static bool is_iomap (unsigned long flags) +{ +return flags &KVM_S2PTE_FLAG_IS_IOMAP ; +} +static bool memslot_is_logging (struct kvm_memory_slot *memslot) {return memslot->dirty_bitmap && !(memslot->flags &KVM_MEM_READONLY );
@@ -1698,6 +1703,7 @@ static int user_mem_abort(struct kvm_vcp vma_pagesize =vma_kernel_pagesize (vma);if (logging_active || + (vma->vm_flags &VM_PFNMAP ) || !fault_supports_stage2_huge_mapping (memslot, hva, vma_pagesize)) { force_pte = true; vma_pagesize =PAGE_SIZE ;
@@ -1760,6 +1766,9 @@ static int user_mem_abort(struct kvm_vcp writable = false; } +if (exec_fault &&is_iomap (flags)) +return -ENOEXEC ; +spin_lock (&kvm->mmu_lock);if (mmu_notifier_retry (kvm, mmu_seq)) goto out_unlock;
@@ -1781,7 +1790,7 @@ static int user_mem_abort(struct kvm_vcpif (writable)kvm_set_pfn_dirty (pfn); -if (fault_status !=FSC_PERM ) +if (fault_status !=FSC_PERM && !is_iomap (flags))clean_dcache_guest_page (pfn, vma_pagesize);if (exec_fault)
@@ -1948,9 +1957,8 @@ int kvm_handle_guest_abort(struct kvm_vcif (kvm_is_error_hva (hva) || (write_fault && !writable)) {if (is_iabt) {/* Prefetch Abort on I/O address */ -kvm_inject_pabt (vcpu,kvm_vcpu_get_hfar (vcpu)); - ret =1 ; - goto out_unlock; + ret = -ENOEXEC ; + goto out; }/*
@@ -1992,6 +2000,11 @@ int kvm_handle_guest_abort(struct kvm_vc ret =user_mem_abort (vcpu, fault_ipa, memslot, hva, fault_status);if (ret ==0 ) ret =1 ; +out: +if (ret == -ENOEXEC ) { +kvm_inject_pabt (vcpu,kvm_vcpu_get_hfar (vcpu)); + ret =1 ; + } out_unlock:srcu_read_unlock (&vcpu->kvm->srcu, idx);return ret;
Greg Kroah-Hartman
maintainerPATCH 419/434 KVM: arm64: Ensure params is initialised when looking up sys register
In reply to Greg Kroah-HartmanFrom: Will Deacon <[email protected]>
commit 1ce74e96c2407df2b5867e5d45a70aacb8923c14 upstream.
Commit 4b927b94d5df ("KVM: arm/arm64: vgic: Introduce find_reg_by_id()") introduced 'find_reg_by_id()', which looks up a system register only if the 'id' index parameter identifies a valid system register. As part of the patch, existing callers of 'find_reg()' were ported over to the new interface, but this breaks 'index_to_sys_reg_desc()' in the case that the initial lookup in the vCPU target table fails because we will then call into 'find_reg()' for the system register table with an uninitialised 'param' as the key to the lookup.
GCC 10 is bright enough to spot this (amongst a tonne of false positives, but hey!):
| arch/arm64/kvm/sys_regs.c: In function ‘index_to_sys_reg_desc.part.0.isra’: | arch/arm64/kvm/sys_regs.c:983:33: warning: ‘params.Op2’ may be used uninitialized in this function [-Wmaybe-uninitialized] | 983 | (u32)(x)->CRn, (u32)(x)->CRm, (u32)(x)->Op2); | [...]
Revert the hunk of 4b927b94d5df which breaks 'index_to_sys_reg_desc()' so that the old behaviour of checking the index upfront is restored.
--- arch/arm64/kvm/sys_regs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/arm64/kvm/sys_regs.c +4 -1
@@ -2360,8 +2360,11 @@ static const struct sys_reg_desc *index_if ((id &KVM_REG_ARM_COPROC_MASK ) !=KVM_REG_ARM64_SYSREG )return NULL ; +if (!index_to_params (id, ¶ms)) +return NULL ; + table =get_target_table (vcpu->arch.target, true, &num); - r =find_reg_by_id (id, ¶ms, table, num); + r =find_reg (¶ms, table, num);if (!r) r =find_reg (¶ms, sys_reg_descs,ARRAY_SIZE (sys_reg_descs));
Greg Kroah-Hartman
maintainerPATCH 420/434 x86/intel: Disable HPET on Intel Coffee Lake H platforms
In reply to Greg Kroah-HartmanFrom: Kai-Heng Feng <[email protected]>
commit f8edbde885bbcab6a2b4a1b5ca614e6ccb807577 upstream.
Coffee Lake H SoC has similar behavior as Coffee Lake, skewed HPET timer once the SoCs entered PC10.
So let's disable HPET on CFL-H platforms.
--- arch/x86/kernel/early-quirks.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/kernel/early-quirks.c +2 -0
@@ -710,6 +710,8 @@ static struct chipset early_qrk[] __init*/ {PCI_VENDOR_ID_INTEL ,0x0f00 , PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, force_disable_hpet}, + { PCI_VENDOR_ID_INTEL, 0x3e20, + PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, force_disable_hpet}, { PCI_VENDOR_ID_INTEL, 0x3ec4, PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, force_disable_hpet}, { PCI_VENDOR_ID_BROADCOM, 0x4331,
Greg Kroah-Hartman
maintainerPATCH 421/434 x86/MCE/AMD: Do not use rdmsr_safe_on_cpu() in smca_configure()
In reply to Greg Kroah-HartmanFrom: Konstantin Khlebnikov <[email protected]>
commit 246ff09f89e54fdf740a8d496176c86743db3ec7 upstream.
... because interrupts are disabled that early and sending IPIs can deadlock:
BUG: sleeping function called from invalid context at kernel/sched/completion.c:99 in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 0, name: swapper/1 no locks held by swapper/1/0. irq event stamp: 0 hardirqs last enabled at (0): [<0000000000000000>] 0x0 hardirqs last disabled at (0): [<ffffffff8106dda9>] copy_process+0x8b9/0x1ca0 softirqs last enabled at (0): [<ffffffff8106dda9>] copy_process+0x8b9/0x1ca0 softirqs last disabled at (0): [<0000000000000000>] 0x0 Preemption disabled at: [<ffffffff8104703b>] start_secondary+0x3b/0x190 CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.5.0-rc2+ #1 Hardware name: GIGABYTE MZ01-CE1-00/MZ01-CE1-00, BIOS F02 08/29/2018 Call Trace: dump_stack ___might_sleep.cold.92 wait_for_completion ? generic_exec_single rdmsr_safe_on_cpu ? wrmsr_on_cpus mce_amd_feature_init mcheck_cpu_init identify_cpu identify_secondary_cpu smp_store_cpu_info start_secondary secondary_startup_64
The function smca_configure() is called only on the current CPU anyway, therefore replace rdmsr_safe_on_cpu() with atomic rdmsr_safe() and avoid the IPI.
[ bp: Update commit message. ]
--- arch/x86/kernel/cpu/mce/amd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/mce/amd.c +1 -1
@@ -269,7 +269,7 @@ static void smca_configure(unsigned intif (smca_banks[bank].hwid)return ; -if (rdmsr_safe_on_cpu (cpu,MSR_AMD64_SMCA_MCx_IPID (bank), &low, &high)) { +if (rdmsr_safe (MSR_AMD64_SMCA_MCx_IPID (bank), &low, &high)) {pr_warn ("Failed to read MCA_IPID for bank %d\n" , bank);return ; }
Greg Kroah-Hartman
maintainerPATCH 422/434 x86/MCE/AMD: Allow Reserved types to be overwritten in smca_banks[]
In reply to Greg Kroah-HartmanFrom: Yazen Ghannam <[email protected]>
commit 966af20929ac24360ba3fac5533eb2ab003747da upstream.
Each logical CPU in Scalable MCA systems controls a unique set of MCA banks in the system. These banks are not shared between CPUs. The bank types and ordering will be the same across CPUs on currently available systems.
However, some CPUs may see a bank as Reserved/Read-as-Zero (RAZ) while other CPUs do not. In this case, the bank seen as Reserved on one CPU is assumed to be the same type as the bank seen as a known type on another CPU.
In general, this occurs when the hardware represented by the MCA bank is disabled, e.g. disabled memory controllers on certain models, etc. The MCA bank is disabled in the hardware, so there is no possibility of getting an MCA/MCE from it even if it is assumed to have a known type.
For example:
Full system:
Bank | Type seen on CPU0 | Type seen on CPU1
------------------------------------------------
0 | LS | LS
1 | UMC | UMC
2 | CS | CS
System with hardware disabled:
Bank | Type seen on CPU0 | Type seen on CPU1
------------------------------------------------
0 | LS | LS
1 | UMC | RAZ
2 | CS | CS
For this reason, there is a single, global struct smca_banks[] that is initialized at boot time. This array is initialized on each CPU as it comes online. However, the array will not be updated if an entry already exists.
This works as expected when the first CPU (usually CPU0) has all possible MCA banks enabled. But if the first CPU has a subset, then it will save a "Reserved" type in smca_banks[]. Successive CPUs will then not be able to update smca_banks[] even if they encounter a known bank type.
This may result in unexpected behavior. Depending on the system configuration, a user may observe issues enumerating the MCA thresholding sysfs interface. The issues may be as trivial as sysfs entries not being available, or as severe as system hangs.
For example:
Bank | Type seen on CPU0 | Type seen on CPU1
------------------------------------------------
0 | LS | LS
1 | RAZ | UMC
2 | CS | CS
Extend the smca_banks[] entry check to return if the entry is a non-reserved type. Otherwise, continue so that CPUs that encounter a known bank type can update smca_banks[].
--- arch/x86/kernel/cpu/mce/amd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/mce/amd.c +1 -1
@@ -266,7 +266,7 @@ static void smca_configure(unsigned intsmca_set_misc_banks_map (bank, cpu);/* Return early if this bank was already initialized. */ -if (smca_banks[bank].hwid) +if (smca_banks[bank].hwid && smca_banks[bank].hwid->hwid_mcatype !=0 )return ;if (rdmsr_safe (MSR_AMD64_SMCA_MCx_IPID (bank), &low, &high)) {
Greg Kroah-Hartman
maintainerPATCH 423/434 x86/mce: Fix possibly incorrect severity calculation on AMD
In reply to Greg Kroah-HartmanFrom: Jan H. Schönherr <[email protected]>
commit a3a57ddad061acc90bef39635caf2b2330ce8f21 upstream.
The function mce_severity_amd_smca() requires m->bank to be initialized for correct operation. Fix the one case, where mce_severity() is called without doing so.
--- arch/x86/kernel/cpu/mce/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/mce/core.c +1 -1
@@ -814,8 +814,8 @@ static int mce_no_way_out(struct mce *m,if (quirk_no_way_out)quirk_no_way_out (i, m, regs); + m->bank = i;if (mce_severity (m, mca_cfg.tolerant, &tmp, true) >=MCE_PANIC_SEVERITY ) { - m->bank = i;mce_read_aux (m, i); *msg = tmp;return 1 ;
Greg Kroah-Hartman
maintainerPATCH 424/434 powerpc/vcpu: Assume dedicated processors as non-preempt
In reply to Greg Kroah-HartmanFrom: Srikar Dronamraju <[email protected]>
commit 14c73bd344da60abaf7da3ea2e7733ddda35bbac upstream.
With commit 247f2f6f3c70 ("sched/core: Don't schedule threads on pre-empted vCPUs"), the scheduler avoids preempted vCPUs to schedule tasks on wakeup. This leads to wrong choice of CPU, which in-turn leads to larger wakeup latencies. Eventually, it leads to performance regression in latency sensitive benchmarks like soltp, schbench etc.
On Powerpc, vcpu_is_preempted() only looks at yield_count. If the yield_count is odd, the vCPU is assumed to be preempted. However yield_count is increased whenever the LPAR enters CEDE state (idle). So any CPU that has entered CEDE state is assumed to be preempted.
Even if vCPU of dedicated LPAR is preempted/donated, it should have right of first-use since they are supposed to own the vCPU.
On a Power9 System with 32 cores:
# lscpu Architecture: ppc64le Byte Order: Little Endian CPU(s): 128 On-line CPU(s) list: 0-127 Thread(s) per core: 8 Core(s) per socket: 1 Socket(s): 16 NUMA node(s): 2 Model: 2.2 (pvr 004e 0202) Model name: POWER9 (architected), altivec supported Hypervisor vendor: pHyp Virtualization type: para L1d cache: 32K L1i cache: 32K L2 cache: 512K L3 cache: 10240K NUMA node0 CPU(s): 0-63 NUMA node1 CPU(s): 64-127
# perf stat -a -r 5 ./schbench
v5.4 v5.4 + patch
Latency percentiles (usec) Latency percentiles (usec)
50.0000th: 45 50.0th: 45
75.0000th: 62 75.0th: 63
90.0000th: 71 90.0th: 74
95.0000th: 77 95.0th: 78
*99.0000th: 91 *99.0th: 82
99.5000th: 707 99.5th: 83
99.9000th: 6920 99.9th: 86
min=0, max=10048 min=0, max=96
Latency percentiles (usec) Latency percentiles (usec)
50.0000th: 45 50.0th: 46
75.0000th: 61 75.0th: 64
90.0000th: 72 90.0th: 75
95.0000th: 79 95.0th: 79
*99.0000th: 691 *99.0th: 83
99.5000th: 3972 99.5th: 85
99.9000th: 8368 99.9th: 91
min=0, max=16606 min=0, max=117
Latency percentiles (usec) Latency percentiles (usec)
50.0000th: 45 50.0th: 46
75.0000th: 61 75.0th: 64
90.0000th: 71 90.0th: 75
95.0000th: 77 95.0th: 79
*99.0000th: 106 *99.0th: 83
99.5000th: 2364 99.5th: 84
99.9000th: 7480 99.9th: 90
min=0, max=10001 min=0, max=95
Latency percentiles (usec) Latency percentiles (usec)
50.0000th: 45 50.0th: 47
75.0000th: 62 75.0th: 65
90.0000th: 72 90.0th: 75
95.0000th: 78 95.0th: 79
*99.0000th: 93 *99.0th: 84
99.5000th: 108 99.5th: 85
99.9000th: 6792 99.9th: 90
min=0, max=17681 min=0, max=117
Latency percentiles (usec) Latency percentiles (usec)
50.0000th: 46 50.0th: 45
75.0000th: 62 75.0th: 64
90.0000th: 73 90.0th: 75
95.0000th: 79 95.0th: 79
*99.0000th: 113 *99.0th: 82
99.5000th: 2724 99.5th: 83
99.9000th: 6184 99.9th: 93
min=0, max=9887 min=0, max=111Performance counter stats for 'system wide' (5 runs):
context-switches 43,373 ( +- 0.40% ) 44,597 ( +- 0.55% ) cpu-migrations 1,211 ( +- 5.04% ) 220 ( +- 6.23% ) page-faults 15,983 ( +- 5.21% ) 15,360 ( +- 3.38% )
Waiman Long suggested using static_keys.
--- arch/powerpc/include/asm/spinlock.h | 4 +++- arch/powerpc/platforms/pseries/setup.c | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-)
arch/powerpc/include/asm/spinlock.h +3 -1
@@ -36,10 +36,12 @@#endif #ifdef CONFIG_PPC_PSERIES +DECLARE_STATIC_KEY_FALSE (shared_processor); +#define vcpu_is_preempted vcpu_is_preemptedstatic inline bool vcpu_is_preempted (int cpu) { -if (!firmware_has_feature (FW_FEATURE_SPLPAR )) +if (!static_branch_unlikely (&shared_processor))return false;return !!(be32_to_cpu (lppaca_of (cpu).yield_count) &1 ); }
arch/powerpc/platforms/pseries/setup.c +7 -0
@@ -74,6 +74,9 @@#include "pseries.h" #include "../../../../drivers/pci/pci.h" +DEFINE_STATIC_KEY_FALSE (shared_processor); +EXPORT_SYMBOL_GPL (shared_processor); +int CMO_PrPSP =-1 ;int CMO_SecPSP =-1 ;unsigned long CMO_PageSize = (ASM_CONST (1 ) <<IOMMU_PAGE_SHIFT_4K );
@@ -758,6 +761,10 @@ static void __init pSeries_setup_arch(voif (firmware_has_feature (FW_FEATURE_LPAR )) {vpa_init (boot_cpuid); + +if (lppaca_shared_proc (get_lppaca ())) +static_branch_enable (&shared_processor); + ppc_md.power_save = pseries_lpar_idle; ppc_md.enable_pmcs = pseries_lpar_enable_pmcs;#ifdef CONFIG_PCI_IOV
Greg Kroah-Hartman
maintainerPATCH 425/434 powerpc/irq: fix stack overflow verification
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
commit 099bc4812f09155da77eeb960a983470249c9ce1 upstream.
Before commit 0366a1c70b89 ("powerpc/irq: Run softirqs off the top of the irq stack"), check_stack_overflow() was called by do_IRQ(), before switching to the irq stack.
In that commit, do_IRQ() was renamed __do_irq(), and is now executing on the irq stack, so check_stack_overflow() has just become almost useless.
Move check_stack_overflow() call in do_IRQ() to do the check while still on the current stack.
--- arch/powerpc/kernel/irq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kernel/irq.c +2 -2
@@ -619,8 +619,6 @@ void __do_irq(struct pt_regs *regs)trace_irq_entry (regs); -check_stack_overflow (); -/* * Query the platform PIC for the interrupt & ack it. *
@@ -652,6 +650,8 @@ void do_IRQ(struct pt_regs *regs) irqsp = hardirq_ctx[raw_smp_processor_id ()]; sirqsp = softirq_ctx[raw_smp_processor_id ()]; +check_stack_overflow (); +/* Already there ? */ if (unlikely (cursp == irqsp || cursp == sirqsp)) {__do_irq (regs);
Greg Kroah-Hartman
maintainerPATCH 426/434 ocxl: Fix concurrent AFU open and device removal
In reply to Greg Kroah-HartmanFrom: Frederic Barrat <[email protected]>
commit a58d37bce0d21cf7fbd589384c619e465ef2f927 upstream.
If an ocxl device is unbound through sysfs at the same time its AFU is being opened by a user process, the open code may dereference freed stuctures, which can lead to kernel oops messages. You'd have to hit a tiny time window, but it's possible. It's fairly easy to test by making the time window bigger artificially.
Fix it with a combination of 2 changes:
- when an AFU device is found in the IDR by looking for the device minor number, we should hold a reference on the device until after the context is allocated. A reference on the AFU structure is kept when the context is allocated, so we can release the reference on the device after the context allocation.
- with the fix above, there's still another even tinier window, between the time the AFU device is found in the IDR and the reference on the device is taken. We can fix this one by removing the IDR entry earlier, when the device setup is removed, instead of waiting for the 'release' device callback. With proper locking around the IDR.
--- drivers/misc/ocxl/file.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-)
drivers/misc/ocxl/file.c +11 -12
@@ -18,18 +18,15 @@ static struct class *ocxl_class;static struct mutex minors_idr_lock;static struct idr minors_idr; -static struct ocxl_file_info *find_file_info (dev_t devno) +static struct ocxl_file_info *find_and_get_file_info (dev_t devno) {struct ocxl_file_info *info; -/* -* We don't declare an RCU critical section here, as our AFU -* is protected by a reference counter on the device. By the time the -* info reference is removed from the idr, the ref count of -* the device is already at 0, so no user API will access that AFU and -* this function can't return it. -*/ +mutex_lock (&minors_idr_lock); info =idr_find (&minors_idr,MINOR (devno)); +if (info) +get_device (&info->dev); +mutex_unlock (&minors_idr_lock);return info; }
@@ -58,14 +55,16 @@ static int afu_open(struct inode *inode,pr_debug ("%s for device %x\n" , __func__, inode->i_rdev); - info =find_file_info (inode->i_rdev); + info =find_and_get_file_info (inode->i_rdev);if (!info)return -ENODEV ; rc =ocxl_context_alloc (&ctx, info->afu, inode->i_mapping); -if (rc) +if (rc) { +put_device (&info->dev);return rc; - + } +put_device (&info->dev); file->private_data = ctx;return 0 ; }
@@ -487,7 +486,6 @@ static void info_release(struct device * { struct ocxl_file_info *info = container_of(dev, struct ocxl_file_info, dev); -free_minor (info);ocxl_afu_put (info->afu);kfree (info); }
@@ -577,6 +575,7 @@ void ocxl_file_unregister_afu(struct ocxocxl_file_make_invisible (info);ocxl_sysfs_unregister_afu (info); +free_minor (info);device_unregister (&info->dev); }
Greg Kroah-Hartman
maintainerPATCH 427/434 mmc: sdhci-msm: Correct the offset and value for DDR_CONFIG register
In reply to Greg Kroah-HartmanFrom: Veerabhadrarao Badiganti <[email protected]>
commit fa56ac9792265354b565f28def7164e7d7db2b1e upstream.
The DDR_CONFIG register offset got updated after a specific minor version of sdcc V4. This offset change has not been properly taken care of while updating register changes for sdcc V5.
Correcting proper offset for this register.
Also updating this register value to reflect the recommended RCLK delay.
--- drivers/mmc/host/sdhci-msm.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-)
drivers/mmc/host/sdhci-msm.c +19 -9
@@ -99,7 +99,7 @@#define CORE_PWRSAVE_DLL BIT(3) -#define DDR_CONFIG_POR_VAL 0x80040853 +#define DDR_CONFIG_POR_VAL 0x80040873#define INVALID_TUNING_PHASE -1
@@ -148,8 +148,9 @@ struct sdhci_msm_offset {u32 core_ddr_200_cfg;u32 core_vendor_spec3;u32 core_dll_config_2; +u32 core_dll_config_3; +u32 core_ddr_config_old;/* Applicable to sdcc minor ver < 0x49 */ u32 core_ddr_config; -u32 core_ddr_config_2; };static const struct sdhci_msm_offset sdhci_msm_v5_offset = {
@@ -177,8 +178,8 @@ static const struct sdhci_msm_offset sdh .core_ddr_200_cfg = 0x224, .core_vendor_spec3 = 0x250, .core_dll_config_2 = 0x254, - .core_ddr_config = 0x258, - .core_ddr_config_2 = 0x25c, + .core_dll_config_3 = 0x258, + .core_ddr_config = 0x25c, };static const struct sdhci_msm_offset sdhci_msm_mci_offset = {
@@ -207,8 +208,8 @@ static const struct sdhci_msm_offset sdh .core_ddr_200_cfg = 0x184, .core_vendor_spec3 = 0x1b0, .core_dll_config_2 = 0x1b4, - .core_ddr_config = 0x1b8, - .core_ddr_config_2 = 0x1bc, + .core_ddr_config_old = 0x1b8, + .core_ddr_config = 0x1bc, };struct sdhci_msm_variant_ops {
@@ -253,6 +254,7 @@ struct sdhci_msm_host {const struct sdhci_msm_offset *offset;bool use_cdr;u32 transfer_mode; +bool updated_ddr_cfg; };static const struct sdhci_msm_offset *sdhci_priv_msm_offset (struct sdhci_host *host)
@@ -924,8 +926,10 @@ out:static int sdhci_msm_cm_dll_sdc4_calibration (struct sdhci_host *host) {struct mmc_host *mmc = host->mmc; -u32 dll_status, config; +u32 dll_status, config, ddr_cfg_offset;int ret; +struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host); +struct sdhci_msm_host *msm_host =sdhci_pltfm_priv (pltfm_host);const struct sdhci_msm_offset *msm_offset =sdhci_priv_msm_offset (host);
@@ -938,8 +942,11 @@ static int sdhci_msm_cm_dll_sdc4_calibra* bootloaders. In the future, if this changes, then the desired * values will need to be programmed appropriately. */ -writel_relaxed (DDR_CONFIG_POR_VAL , host->ioaddr + - msm_offset->core_ddr_config); +if (msm_host->updated_ddr_cfg) + ddr_cfg_offset = msm_offset->core_ddr_config; +else + ddr_cfg_offset = msm_offset->core_ddr_config_old; +writel_relaxed (DDR_CONFIG_POR_VAL , host->ioaddr + ddr_cfg_offset);if (mmc->ios.enhanced_strobe) { config = readl_relaxed(host->ioaddr +
@@ -1899,6 +1906,9 @@ static int sdhci_msm_probe(struct platfo msm_offset->core_vendor_spec_capabilities0); } +if (core_major ==1 && core_minor >=0x49 ) + msm_host->updated_ddr_cfg = true; +/* * Power on reset state may trigger power irq if previous status of * PWRCTL was either BUS_ON or IO_HIGH_V. So before enabling pwr irq
Greg Kroah-Hartman
maintainerPATCH 428/434 mmc: sdhci-of-esdhc: Revert "mmc: sdhci-of-esdhc: add erratum A-009204 support"
In reply to Greg Kroah-HartmanFrom: Rasmus Villemoes <[email protected]>
commit 8b6dc6b2d60221e90703babbc141f063b8a07e72 upstream.
This reverts commit 5dd195522562542bc6ebe6e7bd47890d8b7ca93c.
First, the fix seems to be plain wrong, since the erratum suggests waiting 5ms before setting setting SYSCTL[RSTD], but this msleep() happens after the call of sdhci_reset() which is where that bit gets set (if SDHCI_RESET_DATA is in mask).
Second, walking the whole device tree to figure out if some node has a "fsl,p2020-esdhc" compatible string is hugely expensive - about 70 to 100 us on our mpc8309 board. Walking the device tree is done under a raw_spin_lock, so this is obviously really bad on an -rt system, and a waste of time on all.
In fact, since esdhc_reset() seems to get called around 100 times per second, that mpc8309 now spends 0.8% of its time determining that it is not a p2020. Whether those 100 calls/s are normal or due to some other bug or misconfiguration, regularly hitting a 100 us non-preemptible window is unacceptable.
--- drivers/mmc/host/sdhci-of-esdhc.c | 3 --- 1 file changed, 3 deletions(-)
drivers/mmc/host/sdhci-of-esdhc.c +0 -3
@@ -710,9 +710,6 @@ static void esdhc_reset(struct sdhci_hossdhci_writel (host, host->ier,SDHCI_INT_ENABLE );sdhci_writel (host, host->ier,SDHCI_SIGNAL_ENABLE ); -if (of_find_compatible_node (NULL ,NULL ,"fsl,p2020-esdhc" )) -mdelay (5 ); -if (mask &SDHCI_RESET_ALL ) { val =sdhci_readl (host,ESDHC_TBCTL ); val &= ~ESDHC_TB_EN ;
Greg Kroah-Hartman
maintainerPATCH 429/434 mmc: sdhci: Update the tuning failed messages to pr_debug level
In reply to Greg Kroah-HartmanFrom: Faiz Abbas <[email protected]>
commit 2c92dd20304f505b6ef43d206fff21bda8f1f0ae upstream.
Tuning support in DDR50 speed mode was added in SD Specifications Part1 Physical Layer Specification v3.01. Its not possible to distinguish between v3.00 and v3.01 from the SCR and that is why since commit 4324f6de6d2e ("mmc: core: enable CMD19 tuning for DDR50 mode") tuning failures are ignored in DDR50 speed mode.
Cards compatible with v3.00 don't respond to CMD19 in DDR50 and this error gets printed during enumeration and also if retune is triggered at any time during operation. Update the printk level to pr_debug so that these errors don't lead to false error reports.
--- drivers/mmc/host/sdhci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci.c +2 -2
@@ -2406,8 +2406,8 @@ static int __sdhci_execute_tuning(structsdhci_send_tuning (host, opcode);if (!host->tuning_done) { -pr_info ("%s: Tuning timeout, falling back to fixed sampling clock\n" , -mmc_hostname (host->mmc)); +pr_debug ("%s: Tuning timeout, falling back to fixed sampling clock\n" , +mmc_hostname (host->mmc));sdhci_abort_tuning (host, opcode);return -ETIMEDOUT ; }
Greg Kroah-Hartman
maintainerPATCH 430/434 mmc: sdhci-of-esdhc: fix P2020 errata handling
In reply to Greg Kroah-HartmanFrom: Yangbo Lu <[email protected]>
commit fe0acab448f68c3146235afe03fb932e242ec94c upstream.
Two previous patches introduced below quirks for P2020 platforms.
- SDHCI_QUIRK_RESET_AFTER_REQUEST
- SDHCI_QUIRK_BROKEN_TIMEOUT_VAL
The patches made a mistake to add them in quirks2 of sdhci_host structure, while they were defined for quirks.
host->quirks2 |= SDHCI_QUIRK_RESET_AFTER_REQUEST; host->quirks2 |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
This patch is to fix them.
host->quirks |= SDHCI_QUIRK_RESET_AFTER_REQUEST; host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
--- drivers/mmc/host/sdhci-of-esdhc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-of-esdhc.c +2 -2
@@ -1123,8 +1123,8 @@ static int sdhci_esdhc_probe(struct plat host->quirks &= ~SDHCI_QUIRK_NO_BUSY_IRQ ;if (of_find_compatible_node (NULL ,NULL ,"fsl,p2020-esdhc" )) { - host->quirks2 |=SDHCI_QUIRK_RESET_AFTER_REQUEST ; - host->quirks2 |=SDHCI_QUIRK_BROKEN_TIMEOUT_VAL ; + host->quirks |=SDHCI_QUIRK_RESET_AFTER_REQUEST ; + host->quirks |=SDHCI_QUIRK_BROKEN_TIMEOUT_VAL ; } if (of_device_is_compatible(np, "fsl,p5040-esdhc") ||
Greg Kroah-Hartman
maintainerPATCH 431/434 mmc: sdhci: Workaround broken command queuing on Intel GLK
In reply to Greg Kroah-HartmanFrom: Adrian Hunter <[email protected]>
commit bedf9fc01ff1f40cfd1a79ccacedd9f3cd8e652a upstream.
Command queuing has been reported broken on some Lenovo systems based on Intel GLK. This is likely a BIOS issue, so disable command queuing for Intel GLK if the BIOS vendor string is "LENOVO".
--- drivers/mmc/host/sdhci-pci-core.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-pci-core.c +9 -1
@@ -26,6 +26,7 @@#include <linux/mmc/slot-gpio.h> #include <linux/mmc/sdhci-pci-data.h> #include <linux/acpi.h> +#include <linux/dmi.h> #ifdef CONFIG_X86 #include <asm/iosf_mbi.h>
@@ -782,11 +783,18 @@ static int byt_emmc_probe_slot(struct sdreturn 0 ; } +static bool glk_broken_cqhci (struct sdhci_pci_slot *slot) +{ +return slot->chip->pdev->device ==PCI_DEVICE_ID_INTEL_GLK_EMMC && +dmi_match (DMI_BIOS_VENDOR ,"LENOVO" ); +} +static int glk_emmc_probe_slot (struct sdhci_pci_slot *slot) {int ret =byt_emmc_probe_slot (slot); - slot->host->mmc->caps2 |=MMC_CAP2_CQE ; +if (!glk_broken_cqhci (slot)) + slot->host->mmc->caps2 |=MMC_CAP2_CQE ;if (slot->chip->pdev->device !=PCI_DEVICE_ID_INTEL_GLK_EMMC ) { slot->host->mmc->caps2 |= MMC_CAP2_HS400_ES,
Greg Kroah-Hartman
maintainerPATCH 432/434 mmc: sdhci: Add a quirk for broken command queuing
In reply to Greg Kroah-HartmanFrom: Adrian Hunter <[email protected]>
commit 75d27ea1abf7af3cc2cdec3513e74f52191605c8 upstream.
Command queuing has been reported broken on some systems based on Intel GLK. A separate patch disables command queuing in some cases.
This patch adds a quirk for broken command queuing, which enables users with problems to disable command queuing using sdhci module parameters for quirks.
--- drivers/mmc/host/sdhci.c | 3 +++ drivers/mmc/host/sdhci.h | 2 ++ 2 files changed, 5 insertions(+)
drivers/mmc/host/sdhci.c +3 -0
@@ -3756,6 +3756,9 @@ int sdhci_setup_host(struct sdhci_host * mmc_hostname(mmc), host->version); } +if (host->quirks &SDHCI_QUIRK_BROKEN_CQE ) + mmc->caps2 &= ~MMC_CAP2_CQE ; +if (host->quirks &SDHCI_QUIRK_FORCE_DMA ) host->flags |=SDHCI_USE_SDMA ;else if (!(host->caps &SDHCI_CAN_DO_SDMA ))
drivers/mmc/host/sdhci.h +2 -0
@@ -409,6 +409,8 @@ struct sdhci_host {#define SDHCI_QUIRK_BROKEN_CARD_DETECTION (1<<15)/* Controller reports inverted write-protect state */ #define SDHCI_QUIRK_INVERTED_WRITE_PROTECT (1<<16) +/* Controller has unusable command queue engine */ +#define SDHCI_QUIRK_BROKEN_CQE (1<<17)/* Controller does not like fast PIO transfers */ #define SDHCI_QUIRK_PIO_NEEDS_DELAY (1<<18)/* Controller does not have a LED */
Greg Kroah-Hartman
maintainerPATCH 433/434 nbd: fix shutdown and recv work deadlock v2
In reply to Greg Kroah-HartmanFrom: Mike Christie <[email protected]>
commit 1c05839aa973cfae8c3db964a21f9c0eef8fcc21 upstream.
This fixes a regression added with:
commit e9e006f5fcf2bab59149cb38a48a4817c1b538b4
Author: Mike Christie <[email protected]> Date: Sun Aug 4 14:10:06 2019 -0500
nbd: fix max number of supported devs
where we can deadlock during device shutdown. The problem occurs if the recv_work's nbd_config_put occurs after nbd_start_device_ioctl has returned and the userspace app has droppped its reference via closing the device and running nbd_release. The recv_work nbd_config_put call would then drop the refcount to zero and try to destroy the config which would try to do destroy_workqueue from the recv work.
This patch just has nbd_start_device_ioctl do a flush_workqueue when it wakes so we know after the ioctl returns running works have exited. This also fixes a possible race where we could try to reuse the device while old recv_works are still running.
--- drivers/block/nbd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/block/nbd.c +3 -3
@@ -1296,10 +1296,10 @@ static int nbd_start_device_ioctl(structmutex_unlock (&nbd->config_lock); ret =wait_event_interruptible (config->recv_wq,atomic_read (&config->recv_threads) ==0 ); -if (ret) { +if (ret)sock_shutdown (nbd); -flush_workqueue (nbd->recv_workq); - } +flush_workqueue (nbd->recv_workq); +mutex_lock (&nbd->config_lock);nbd_bdev_reset (bdev);/* user requested, ignore socket errors */
Greg Kroah-Hartman
maintainerPATCH 434/434 iwlwifi: pcie: move power gating workaround earlier in the flow
In reply to Greg Kroah-HartmanFrom: Luca Coelho <[email protected]>
commit 0df36b90c47d93295b7e393da2d961b2f3b6cde4 upstream.
We need to reset the NIC after setting the bits to enable power gating and that cannot be done too late in the flow otherwise it cleans other registers and things that were already configured, causing initialization to fail.
In order to fix this, move the function to the common code in trans.c so it can be called directly from there at an earlier point, just after the reset we already do during initialization.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=205719
--- drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c | 25 --------------- drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 30 +++++++++++++++++++ 2 files changed, 30 insertions(+), 25 deletions(-)
drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c +0 -25
@@ -57,24 +57,6 @@#include "internal.h" #include "fw/dbg.h" -static int iwl_pcie_gen2_force_power_gating (struct iwl_trans *trans) -{ -iwl_set_bits_prph (trans,HPM_HIPM_GEN_CFG , -HPM_HIPM_GEN_CFG_CR_FORCE_ACTIVE ); -udelay (20 ); -iwl_set_bits_prph (trans,HPM_HIPM_GEN_CFG , -HPM_HIPM_GEN_CFG_CR_PG_EN | -HPM_HIPM_GEN_CFG_CR_SLP_EN ); -udelay (20 ); -iwl_clear_bits_prph (trans,HPM_HIPM_GEN_CFG , -HPM_HIPM_GEN_CFG_CR_FORCE_ACTIVE ); - -iwl_trans_sw_reset (trans); -iwl_clear_bit (trans,CSR_GP_CNTRL ,CSR_GP_CNTRL_REG_FLAG_INIT_DONE ); - -return 0 ; -} -/* * Start up NIC's basic functionality after it has been reset * (e.g. after platform boot, or shutdown via iwl_pcie_apm_stop())
@@ -110,13 +92,6 @@ int iwl_pcie_gen2_apm_init(struct iwl_triwl_pcie_apm_config (trans); -if (trans->trans_cfg->device_family ==IWL_DEVICE_FAMILY_22000 && - trans->cfg->integrated) { - ret =iwl_pcie_gen2_force_power_gating (trans); -if (ret) -return ret; - } - ret =iwl_finish_nic_init (trans, trans->trans_cfg);if (ret)return ret;
drivers/net/wireless/intel/iwlwifi/pcie/trans.c +30 -0
@@ -1783,6 +1783,29 @@ static int iwl_trans_pcie_clear_persistereturn 0 ; } +static int iwl_pcie_gen2_force_power_gating (struct iwl_trans *trans) +{ +int ret; + + ret =iwl_finish_nic_init (trans, trans->trans_cfg); +if (ret <0 ) +return ret; + +iwl_set_bits_prph (trans,HPM_HIPM_GEN_CFG , +HPM_HIPM_GEN_CFG_CR_FORCE_ACTIVE ); +udelay (20 ); +iwl_set_bits_prph (trans,HPM_HIPM_GEN_CFG , +HPM_HIPM_GEN_CFG_CR_PG_EN | +HPM_HIPM_GEN_CFG_CR_SLP_EN ); +udelay (20 ); +iwl_clear_bits_prph (trans,HPM_HIPM_GEN_CFG , +HPM_HIPM_GEN_CFG_CR_FORCE_ACTIVE ); + +iwl_trans_pcie_sw_reset (trans); + +return 0 ; +} +static int _iwl_trans_pcie_start_hw (struct iwl_trans *trans) {struct iwl_trans_pcie *trans_pcie =IWL_TRANS_GET_PCIE_TRANS (trans);
@@ -1802,6 +1825,13 @@ static int _iwl_trans_pcie_start_hw(struiwl_trans_pcie_sw_reset (trans); +if (trans->trans_cfg->device_family ==IWL_DEVICE_FAMILY_22000 && + trans->cfg->integrated) { + err =iwl_pcie_gen2_force_power_gating (trans); +if (err) +return err; + } + err =iwl_pcie_apm_init (trans);if (err)return err;
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.7 release. There are 434 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 Tue, 31 Dec 2019 17:25:52 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.7-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Greg Kroah-Hartman
maintainerQuoted 15 lines · shuah
Quoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.7 release. There are 434 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 Tue, 31 Dec 2019 17:25:52 +0000. 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/v5.x/stable-review/patch-5.4.7-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.
Quoted 6 lines
Quoted 4 lines
thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
Thanks for testing all 3 of these and letting me know.
greg k-h
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.7 release. There are 434 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.
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
Summary
------------------------------------------------------------------------
kernel: 5.4.7-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-5.4.y
git commit: 6bc086f94af53b930b413d3cc85fe11061b4a0a2
git describe: v5.4.6-436-g6bc086f94af5
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-5.4-oe/build/v5.4.6-436-g6bc086f94af5
No regressions (compared to build v5.4.6)
No fixes (compared to build v5.4.6)
Ran 22880 total tests in the following environments and test suites.
Environments
--------------
- dragonboard-410c
- hi6220-hikey
- i386
- juno-r2
- qemu_arm
- qemu_arm64
- qemu_i386
- qemu_x86_64
- x15
- x86
Test Suites
-----------
* build
* install-android-platform-tools-r2600
* kselftest
* libgpiod
* libhugetlbfs
* linux-log-parser
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-cpuhotplug-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* network-basic-tests
* perf
* spectre-meltdown-checker-test
* v4l2-compliance
* ltp-hugetlb-tests
* ltp-mm-tests
* ltp-open-posix-tests
* ltp-syscalls-tests
* kvm-unit-tests
* kselftest-vsyscall-mode-native
* kselftest-vsyscall-mode-none
* ssuite
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org
Greg Kroah-Hartman
maintainerQuoted 8 lines · Dan Rue
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.7 release. There are 434 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.
Results from Linaro’s test farm.
No regressions on arm64, arm,x86_64, and i386.
Thanks for testing all of these and letting me know.
But didn't you add perf build testing to your builds? That should have broken things, so I am guessing not :(
greg k-h
Quoted 7 lines · Greg Kroah-Hartman
Quoted 6 lines · Dan Rue
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.7 release. There are 434 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.
Quoted 7 lines
Quoted 2 lines
Results from Linaro’s test farm.
No regressions on arm64, arm,x86_64, and i386.Thanks for testing all of these and letting me know.
But didn't you add perf build testing to your builds? That should have broken things, so I am guessing not :(
We do build (and run) perf, and it worked for us. Which patch was the problem? I can go look at why our config didn't hit the offending code/build path.
Dan
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org
Greg Kroah-Hartman
maintainerQuoted 11 lines · Dan Rue
Quoted 10 lines · Greg Kroah-Hartman
Quoted 8 lines · Dan Rue
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.7 release. There are 434 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.
Results from Linaro’s test farm.
No regressions on arm64, arm,x86_64, and i386.
Quoted 8 lines
Quoted 4 lines
Thanks for testing all of these and letting me know.
But didn't you add perf build testing to your builds? That should have broken things, so I am guessing not :(
We do build (and run) perf, and it worked for us. Which patch was the problem? I can go look at why our config didn't hit the offending code/build path.
See the thread from Guenter and from others on the perf patches themselves in this release for the details.
thanks,
greg k-h
Quoted 17 lines · Greg Kroah-Hartman
Quoted 16 lines · Dan Rue
Quoted 14 lines · Greg Kroah-Hartman
Quoted 8 lines · Dan Rue
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.7 release. There are 434 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.
Results from Linaro’s test farm.
No regressions on arm64, arm,x86_64, and i386.Thanks for testing all of these and letting me know.
But didn't you add perf build testing to your builds? That should have broken things, so I am guessing not :(
Quoted 7 lines
Quoted 3 lines
We do build (and run) perf, and it worked for us. Which patch was the problem? I can go look at why our config didn't hit the offending code/build path.
See the thread from Guenter and from others on the perf patches themselves in this release for the details.
perf is a beast. It only builds everything if a large number of support libraries is installed on the build system. If not, it only builds a small subset. I bet my test builds hit the failure because I have some library installed on my build servers that isn't installed on Linaro's servers.
This is why I can't cross-build perf; my cross build environments don't have the necessary libraries installed.
Guenter
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.7 release. There are 434 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 Tue, 31 Dec 2019 17:25:52 +0000. Anything received after that time might be too late.
Build results:
total: 158 pass: 145 fail: 13 Failed builds: <all mips> Qemu test results: total: 385 pass: 320 fail: 65
Failed tests:
<all mips>
<all ppc64_book3s_defconfig>
mips and ppc64 failures are as with v4.19.y.
Guenter
Greg Kroah-Hartman
maintainerQuoted 16 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.7 release. There are 434 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 Tue, 31 Dec 2019 17:25:52 +0000. Anything received after that time might be too late.
Build results:
total: 158 pass: 145 fail: 13 Failed builds: <all mips> Qemu test results: total: 385 pass: 320 fail: 65
Quoted 5 lines
Failed tests:
<all mips>
<allppc64_book3s_defconfig>mips and ppc64 failures are as with v4.19.y.
thanks, will go fix and push out a -rc2
greg k-h
Greg Kroah-Hartman
maintainerQuoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.7 release. There are 434 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.
Quoted 8 lines
Responses should be made by Tue, 31 Dec 2019 17:25:52 +0000. 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/v5.x/stable-review/patch-5.4.7-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.
I have pushed out -rc2:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.7-rc2.gz
to resolve some reported issues.
greg k-h
Hi Greg,
Quoted 4 lines · Greg Kroah-Hartman
I have pushed out -rc2:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.7-rc2.gzto resolve some reported issues.
OK, running right now on my netbook. So far, so good:
Linux eeepc 5.4.7-rc2-eeepc #1 SMP Mon Dec 30 18:55:14 CET 2019 i686 Intel(R) Atom(TM) CPU N2800 @ 1.86GHz GenuineIntel GNU/Linux
Also not sure what is supposed not to work with perf, but at least I've built it and it seems to work as expected at first glance.
Hoping this helps,
Willy
Greg Kroah-Hartman
maintainerQuoted 6 lines · Willy Tarreau
Hi Greg,
Quoted 3 lines · Greg Kroah-Hartman
I have pushed out -rc2:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.7-rc2.gz
Quoted 8 lines
Quoted 1 line
to resolve some reported issues.
OK, running right now on my netbook. So far, so good:
Linux eeepc 5.4.7-rc2-eeepc #1 SMP Mon Dec 30 18:55:14 CET 2019 i686 Intel(R) Atom(TM) CPU N2800 @ 1.86GHz GenuineIntel GNU/Linux
Also not sure what is supposed not to work with perf, but at least I've built it and it seems to work as expected at first glance.
If it builds, then the problem is fixed, as that is what was previously failing :)
thanks for testing and letting me know.
greg k-h
Quoted 15 lines · Greg Kroah-Hartman
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.7 release. There are 434 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.
Quoted 8 lines
Responses should be made by Tue, 31 Dec 2019 17:25:52 +0000. 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/v5.x/stable-review/patch-5.4.7-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.
Quoted 6 lines
I have pushed out -rc2:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.7-rc2.gzto resolve some reported issues.
greg k-h
i have compiled 5.4.7-rc2+ related and "dmesg -l err" has no new errors. "dmesg -l warn" all clean
--
software engineer
rajagiri school of engineering and technology
Jon Hunter
maintainerQuoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.7 release. There are 434 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 Tue, 31 Dec 2019 17:25:52 +0000. 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/v5.x/stable-review/patch-5.4.7-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.
Quoted 5 lines
thanks,
greg k-h
-------------
All tests are passing for Tegra ...
Test results for stable-v5.4:
13 builds: 13 pass, 0 fail
22 boots: 22 pass, 0 fail
38 tests: 38 pass, 0 failLinux version: 5.4.7-rc1-g6bc086f94af5
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra20-ventana,
tegra210-p2371-2180, tegra30-cardhu-a04Cheers
Jon
Signature · 1 line
nvpublic
Greg Kroah-Hartman
maintainerQuoted 25 lines · Jon Hunter
Quoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.7 release. There are 434 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 Tue, 31 Dec 2019 17:25:52 +0000. 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/v5.x/stable-review/patch-5.4.7-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.Quoted 5 lines
thanks,
greg k-h
-------------
All tests are passing for Tegra ...
Test results for stable-v5.4:
Quoted 9 lines
13 builds: 13 pass, 0 fail 22 boots: 22 pass, 0 fail 38 tests: 38 pass, 0 failLinux version: 5.4.7-rc1-g6bc086f94af5
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,tegra194-p2972-0000, tegra20-ventana, tegra210-p2371-2180, tegra30-cardhu-a04
Thanks for testing all of these and letting me know.
greg k-h
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.7 release. There are 434 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 Tue, 31 Dec 2019 17:25:52 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.7-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.thanks,
greg k-h
i have compiled 5.4.7-rc2+ related and "dmesg -l err" has no new errors. "dmesg -l warn" all clean
--
software engineer
rajagiri school of engineering and technology
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.7 release. There are 434 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 Tue, 31 Dec 2019 17:25:52 +0000. Anything received after that time might be too late.
For -rc2:
Build results:
total: 158 pass: 148 fail: 10 Failed builds: <almost all mips> Qemu test results: total: 385 pass: 320 fail: 65
Failed tests:
<all mips>
<ppc64 as with mainline and v4.19.y>
mips and ppc as previously reported.
mips:
In file included from kernel/futex.c:60:arch/mips/include/asm/futex.h:19:10: fatal error: asm/sync.h: No such file or directory
ppc:
./arch/powerpc/include/asm/spinlock.h:39:1: error: type defaults to ‘int’ in declaration of ‘DECLARE_STATIC_KEY_FALSE’ [-Werror=implicit-int] ./arch/powerpc/include/asm/spinlock.h:39:1: warning: parameter names (without types) in function declaration ./arch/powerpc/include/asm/spinlock.h: In function ‘vcpu_is_preempted’:./arch/powerpc/include/asm/spinlock.h:44:7: error: implicit declaration of function ‘static_branch_unlikely’
Guenter
Greg Kroah-Hartman
maintainerQuoted 22 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.7 release. There are 434 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 Tue, 31 Dec 2019 17:25:52 +0000. Anything received after that time might be too late.
For -rc2:
Build results:
total: 158 pass: 148 fail: 10 Failed builds: <almost all mips> Qemu test results: total: 385 pass: 320 fail: 65Failed tests:
<all mips>
<ppc64 as with mainline and v4.19.y>
Quoted 6 lines
mips and ppc as previously reported.
mips:
In file included from
kernel/futex.c:60:arch/mips/include/asm/futex.h:19:10: fatal error:asm/sync.h: No such file or directory
Ugh, I thought I caught this already. I'll go queue up a revert for the next 5.4.y release with this fixed.
thanks,
greg k-h