5.0.7-stable review
Subsystems (12)
Greg Kroah-Hartman
maintainerPATCH 125/246 cgroup, rstat: Dont flush subtree root unless necessary
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit b4ff1b44bcd384d22fcbac6ebaf9cc0d33debe50 ]
cgroup_rstat_cpu_pop_updated() is used to traverse the updated cgroups on flush. While it was only visiting updated ones in the subtree, it was visiting @root unconditionally. We can easily check whether @root is updated or not by looking at its ->updated_next just as with the cgroups in the subtree.
* Remove the unnecessary cgroup_parent() test. The system root cgroup is never updated and thus its ->updated_next is always NULL. No need to test whether cgroup_parent() exists in addition to ->updated_next.
* Terminate traverse if ->updated_next is NULL. This can only happen for subtree @root and there's no reason to visit it if it's not marked updated.
This reduces cpu consumption when reading a lot of rstat backed files. In a micro benchmark reading stat from ~1600 cgroups, the sys time was lowered by >40%.
--- kernel/cgroup/rstat.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
kernel/cgroup/rstat.c +6 -4
@@ -87,7 +87,6 @@ static struct cgroup *cgroup_rstat_cpu_pop_updated(struct cgroup *pos, struct cgroup *root, int cpu) {struct cgroup_rstat_cpu *rstatc; -struct cgroup *parent;if (pos == root)return NULL ;
@@ -115,8 +114,8 @@ static struct cgroup *cgroup_rstat_cpu_pop_updated(struct cgroup *pos,* However, due to the way we traverse, @pos will be the first * child in most cases. The only exception is @root. */ - parent =cgroup_parent (pos); -if (parent && rstatc->updated_next) { +if (rstatc->updated_next) { +struct cgroup *parent =cgroup_parent (pos);struct cgroup_rstat_cpu *prstatc =cgroup_rstat_cpu (parent, cpu);struct cgroup_rstat_cpu *nrstatc;struct cgroup **nextp;
@@ -140,9 +139,12 @@ static struct cgroup *cgroup_rstat_cpu_pop_updated(struct cgroup *pos,* updated stat. */ smp_mb (); + +return pos; } -return pos; +/* only happens for @root */ +return NULL ; }/* see cgroup_rstat_flush() */
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 126/246 efi: Fix build error due to enum collision between efi.h and ima.h
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 5c418dc789a3898717ebf2caa5716ba91a7150b2 ]
The following commit:
a893ea15d764 ("tpm: move tpm_chip definition to include/linux/tpm.h")
introduced a build error when both IMA and EFI are enabled:
In file included from ../security/integrity/ima/ima_fs.c:30:
../security/integrity/ima/ima.h:176:7: error: redeclaration of enumerator "NONE"
What happens is that both headers (ima.h and efi.h) defines the same 'NONE' constant, and it broke when they started getting included from the same file:
Rework to prefix the EFI enum with 'EFI_*'.
--- arch/x86/platform/efi/quirks.c | 4 +-- drivers/firmware/efi/runtime-wrappers.c | 48 ++++++++++++------------- include/linux/efi.h | 26 +++++++------- 3 files changed, 39 insertions(+), 39 deletions(-)
arch/x86/platform/efi/quirks.c +2 -2
@@ -717,7 +717,7 @@ void efi_recover_from_page_fault(unsigned long phys_addr)* "efi_mm" cannot be used to check if the page fault had occurred * in the firmware context because efi=old_map doesn't use efi_pgd. */ -if (efi_rts_work.efi_rts_id ==NONE ) +if (efi_rts_work.efi_rts_id ==EFI_NONE )return ;/*
@@ -742,7 +742,7 @@ void efi_recover_from_page_fault(unsigned long phys_addr)* because this case occurs *very* rarely and hence could be improved * on a need by basis. */ -if (efi_rts_work.efi_rts_id ==RESET_SYSTEM ) { +if (efi_rts_work.efi_rts_id ==EFI_RESET_SYSTEM ) {pr_info ("efi_reset_system() buggy! Reboot through BIOS\n" );machine_real_restart (MRR_BIOS );return ;
drivers/firmware/efi/runtime-wrappers.c +24 -24
165 lines not on this page · raw message
include/linux/efi.h +13 -13
@@ -1699,19 +1699,19 @@ extern int efi_tpm_eventlog_init(void);* fault happened while executing an efi runtime service. */ enum efi_rts_ids { -NONE , -GET_TIME , -SET_TIME , -GET_WAKEUP_TIME , -SET_WAKEUP_TIME , -GET_VARIABLE , -GET_NEXT_VARIABLE , -SET_VARIABLE , -QUERY_VARIABLE_INFO , -GET_NEXT_HIGH_MONO_COUNT , -RESET_SYSTEM , -UPDATE_CAPSULE , -QUERY_CAPSULE_CAPS , +EFI_NONE , +EFI_GET_TIME , +EFI_SET_TIME , +EFI_GET_WAKEUP_TIME , +EFI_SET_WAKEUP_TIME , +EFI_GET_VARIABLE , +EFI_GET_NEXT_VARIABLE , +EFI_SET_VARIABLE , +EFI_QUERY_VARIABLE_INFO , +EFI_GET_NEXT_HIGH_MONO_COUNT , +EFI_RESET_SYSTEM , +EFI_UPDATE_CAPSULE , +EFI_QUERY_CAPSULE_CAPS , };/*
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 127/246 drm/sched: Fix entities with 0 rqs.
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 1decbf6bb0b4dc56c9da6c5e57b994ebfc2be3aa ]
Some blocks in amdgpu can have 0 rqs.
Job creation already fails with -ENOENT when entity->rq is NULL, so jobs cannot be pushed. Without a rq there is no scheduler to pop jobs, and rq selection already does the right thing with a list of length 0.
So the operations we need to fix are:
- Creation, do not set rq to rq_list[0] if the list can have length 0.
- Do not flush any jobs when there is no rq.
- On entity destruction handle the rq = NULL case.
- on set_priority, do not try to change the rq if it is NULL.
--- drivers/gpu/drm/scheduler/sched_entity.c | 39 ++++++++++++++++-------- 1 file changed, 26 insertions(+), 13 deletions(-)
drivers/gpu/drm/scheduler/sched_entity.c +26 -13
@@ -52,12 +52,12 @@ int drm_sched_entity_init(struct drm_sched_entity *entity, {int i; -if (!(entity && rq_list && num_rq_list >0 && rq_list[0 ])) +if (!(entity && rq_list && (num_rq_list ==0 || rq_list[0 ])))return -EINVAL ;memset (entity,0 ,sizeof (struct drm_sched_entity ));INIT_LIST_HEAD (&entity->list); - entity->rq = rq_list[0 ]; + entity->rq =NULL ; entity->guilty = guilty; entity->num_rq_list = num_rq_list; entity->rq_list = kcalloc(num_rq_list, sizeof(struct drm_sched_rq *),
@@ -67,6 +67,10 @@ int drm_sched_entity_init(struct drm_sched_entity *entity,for (i =0 ; i < num_rq_list; ++i) entity->rq_list[i] = rq_list[i]; + +if (num_rq_list) + entity->rq = rq_list[0 ]; + entity->last_scheduled =NULL ;spin_lock_init (&entity->rq_lock);
@@ -165,6 +169,9 @@ long drm_sched_entity_flush(struct drm_sched_entity *entity, long timeout)struct task_struct *last_user;long ret = timeout; +if (!entity->rq) +return 0 ; + sched = entity->rq->sched;/** * The client will not queue more IBs during this fini, consume existing
@@ -264,20 +271,24 @@ static void drm_sched_entity_kill_jobs(struct drm_sched_entity *entity)*/ void drm_sched_entity_fini (struct drm_sched_entity *entity) { -struct drm_gpu_scheduler *sched; +struct drm_gpu_scheduler *sched =NULL ; - sched = entity->rq->sched; -drm_sched_rq_remove_entity (entity->rq, entity); +if (entity->rq) { + sched = entity->rq->sched; +drm_sched_rq_remove_entity (entity->rq, entity); + }/* Consumption of existing IBs wasn't completed. Forcefully * remove them here. */ if (spsc_queue_peek (&entity->job_queue)) { -/* Park the kernel for a moment to make sure it isn't processing -* our enity. -*/ -kthread_park (sched->thread); -kthread_unpark (sched->thread); +if (sched) { +/* Park the kernel for a moment to make sure it isn't processing +* our enity. +*/ +kthread_park (sched->thread); +kthread_unpark (sched->thread); + }if (entity->dependency) {dma_fence_remove_callback (entity->dependency, &entity->cb);
@@ -362,9 +373,11 @@ void drm_sched_entity_set_priority(struct drm_sched_entity *entity,for (i =0 ; i < entity->num_rq_list; ++i)drm_sched_entity_set_rq_priority (&entity->rq_list[i], priority); -drm_sched_rq_remove_entity (entity->rq, entity); -drm_sched_entity_set_rq_priority (&entity->rq, priority); -drm_sched_rq_add_entity (entity->rq, entity); +if (entity->rq) { +drm_sched_rq_remove_entity (entity->rq, entity); +drm_sched_entity_set_rq_priority (&entity->rq, priority); +drm_sched_rq_add_entity (entity->rq, entity); + }spin_unlock (&entity->rq_lock); }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 128/246 regulator: core: Take lock before applying system load
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit e5e21f70bfd3a201e627b48aed82793d1bcd6f78 ]
Take the regulator lock before applying system load.
Fixes the following lockdep splat:
[ 5.583581] WARNING: CPU: 1 PID: 16 at drivers/regulator/core.c:925 drms_uA_update+0x114/0x360 [ 5.588467] Modules linked in: [ 5.596833] CPU: 1 PID: 16 Comm: kworker/1:0 Not tainted 5.0.0-rc6-next-20190213-00002-g0fce66ab480f #18 [ 5.599933] Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT) [ 5.609544] Workqueue: events qcom_channel_state_worker [ 5.616209] pstate: 60000005 (nZCv daif -PAN -UAO) [ 5.621152] pc : drms_uA_update+0x114/0x360 [ 5.626006] lr : drms_uA_update+0x110/0x360 [ 5.630084] sp : ffff0000124b3490 [ 5.634242] x29: ffff0000124b3490 x28: ffff800005326e00 [ 5.637735] x27: ffff0000124b35f8 x26: 000000000032bc48 [ 5.643117] x25: ffff800004c7e800 x24: ffff800004c6d500 [ 5.648411] x23: ffff800004c38a80 x22: 00000000000000d1 [ 5.653706] x21: 00000000001ab3f0 x20: ffff800004c7e800 [ 5.659001] x19: ffff0000114c3000 x18: ffffffffffffffff [ 5.664297] x17: 0000000000000000 x16: 0000000000000000 [ 5.669592] x15: ffff0000114c3808 x14: 0720072007200720 [ 5.674888] x13: 00000000199c9b28 x12: ffff80002bcccc40 [ 5.680183] x11: ffff000012286000 x10: ffff0000114c3808 [ 5.685477] x9 : 0720072007200720 x8 : ffff000010e9e808 [ 5.690772] x7 : ffff0000106da568 x6 : 0000000000000000 [ 5.696067] x5 : 0000000000000000 x4 : 0000000000000000 [ 5.701362] x3 : 0000000000000004 x2 : 0000000000000000 [ 5.706658] x1 : 0000000000000000 x0 : 0000000000000000 [ 5.711952] Call trace: [ 5.717223] drms_uA_update+0x114/0x360 [ 5.719405] regulator_register+0xb30/0x1140 [ 5.723230] devm_regulator_register+0x4c/0xa8 [ 5.727745] rpm_reg_probe+0xfc/0x1b0 [ 5.731992] platform_drv_probe+0x50/0xa0 [ 5.735727] really_probe+0x20c/0x2b8 [ 5.739718] driver_probe_device+0x58/0x100 [ 5.743368] __device_attach_driver+0x90/0xd0 [ 5.747363] bus_for_each_drv+0x64/0xc8 [ 5.751870] __device_attach+0xd8/0x138 [ 5.755516] device_initial_probe+0x10/0x18 [ 5.759341] bus_probe_device+0x98/0xa0 [ 5.763502] device_add+0x3d0/0x640 [ 5.767319] of_device_add+0x48/0x58 [ 5.770793] of_platform_device_create_pdata+0xb0/0x128 [ 5.774629] of_platform_bus_create+0x174/0x370 [ 5.779569] of_platform_populate+0x78/0xe0 [ 5.784082] qcom_smd_rpm_probe+0x80/0xa0 [ 5.788245] rpmsg_dev_probe+0x114/0x1a0 [ 5.792411] really_probe+0x20c/0x2b8 [ 5.796401] driver_probe_device+0x58/0x100 [ 5.799964] __device_attach_driver+0x90/0xd0 [ 5.803960] bus_for_each_drv+0x64/0xc8 [ 5.808468] __device_attach+0xd8/0x138 [ 5.812115] device_initial_probe+0x10/0x18 [ 5.815936] bus_probe_device+0x98/0xa0 [ 5.820099] device_add+0x3d0/0x640 [ 5.823916] device_register+0x1c/0x28 [ 5.827391] rpmsg_register_device+0x4c/0x90 [ 5.831216] qcom_channel_state_worker+0x170/0x298 [ 5.835651] process_one_work+0x294/0x6e8 [ 5.840241] worker_thread+0x40/0x450 [ 5.844318] kthread+0x11c/0x120 [ 5.847961] ret_from_fork+0x10/0x18 [ 5.851260] irq event stamp: 9090 [ 5.854820] hardirqs last enabled at (9089): [<ffff000010160798>] console_unlock+0x3e0/0x5b0 [ 5.858086] hardirqs last disabled at (9090): [<ffff0000100817cc>] do_debug_exception+0x104/0x140 [ 5.866596] softirqs last enabled at (9086): [<ffff000010082024>] __do_softirq+0x474/0x574 [ 5.875446] softirqs last disabled at (9079): [<ffff0000100f2254>] irq_exit+0x13c/0x148 [ 5.883598] ---[ end trace 6984ef7f081afa21 ]---
--- drivers/regulator/core.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/regulator/core.c +2 -0
@@ -1349,7 +1349,9 @@ static int set_machine_constraints(struct regulator_dev *rdev,* We'll only apply the initial system load if an * initial mode wasn't specified. */ +regulator_lock (rdev);drms_uA_update (rdev); +regulator_unlock (rdev); } if ((rdev->constraints->ramp_delay || rdev->constraints->ramp_disable)
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 129/246 jbd2: fix race when writing superblock
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 538bcaa6261b77e71d37f5596c33127c1a3ec3f7 ]
The jbd2 superblock is lockless now, so there is probably a race condition between writing it so disk and modifing contents of it, which may lead to checksum error. The following race is the one case that we have captured.
jbd2 fsstressjbd2_journal_commit_transaction
jbd2_journal_update_sb_log_tail
jbd2_write_superblock
jbd2_superblock_csum_set jbd2_journal_revoke
jbd2_journal_set_features(revork) modify superblock
submit_bh(checksum incorrect)
Fix this by locking the buffer head before modifing it. We always write the jbd2 superblock after we modify it, so this just means calling the lock_buffer() a little earlier.
This checksum corruption problem can be reproduced by xfstests generic/475.
--- fs/jbd2/journal.c | 52 ++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 25 deletions(-)
fs/jbd2/journal.c +27 -25
@@ -1356,6 +1356,10 @@ static int journal_reset(journal_t *journal)return jbd2_journal_start_thread (journal); } +/* +* This function expects that the caller will have locked the journal +* buffer head, and will return with it unlocked +*/ static int jbd2_write_superblock (journal_t *journal,int write_flags) {struct buffer_head *bh = journal->j_sb_buffer;
@@ -1365,7 +1369,6 @@ static int jbd2_write_superblock(journal_t *journal, int write_flags)trace_jbd2_write_superblock (journal, write_flags);if (!(journal->j_flags &JBD2_BARRIER )) write_flags &= ~(REQ_FUA |REQ_PREFLUSH ); -lock_buffer (bh);if (buffer_write_io_error (bh)) {/* * Oh, dear. A previous attempt to write the journal
@@ -1424,6 +1427,7 @@ int jbd2_journal_update_sb_log_tail(journal_t *journal, tid_t tail_tid,jbd_debug (1 ,"JBD2: updating superblock (start %lu, seq %u)\n" , tail_block, tail_tid); +lock_buffer (journal->j_sb_buffer); sb->s_sequence =cpu_to_be32 (tail_tid); sb->s_start =cpu_to_be32 (tail_block);
@@ -1454,18 +1458,17 @@ static void jbd2_mark_journal_empty(journal_t *journal, int write_op)journal_superblock_t *sb = journal->j_superblock;BUG_ON (!mutex_is_locked (&journal->j_checkpoint_mutex)); -read_lock (&journal->j_state_lock); -/* Is it already empty? */ -if (sb->s_start ==0 ) { -read_unlock (&journal->j_state_lock); +lock_buffer (journal->j_sb_buffer); +if (sb->s_start ==0 ) {/* Is it already empty? */ +unlock_buffer (journal->j_sb_buffer);return ; } +jbd_debug (1 ,"JBD2: Marking journal as empty (seq %d)\n" , journal->j_tail_sequence); sb->s_sequence =cpu_to_be32 (journal->j_tail_sequence); sb->s_start =cpu_to_be32 (0 ); -read_unlock (&journal->j_state_lock);jbd2_write_superblock (journal, write_op);
@@ -1488,9 +1491,8 @@ void jbd2_journal_update_sb_errno(journal_t *journal)journal_superblock_t *sb = journal->j_superblock;int errcode; -read_lock (&journal->j_state_lock); +lock_buffer (journal->j_sb_buffer); errcode = journal->j_errno; -read_unlock (&journal->j_state_lock);if (errcode == -ESHUTDOWN ) errcode =0 ;jbd_debug (1 ,"JBD2: updating superblock error (errno %d)\n" , errcode);
@@ -1894,28 +1896,27 @@ int jbd2_journal_set_features (journal_t *journal, unsigned long compat, sb = journal->j_superblock; +/* Load the checksum driver if necessary */ +if ((journal->j_chksum_driver ==NULL ) && +INCOMPAT_FEATURE_ON (JBD2_FEATURE_INCOMPAT_CSUM_V3 )) { + journal->j_chksum_driver =crypto_alloc_shash ("crc32c" ,0 ,0 ); +if (IS_ERR (journal->j_chksum_driver)) { +printk (KERN_ERR "JBD2: Cannot load crc32c driver.\n" ); + journal->j_chksum_driver =NULL ; +return 0 ; + } +/* Precompute checksum seed for all metadata */ + journal->j_csum_seed =jbd2_chksum (journal, ~0 , sb->s_uuid, +sizeof (sb->s_uuid)); + } + +lock_buffer (journal->j_sb_buffer); +/* If enabling v3 checksums, update superblock */ if (INCOMPAT_FEATURE_ON (JBD2_FEATURE_INCOMPAT_CSUM_V3 )) { sb->s_checksum_type =JBD2_CRC32C_CHKSUM ; sb->s_feature_compat &= ~cpu_to_be32 (JBD2_FEATURE_COMPAT_CHECKSUM ); - -/* Load the checksum driver */ -if (journal->j_chksum_driver ==NULL ) { - journal->j_chksum_driver =crypto_alloc_shash ("crc32c" , -0 ,0 ); -if (IS_ERR (journal->j_chksum_driver)) { -printk (KERN_ERR "JBD2: Cannot load crc32c " -"driver.\n" ); - journal->j_chksum_driver =NULL ; -return 0 ; - } - -/* Precompute checksum seed for all metadata */ - journal->j_csum_seed =jbd2_chksum (journal, ~0 , - sb->s_uuid, -sizeof (sb->s_uuid)); - } }/* If enabling v1 checksums, downgrade superblock */
@@ -1927,6 +1928,7 @@ int jbd2_journal_set_features (journal_t *journal, unsigned long compat, sb->s_feature_compat |=cpu_to_be32 (compat); sb->s_feature_ro_compat |=cpu_to_be32 (ro); sb->s_feature_incompat |=cpu_to_be32 (incompat); +unlock_buffer (journal->j_sb_buffer);return 1 ;#undef COMPAT_FEATURE_ON
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 130/246 leds: lp55xx: fix null deref on firmware load failure
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 5ddb0869bfc1bca6cfc592c74c64a026f936638c ]
I've stumbled upon a kernel crash and the logs
pointed me towards the lp5562 driver:
Quoted 8 lines
<4>[306013.841294] lp5562 0-0030: Direct firmware load for lp5562 failed with error -2 <4>[306013.894990] lp5562 0-0030: Falling back to user helper ... <3>[306073.924886] lp5562 0-0030: firmware request failed <1>[306073.939456] Unable to handle kernel NULL pointer dereference at virtual address 00000000 <4>[306074.251011] PC is at _raw_spin_lock+0x1c/0x58 <4>[306074.255539] LR is at release_firmware+0x6c/0x138...
After taking a look I noticed firmware_release()
could be called with either NULL or a dangling
pointer.
--- drivers/leds/leds-lp55xx-common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/leds/leds-lp55xx-common.c +2 -2
@@ -201,7 +201,7 @@ static void lp55xx_firmware_loaded(const struct firmware *fw, void *context)if (!fw) {dev_err (dev,"firmware request failed\n" ); - goto out; +return ; }/* handling firmware data is chip dependent */
@@ -214,9 +214,9 @@ static void lp55xx_firmware_loaded(const struct firmware *fw, void *context)mutex_unlock (&chip->lock); -out:/* firmware should be released for other channel use */ release_firmware (chip->fw); + chip->fw =NULL ; }static int lp55xx_request_firmware (struct lp55xx_chip *chip)
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 131/246 tools build: Add -lrt to FEATURE_CHECK_LDFLAGS-libaio
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit aa8f9c517ebce7a0959da064ef2660ea03f133f8 ]
Since we need it to resolve the AIO symbols, otherwise we fail with:
$ cat /tmp/build/perf/feature/test-all.make.output /usr/bin/ld: /tmp/ccEqrj36.o: undefined reference to symbol 'aio_return64@@GLIBC_2.2.5' /usr/bin/ld: //usr/lib64/librt.so.1: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status $
When we added the aio support in 'perf record' only the test-libaio.bin target got the -lrt, i.e. the feature detection slow path. Fix it.
--- tools/perf/Makefile.config | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/Makefile.config +2 -0
@@ -218,6 +218,8 @@ FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS) FEATURE_CHECK_CFLAGS-libpython-version := $(PYTHON_EMBED_CCOPTS) FEATURE_CHECK_LDFLAGS-libpython-version := $(PYTHON_EMBED_LDOPTS) +FEATURE_CHECK_LDFLAGS-libaio = -lrt + CFLAGS += -fno-omit-frame-pointer CFLAGS += -ggdb3 CFLAGS += -funwind-tables
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 132/246 tools build: Add test-reallocarray.c to test-all.c to fix the build
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit a96c03e8cdcf123384319f312d0a08a7a760bb35 ]
When a test is in the FEATURE_TESTS_BASIC list in tools/build/Makefile.feature must be added to tools/build/feature/test-all.c, because the successfull compilation and linking of that test-all.bin file means that all the features listed in FEATURE_TESTS_BASIC are present in the system, so we don't have to go on feature by feature test building them.
Since reallocarray() is expected to be present in modern systems, it has a place in FEATURE_TESTS_BASIC, so that we speed up the build process building just that file.
For older systems, such as ubuntu:16.04 (build failure reported by Jin Yao) debian:8, and for the current flagship RHEL distro, RHEL7, the build will fail as test-all.bin (without test-reallocarray.c included) passes but reallocarray() isn't present, making the build fail with:
CC /tmp/build/perf/libbpf.o
MKDIR /tmp/build/perf/fs/
CC /tmp/build/perf/fs/tracing_path.o
LD /tmp/build/perf/fd/libapi-in.o
CC /tmp/build/perf/bpf.o
libbpf.c: In function 'bpf_object__add_program':
libbpf.c:367:10: error: implicit declaration of function 'reallocarray' [-Werror=implicit-function-declaration]
progs = reallocarray(progs, nr_progs + 1, sizeof(progs[0]));
^
libbpf.c:367:2: error: nested extern declaration of 'reallocarray' [-Werror=nested-externs]
progs = reallocarray(progs, nr_progs + 1, sizeof(progs[0]));
^
libbpf.c:367:8: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
progs = reallocarray(progs, nr_progs + 1, sizeof(progs[0]));
^
libbpf.c: In function 'bpf_object__elf_collect':
libbpf.c:887:10: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
reloc = reallocarray(reloc, nr_reloc,
^
libbpf.c: In function 'bpf_program__reloc_text':
libbpf.c:1394:12: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
new_insn = reallocarray(prog->insns, new_cnt, sizeof(*insn));
^
CC /tmp/build/perf/nlattr.oEven with:
$ grep reallocarray /tmp/build/perf/FEATURE-DUMP feature-reallocarray=1 $
Which ubuntu:16.04.5 LTS doesn't have:
perfbuilder@38a153a1bba8:/$ head -2 /etc/os-release NAME="Ubuntu" VERSION="16.04.5 LTS (Xenial Xerus)" perfbuilder@38a153a1bba8:/$ find /usr/include/ -name "*.h" | xargs grep -w reallocarray perfbuilder@38a153a1bba8:/$
Fix it by including it to test-all.c, which ends up forcing the individual tests to be triggered and for the build process to notice that indeed reallocarray() is not there:
perfbuilder@38a153a1bba8:/$ cat /tmp/build/perf/feature/test-all.make.output
In file included from test-all.c:178:0:
test-reallocarray.c: In function 'main_test_reallocarray':
test-reallocarray.c:7:11: error: implicit declaration of function 'reallocarray' [-Werror=implicit-function-declaration]
return !!reallocarray(NULL, 1, 1);
^
cc1: all warnings being treated as errors
perfbuilder@38a153a1bba8:/$That is the only test that is failing on Ubuntu 16.03.5 LTS, so all tests are forced:
perfbuilder@38a153a1bba8:/tmp/build/perf/feature$ ls -lSr *.make.output <SNIP successful tests> -rw-r--r--. 1 perfbuilder perfbuilder 0 Feb 14 15:00 test-dwarf.make.output -rw-r--r--. 1 perfbuilder perfbuilder 0 Feb 14 14:16 test-cplus-demangle.make.output -rw-r--r--. 1 perfbuilder perfbuilder 0 Feb 14 15:00 test-bpf.make.output -rw-r--r--. 1 perfbuilder perfbuilder 0 Feb 14 15:00 test-backtrace.make.output -rw-r--r--. 1 perfbuilder perfbuilder 104 Feb 14 15:00 test-bionic.make.output -rw-r--r--. 1 perfbuilder perfbuilder 107 Feb 14 15:00 test-libunwind-x86.make.output -rw-r--r--. 1 perfbuilder perfbuilder 115 Feb 14 15:00 test-libunwind-aarch64.make.output -rw-r--r--. 1 perfbuilder perfbuilder 122 Feb 14 15:00 test-libbabeltrace.make.output -rw-r--r--. 1 perfbuilder perfbuilder 254 Feb 14 15:00 test-reallocarray.make.output -rw-r--r--. 1 perfbuilder perfbuilder 312 Feb 14 15:00 test-all.make.output perfbuilder@38a153a1bba8:/tmp/build/perf/feature$
And that reallocarray() one shows:
perfbuilder@38a153a1bba8:/tmp/build/perf/feature$ cat test-reallocarray.make.output
test-reallocarray.c: In function 'main':
test-reallocarray.c:7:11: error: implicit declaration of function 'reallocarray' [-Werror=implicit-function-declaration]
return !!reallocarray(NULL, 1, 1);
^
cc1: all warnings being treated as errors
perfbuilder@38a153a1bba8:/tmp/build/perf/feature$Which now generates the expected result:
perfbuilder@38a153a1bba8:~$ grep reallocarray /tmp/build/perf/FEATURE-DUMP feature-reallocarray=0 perfbuilder@38a153a1bba8:~$
The fallback mechanism kicks in and libbpf and perf are again buildable in systems without reallocarray():
$ cat tools/include/tools/libc_compat.h // SPDX-License-Identifier: (LGPL-2.0+ OR BSD-2-Clause) /* Copyright (C) 2018 Netronome Systems, Inc. */
#ifndef __TOOLS_LIBC_COMPAT_H #define __TOOLS_LIBC_COMPAT_H #include <stdlib.h> #include <linux/overflow.h>
#ifdef COMPAT_NEED_REALLOCARRAY
static inline void *reallocarray(void *ptr, size_t nmemb, size_t size)
{
size_t bytes;
if (unlikely(check_mul_overflow(nmemb, size, &bytes)))
return NULL;
return realloc(ptr, bytes); }
#endif
#endif
$
--- tools/build/feature/test-all.c | 5 +++++ tools/build/feature/test-reallocarray.c | 2 ++ 2 files changed, 7 insertions(+)
tools/build/feature/test-all.c +5 -0
@@ -178,6 +178,10 @@# include "test-libaio.c" #undef main +#define main main_test_reallocarray +# include "test-reallocarray.c" +#undef main +int main (int argc,char *argv[]) {main_test_libpython ();
@@ -219,6 +223,7 @@ int main(int argc, char *argv[])main_test_setns ();main_test_libopencsd ();main_test_libaio (); +main_test_reallocarray ();return 0 ; }
tools/build/feature/test-reallocarray.c +2 -0
@@ -6,3 +6,5 @@ int main(void) {return !!reallocarray (NULL ,1 ,1 ); } + +#undef _GNU_SOURCE
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 133/246 perf beauty waitid options: Fix up prefix showing logic
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 1da7e0022784b0e05b49bf73521fa2cc4633af85 ]
When introducing the possibility for selecting if the common prefix to options such as the waitid ones, i.e. all 'waitid' options start with 'W', so, to make it make it more compact if configured to suppress it, 'perf trace' will do so, other examples include mmap's PROT_ prefix for its 'prot' argument, etc, which, when showing the syscall argument name ends up producing duplicated info that clutters the screen, i.e.:
# perf trace -e mmap --max-events 2 sleep 1
0.000 ( 0.014 ms): sleep/20886 mmap(len: 112595, prot: PROT_READ, flags: MAP_PRIVATE, fd: 3) = 0x7f3e986d2000
0.041 ( 0.005 ms): sleep/20886 mmap(len: 8192, prot: PROT_READ|PROT_WRITE, flags: MAP_PRIVATE|MAP_ANONYMOUS) = 0x7f3e986d0000
#So it is possible to suppress that and make it more compact by having this in your ~/.perfconfig:
# cat ~/.perfconfig [trace] show_prefix = no #
# perf trace -e mmap --max-events 2 sleep 1
0.000 ( 0.014 ms): sleep/8009 mmap(len: 112595, prot: READ, flags: PRIVATE, fd: 3) = 0x7ff2373de000
0.040 ( 0.005 ms): sleep/8009 mmap(len: 8192, prot: READ|WRITE, flags: PRIVATE|ANONYMOUS) = 0x7ff2373dc000
#To have it look more like strace's output, we instead want to suppress the arg name and show the prefix, so use:
# cat ~/.perfconfig
[trace]
show_prefix = yes
show_arg_names = no
#
# perf trace -e mmap --max-events 2 sleep 1
0.000 ( 0.006 ms): sleep/15513 mmap(NULL, 112595, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f7a9b6d3000
0.020 ( 0.002 ms): sleep/15513 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS) = 0x7f7a9b6d1000
#When this logic was introduced a bug came with it when processing the waitid 'option' arg that ended up expecting 3 strings when just two were being provided, fix it.
--- tools/perf/trace/beauty/waitid_options.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/trace/beauty/waitid_options.c +1 -1
@@ -11,7 +11,7 @@ static size_t syscall_arg__scnprintf_waitid_options(char *bf, size_t size,#define P_OPTION (n) \ if (options & W##n) { \ - printed += scnprintf(bf + printed, size - printed, "%s%s%s", printed ? "|" : "", show_prefix ? prefix : #n); \ + printed += scnprintf(bf + printed, size - printed, "%s%s%s", printed ? "|" : "", show_prefix ? prefix : "", #n); \ options &= ~W##n; \ }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 134/246 perf trace: Check if the fd is negative when mapping it to pathname
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 051074867434cc520c08f188479d4757dcfdaef8 ]
We were crashing when processing a negative fd:
Program received signal SIGSEGV, Segmentation fault.
0x0000000000609bbf in syscall_arg__scnprintf_ioctl_cmd (bf=0x1172eca "", size=2038, arg=0x7fffffff8360) at trace/beauty/ioctl.c:182
182 if (file->dev_maj == USB_DEVICE_MAJOR)
Missing separate debuginfos, use: dnf debuginfo-install bzip2-libs-1.0.6-28.fc29.x86_64 elfutils-libelf-0.174-5.fc29.x86_64 elfutils-libs-0.174-5.fc29.x86_64 glib2-2.58.3-1.fc29.x86_64 libbabeltrace-1.5.6-1.fc29.x86_64 libunwind-1.2.1-6.fc29.x86_64 libuuid-2.32.1-1.fc29.x86_64 libxcrypt-4.4.3-2.fc29.x86_64 numactl-libs-2.0.12-1.fc29.x86_64 openssl-libs-1.1.1a-1.fc29.x86_64 pcre-8.42-6.fc29.x86_64 perl-libs-5.28.1-427.fc29.x86_64 popt-1.16-15.fc29.x86_64 python2-libs-2.7.15-11.fc29.x86_64 slang-2.3.2-4.fc29.x86_64 xz-libs-5.2.4-3.fc29.x86_64 (gdb) bt
#0 0x0000000000609bbf in syscall_arg__scnprintf_ioctl_cmd (bf=0x1172eca "", size=2038, arg=0x7fffffff8360) at trace/beauty/ioctl.c:182
#1 0x000000000048e295 in syscall__scnprintf_val (sc=0x123b500, bf=0x1172eca "", size=2038, arg=0x7fffffff8360, val=21519)
at builtin-trace.c:1594
#2 0x000000000048e60d in syscall__scnprintf_args (sc=0x123b500, bf=0x1172ec6 "-1, ", size=2042, args=0x7ffff6a7c034 "\377\377\377\377",
augmented_args=0x7ffff6a7c064, augmented_args_size=4, trace=0x7fffffffa8d0, thread=0x1175cd0) at builtin-trace.c:1661
#3 0x000000000048f04e in trace__sys_enter (trace=0x7fffffffa8d0, evsel=0xb260b0, event=0x7ffff6a7bfe8, sample=0x7fffffff84f0)
at builtin-trace.c:1880
#4 0x00000000004915a4 in trace__handle_event (trace=0x7fffffffa8d0, event=0x7ffff6a7bfe8, sample=0x7fffffff84f0) at builtin-trace.c:2590
#5 0x0000000000491eed in __trace__deliver_event (trace=0x7fffffffa8d0, event=0x7ffff6a7bfe8) at builtin-trace.c:2818
#6 0x0000000000492030 in trace__deliver_event (trace=0x7fffffffa8d0, event=0x7ffff6a7bfe8) at builtin-trace.c:2845
#7 0x0000000000492896 in trace__run (trace=0x7fffffffa8d0, argc=0, argv=0x7fffffffdb58) at builtin-trace.c:3040
#8 0x000000000049603a in cmd_trace (argc=0, argv=0x7fffffffdb58) at builtin-trace.c:3952
#9 0x00000000004d5103 in main (argc=1, argv=0x7fffffffdb58) at perf.c:474 (gdb) p fd
$1 = -1
(gdb) p file
$7 = (struct file *) 0xfffffffffffffff0
(gdb) p ((struct thread_trace *)arg->thread)->files.table + fd $8 = (struct file *) 0xfffffffffffffff0
(gdb)
Check for that and return NULL instead.
This problem was introduced recently, the other codepaths leading to thread_trace__files_entry() check for negative fds, like thread__fd_path(), but we need to do it at thread_trace__files_entry() as more users are now calling it directly.
--- tools/perf/builtin-trace.c | 3 +++ 1 file changed, 3 insertions(+)
tools/perf/builtin-trace.c +3 -0
@@ -1039,6 +1039,9 @@ static const size_t trace__entry_str_size = 2048;static struct file *thread_trace__files_entry (struct thread_trace *ttrace,int fd) { +if (fd <0 ) +return NULL ; +if (fd > ttrace->files.max) {struct file *nfiles =realloc (ttrace->files.table, (fd +1 ) *sizeof (struct file ));
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 135/246 perf report: Add s390 diagnosic sampling descriptor size
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 2187d87eacd46f6214ce3dc9cfd7a558375a4153 ]
On IBM z13 machine types 2964 and 2965 the descriptor sizes for sampling and diagnostic sampling entries might be missing in the trailer entry and are set to zero.
This leads to a perf report failure when processing diagnostic sampling entries.
This patch adds missing descriptor sizes when the trailer entry contains zero for these fields.
Output before:
[root@s38lp82 perf]# ./perf report --stdio | fgrep Samples 0xabbf0 [0x8]: failed to process type: 68
Error:
failed to process sample
[root@s38lp82 perf]#
Output after:
[root@s38lp82 perf]# ./perf report --stdio | fgrep Samples # Total Lost Samples: 0
# Samples: 3K of event 'SF_CYCLES_BASIC_DIAG'
# Samples: 162 of event 'CF_DIAG'
[root@s38lp82 perf]#
--- tools/perf/util/s390-cpumsf.c | 5 +++++ 1 file changed, 5 insertions(+)
tools/perf/util/s390-cpumsf.c +5 -0
@@ -301,6 +301,11 @@ static bool s390_cpumsf_validate(int machine_type, *dsdes =85 ; *bsdes =32 ;break ; +case 2964 : +case 2965 : + *dsdes =112 ; + *bsdes =32 ; +break ;default :/* Illegal trailer entry */ return false;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 136/246 perf coresight: Do not test for libopencsd by default
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 1c3b28fd7ae80c8f6bf1a09e1848e20a953c9ce4 ]
Since it is not yet that generally available, avoid testing for the presence of libcoresight in the fast path test-all.bin feature test.
# dnf search opencsd No matches found. # dnf search OpenCSD No matches found. # cat /etc/fedora-release Fedora release 29 (Twenty Nine) #
I.e. right now, in my system test-all.bin is failing all the time since Fedora29 doesn't have libopencsd available:
$ cat /tmp/build/perf/feature/test-all.make.output
In file included from test-all.c:174:
test-libopencsd.c:2:10: fatal error: opencsd/c_api/opencsd_c_api.h: No such file or directory
#include <opencsd/c_api/opencsd_c_api.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.See:
6ab2b762befd ("perf build: Disable libbabeltrace check by default")
For the rationale, as soon as libopencsd becomes more generally packaged and available, we do the same thing we did with babeltrace, enabling it by default, as done in:
24787afbcd01 ("perf tools: Enable LIBBABELTRACE by default")
For now, to explicitely ask for opencsd, make sure you have it installed and use:
make -C tools/perf CORESIGHT=1
The feature test output will be there as an empty file:
$ ls -la /tmp/build/perf/feature/test-libopencsd.make.output
Because the binary used for the feature check was successfully built:
$ ls -la /tmp/build/perf/feature/test-libopencsd.bin -rwxrwxr-x. 1 acme acme 18336 Feb 12 14:49 /tmp/build/perf/feature/test-libopencsd.bin $ ldd /tmp/build/perf/feature/test-libopencsd.bin linux-vdso.so.1 (0x00007fffe18cc000) libopencsd_c_api.so.0 => /lib64/libopencsd_c_api.so.0 (0x00007fb8e67f6000) libopencsd.so.0 => /lib64/libopencsd.so.0 (0x00007fb8e676f000) libc.so.6 => /lib64/libc.so.6 (0x00007fb8e65a9000) libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fb8e6411000) libm.so.6 => /lib64/libm.so.6 (0x00007fb8e628d000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fb8e6272000) /lib64/ld-linux-x86-64.so.2 (0x00007fb8e6828000) $
And the resulting perf binary will be linked with it:
-rw-rw-r--. 1 acme acme 0 Feb 12 14:49 /tmp/build/perf/feature/test-libopencsd.make.output
$ ldd ~/bin/perf | grep opencsd libopencsd_c_api.so.0 => /lib64/libopencsd_c_api.so.0 (0x00007fd43097f000) libopencsd.so.0 => /lib64/libopencsd.so.0 (0x00007fd4308f8000) $
To make sure this gets built before pushing things upstream I have a ubuntu:19.04-x-arm64 container that has:
[root@quaco x-arm64]# grep CORESIGHT Dockerfile
ENV EXTRA_MAKE_ARGS=CORESIGHT=1
[root@quaco x-arm64]#
So that I always build with libopencsd before pushing things upstream.
--- tools/build/Makefile.feature | 2 +- tools/build/feature/test-all.c | 5 ----- tools/perf/Makefile.config | 3 ++- tools/perf/Makefile.perf | 2 +- 4 files changed, 4 insertions(+), 8 deletions(-)
tools/build/Makefile.feature +1 -1
@@ -70,7 +70,6 @@ FEATURE_TESTS_BASIC := \ sched_getcpu \ sdt \ setns \ - libopencsd \ libaio # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
@@ -84,6 +83,7 @@ FEATURE_TESTS_EXTRA := \ libbabeltrace \ libbfd-liberty \ libbfd-liberty-z \ + libopencsd \ libunwind-debug-frame \ libunwind-debug-frame-arm \ libunwind-debug-frame-aarch64 \
tools/build/feature/test-all.c +0 -5
@@ -170,10 +170,6 @@# include "test-setns.c" #undef main -#define main main_test_libopencsd -# include "test-libopencsd.c" -#undef main -#define main main_test_libaio# include "test-libaio.c" #undef main
@@ -221,7 +217,6 @@ int main(int argc, char *argv[])main_test_sched_getcpu ();main_test_sdt ();main_test_setns (); -main_test_libopencsd ();main_test_libaio ();main_test_reallocarray ();
tools/perf/Makefile.config +2 -1
@@ -388,7 +388,8 @@ ifeq ($(feature-setns), 1) $(call detected,CONFIG_SETNS) endif -ifndef NO_CORESIGHT +ifdef CORESIGHT + $(call feature_check,libopencsd) ifeq ($(feature-libopencsd), 1) CFLAGS += -DHAVE_CSTRACE_SUPPORT $(LIBOPENCSD_CFLAGS) LDFLAGS += $(LIBOPENCSD_LDFLAGS)
tools/perf/Makefile.perf +1 -1
@@ -102,7 +102,7 @@ include ../scripts/utilities.mak # When selected, pass LLVM_CONFIG=/path/to/llvm-config to `make' if # llvm-config is not in $PATH. # -# Define NO_CORESIGHT if you do not want support for CoreSight trace decoding. +# Define CORESIGHT if you DO WANT support for CoreSight trace decoding. # # Define NO_AIO if you do not want support of Posix AIO based trace # streaming for record mode. Currently Posix AIO trace streaming is
Signature · 9 lines
2.19.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 137/246 iwlwifi: pcie: fix emergency path
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit c6ac9f9fb98851f47b978a9476594fc3c477a34d ]
Allocator swaps the pending requests with 0 when it starts working. This means that relying on it n RX path to decide if to move to emergency is not always a good idea, since it may be zero, but there are still a lot of unallocated RBs in the system. Change allocator to decrement the pending requests on real time. It is more expensive since it accesses the atomic variable more times, but it gives the RX path a better idea of the system's status.
--- drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/pcie/rx.c +8 -3
@@ -499,7 +499,7 @@ static void iwl_pcie_rx_allocator(struct iwl_trans *trans)struct iwl_trans_pcie *trans_pcie =IWL_TRANS_GET_PCIE_TRANS (trans);struct iwl_rb_allocator *rba = &trans_pcie->rba;struct list_head local_empty; -int pending =atomic_xchg (&rba->req_pending,0 ); +int pending =atomic_read (&rba->req_pending);IWL_DEBUG_RX (trans,"Pending allocation requests = %d\n" , pending);
@@ -554,11 +554,13 @@ static void iwl_pcie_rx_allocator(struct iwl_trans *trans) i++; } +atomic_dec (&rba->req_pending); pending--; +if (!pending) { - pending =atomic_xchg (&rba->req_pending,0 ); + pending =atomic_read (&rba->req_pending);IWL_DEBUG_RX (trans, -"Pending allocation requests = %d\n" , +"Got more pending allocation requests = %d\n" , pending); }
@@ -570,12 +572,15 @@ static void iwl_pcie_rx_allocator(struct iwl_trans *trans)spin_unlock (&rba->lock);atomic_inc (&rba->req_ready); + }spin_lock (&rba->lock);/* return unused rbds to the allocator empty list */ list_splice_tail (&local_empty, &rba->rbd_empty);spin_unlock (&rba->lock); + +IWL_DEBUG_RX (trans,"%s, exit.\n" , __func__); }/*
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 138/246 ACPI / video: Refactor and fix dmi_is_desktop()
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit cecf3e3e0803462335e25d083345682518097334 ]
This commit refactors the chassis-type detection introduced by commit 53fa1f6e8a59 ("ACPI / video: Only default only_lcd to true on Win8-ready _desktops_") (where desktop means anything without a builtin screen).
The DMI chassis_type is an unsigned integer, so rather then doing a whole bunch of string-compares on it, convert it to an int and feed the result to a switch case.
Note the switch case uses hex values, this is done because the spec uses hex values too. This changes the check for "Main Server Chassis" from checking for 11 decimal to 11 hexadecimal, this is a bug fix, the original check for 11 decimal was wrong.
--- drivers/acpi/acpi_video.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/acpi/acpi_video.c +13 -6
@@ -2124,21 +2124,28 @@ static int __init intel_opregion_present(void)return opregion; } +/* Check if the chassis-type indicates there is no builtin LCD panel */ static bool dmi_is_desktop (void ) {const char *chassis_type; +unsigned long type; chassis_type =dmi_get_system_info (DMI_CHASSIS_TYPE );if (!chassis_type)return false; -if (!strcmp (chassis_type,"3" ) ||/* 3: Desktop */ - !strcmp (chassis_type,"4" ) ||/* 4: Low Profile Desktop */ - !strcmp (chassis_type,"5" ) ||/* 5: Pizza Box */ - !strcmp (chassis_type,"6" ) ||/* 6: Mini Tower */ - !strcmp (chassis_type,"7" ) ||/* 7: Tower */ - !strcmp (chassis_type,"11" ))/* 11: Main Server Chassis */ +if (kstrtoul (chassis_type,10 , &type) !=0 ) +return false; + +switch (type) { +case 0x03 :/* Desktop */ +case 0x04 :/* Low Profile Desktop */ +case 0x05 :/* Pizza Box */ +case 0x06 :/* Mini Tower */ +case 0x07 :/* Tower */ +case 0x11 :/* Main Server Chassis */ return true; + }return false; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 139/246 =?UTF-8?q?selftests:=20ir:=20fix=20warning:=20"%s"=20directive=20?= =?UTF-8?q?output=20may=20be=20truncated=20=E2=80=99=20directive=20output?= =?UTF-8?q?=20may=20be=20truncated?=
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit ed675ed9da6d951322efd72d739d6b5ce1c18f02 ]
Fix the following warning by sizing the buffer to max. of sysfs path max. size + d_name max. size.
gcc -Wall -O2 -I../../../include/uapi ir_loopback.c -o ../tools/testing/selftests/ir/ir_loopbackir_loopback.c: In function ‘lirc_open’:
ir_loopback.c:71:37: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 95 [-Wformat-truncation=]
snprintf(buf, sizeof(buf), "/dev/%s", dent->d_name);
^~
In file included from /usr/include/stdio.h:862:0,
from ir_loopback.c:14:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:64:10: note: ‘__builtin___snprintf_chk’ output between 6 and 261 bytes into a destination of size 100
return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__bos (__s), __fmt, __va_arg_pack ());
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--- tools/testing/selftests/ir/ir_loopback.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/testing/selftests/ir/ir_loopback.c +3 -1
@@ -27,6 +27,8 @@#define TEST_SCANCODES 10#define ARRAY_SIZE (arr) (sizeof(arr) / sizeof((arr)[0])) +#define SYSFS_PATH_MAX 256 +#define DNAME_PATH_MAX 256 static const struct { enum rc_proto proto;
@@ -56,7 +58,7 @@ static const struct {int lirc_open (const char *rc) {struct dirent *dent; -char buf[100 ]; +char buf[SYSFS_PATH_MAX +DNAME_PATH_MAX ];DIR *d;int fd;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 140/246 selftests: skip seccomp get_metadata test if not real root
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 3aa415dd2128e478ea3225b59308766de0e94d6b ]
The get_metadata() test requires real root, so let's skip it if we're not real root.
Note that I used XFAIL here because that's what the test does later if CONFIG_CHEKCKPOINT_RESTORE happens to not be enabled. After looking at the code, there doesn't seem to be a nice way to skip tests defined as TEST(), since there's no return code (I tried exit(KSFT_SKIP), but that didn't work either...). So let's do it this way to be consistent, and easier to fix when someone comes along and fixes it.
--- tools/testing/selftests/seccomp/seccomp_bpf.c | 6 ++++++ 1 file changed, 6 insertions(+)
tools/testing/selftests/seccomp/seccomp_bpf.c +6 -0
@@ -2971,6 +2971,12 @@ TEST(get_metadata)struct seccomp_metadata md;long ret; +/* Only real root can get metadata. */ +if (geteuid ()) { +XFAIL (return,"get_metadata requires real root" ); +return ; + } +ASSERT_EQ (0 ,pipe (pipefd)); pid =fork ();
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 141/246 kprobes: Prohibit probing on bsearch()
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 02106f883cd745523f7766d90a739f983f19e650 ]
Since kprobe breakpoing handler is using bsearch(), probing on this routine can cause recursive breakpoint problem.
int3
->do_int3()
->ftrace_int3_handler()
->ftrace_location()
->ftrace_location_range()
->bsearch() -> int3Prohibit probing on bsearch().
--- lib/bsearch.c | 2 ++ 1 file changed, 2 insertions(+)
lib/bsearch.c +2 -0
@@ -11,6 +11,7 @@#include <linux/export.h> #include <linux/bsearch.h> +#include <linux/kprobes.h> /* * bsearch - binary search an array of elements
@@ -53,3 +54,4 @@ void *bsearch(const void *key, const void *base, size_t num, size_t size,return NULL ; }EXPORT_SYMBOL (bsearch); +NOKPROBE_SYMBOL (bsearch);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 142/246 kprobes: Prohibit probing on RCU debug routine
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit a39f15b9644fac3f950f522c39e667c3af25c588 ]
Since kprobe itself depends on RCU, probing on RCU debug routine can cause recursive breakpoint bugs.
Prohibit probing on RCU debug routines.
int3
->do_int3()
->ist_enter()
->RCU_LOCKDEP_WARN()
->debug_lockdep_rcu_enabled() -> int3--- kernel/rcu/update.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/rcu/update.c +2 -0
@@ -52,6 +52,7 @@#include <linux/tick.h> #include <linux/rcupdate_wait.h> #include <linux/sched/isolation.h> +#include <linux/kprobes.h> #define CREATE_TRACE_POINTS
@@ -249,6 +250,7 @@ int notrace debug_lockdep_rcu_enabled(void) current->lockdep_recursion ==0 ; }EXPORT_SYMBOL_GPL (debug_lockdep_rcu_enabled); +NOKPROBE_SYMBOL (debug_lockdep_rcu_enabled);/** * rcu_read_lock_held() - might we be in RCU read-side critical section?
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 143/246 netfilter: conntrack: fix cloned unconfirmed skb->_nfct race in __nf_conntrack_confirm
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 13f5251fd17088170c18844534682d9cab5ff5aa ]
For bridge(br_flood) or broadcast/multicast packets, they could clone skb with unconfirmed conntrack which break the rule that unconfirmed skb->_nfct is never shared. With nfqueue running on my system, the race can be easily reproduced with following warning calltrace:
[13257.707525] CPU: 0 PID: 12132 Comm: main Tainted: P W 4.4.60 #7744 [13257.707568] Hardware name: Qualcomm (Flattened Device Tree) [13257.714700] [<c021f6dc>] (unwind_backtrace) from [<c021bce8>] (show_stack+0x10/0x14) [13257.720253] [<c021bce8>] (show_stack) from [<c0449e10>] (dump_stack+0x94/0xa8) [13257.728240] [<c0449e10>] (dump_stack) from [<c022a7e0>] (warn_slowpath_common+0x94/0xb0) [13257.735268] [<c022a7e0>] (warn_slowpath_common) from [<c022a898>] (warn_slowpath_null+0x1c/0x24) [13257.743519] [<c022a898>] (warn_slowpath_null) from [<c06ee450>] (__nf_conntrack_confirm+0xa8/0x618) [13257.752284] [<c06ee450>] (__nf_conntrack_confirm) from [<c0772670>] (ipv4_confirm+0xb8/0xfc) [13257.761049] [<c0772670>] (ipv4_confirm) from [<c06e7a60>] (nf_iterate+0x48/0xa8) [13257.769725] [<c06e7a60>] (nf_iterate) from [<c06e7af0>] (nf_hook_slow+0x30/0xb0) [13257.777108] [<c06e7af0>] (nf_hook_slow) from [<c07f20b4>] (br_nf_post_routing+0x274/0x31c) [13257.784486] [<c07f20b4>] (br_nf_post_routing) from [<c06e7a60>] (nf_iterate+0x48/0xa8) [13257.792556] [<c06e7a60>] (nf_iterate) from [<c06e7af0>] (nf_hook_slow+0x30/0xb0) [13257.800458] [<c06e7af0>] (nf_hook_slow) from [<c07e5580>] (br_forward_finish+0x94/0xa4) [13257.808010] [<c07e5580>] (br_forward_finish) from [<c07f22ac>] (br_nf_forward_finish+0x150/0x1ac) [13257.815736] [<c07f22ac>] (br_nf_forward_finish) from [<c06e8df0>] (nf_reinject+0x108/0x170) [13257.824762] [<c06e8df0>] (nf_reinject) from [<c06ea854>] (nfqnl_recv_verdict+0x3d8/0x420) [13257.832924] [<c06ea854>] (nfqnl_recv_verdict) from [<c06e940c>] (nfnetlink_rcv_msg+0x158/0x248) [13257.841256] [<c06e940c>] (nfnetlink_rcv_msg) from [<c06e5564>] (netlink_rcv_skb+0x54/0xb0) [13257.849762] [<c06e5564>] (netlink_rcv_skb) from [<c06e4ec8>] (netlink_unicast+0x148/0x23c) [13257.858093] [<c06e4ec8>] (netlink_unicast) from [<c06e5364>] (netlink_sendmsg+0x2ec/0x368) [13257.866348] [<c06e5364>] (netlink_sendmsg) from [<c069fb8c>] (sock_sendmsg+0x34/0x44) [13257.874590] [<c069fb8c>] (sock_sendmsg) from [<c06a03dc>] (___sys_sendmsg+0x1ec/0x200) [13257.882489] [<c06a03dc>] (___sys_sendmsg) from [<c06a11c8>] (__sys_sendmsg+0x3c/0x64) [13257.890300] [<c06a11c8>] (__sys_sendmsg) from [<c0209b40>] (ret_fast_syscall+0x0/0x34)
The original code just triggered the warning but do nothing. It will caused the shared conntrack moves to the dying list and the packet be droppped (nf_ct_resolve_clash returns NF_DROP for dying conntrack).
- Reproduce steps:
+----------------------------+
| br0(bridge) |
| |
+-+---------+---------+------+
| eth0| | eth1| | eth2|
| | | | | |
+--+--+ +--+--+ +---+-+
| | |
| | |
+--+-+ +-+--+ +--+-+
| PC1| | PC2| | PC3|
+----+ +----+ +----+iptables -A FORWARD -m mark --mark 0x1000000/0x1000000 -j NFQUEUE --queue-num 100 --queue-bypass
ps: Our nfq userspace program will set mark on packets whose connection has already been processed.
PC1 sends broadcast packets simulated by hping3:
hping3 --rand-source --udp 192.168.1.255 -i u100
- Broadcast racing flow chart is as follow:
br_handle_frame
BR_HOOK(NFPROTO_BRIDGE, NF_BR_PRE_ROUTING, br_handle_frame_finish) // skb->_nfct (unconfirmed conntrack) is constructed at PRE_ROUTING stage br_handle_frame_finish
// check if this packet is broadcast
br_flood_forward
br_flood
list_for_each_entry_rcu(p, &br->port_list, list) // iterate through each port
maybe_deliver
deliver_clone
skb = skb_clone(skb)
__br_forward
BR_HOOK(NFPROTO_BRIDGE, NF_BR_FORWARD,...)
// queue in our nfq and received by our userspace program
// goto __nf_conntrack_confirm with process context on CPU 1
br_pass_frame_up
BR_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_IN,...)
// goto __nf_conntrack_confirm with softirq context on CPU 0Because conntrack confirm can happen at both INPUT and POSTROUTING stage. So with NFQUEUE running, skb->_nfct with the same unconfirmed conntrack could race on different core.
This patch fixes a repeating kernel splat, now it is only displayed once.
--- net/netfilter/nf_conntrack_core.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
net/netfilter/nf_conntrack_core.c +11 -3
@@ -901,10 +901,18 @@ __nf_conntrack_confirm(struct sk_buff *skb)* REJECT will give spurious warnings here. */ -/* No external references means no one else could have -* confirmed us. +/* Another skb with the same unconfirmed conntrack may +* win the race. This may happen for bridge(br_flood) +* or broadcast/multicast packets do skb_clone with +* unconfirmed conntrack. */ -WARN_ON (nf_ct_is_confirmed (ct)); +if (unlikely (nf_ct_is_confirmed (ct))) { +WARN_ON_ONCE (1 ); +nf_conntrack_double_unlock (hash, reply_hash); +local_bh_enable (); +return NF_DROP ; + } +pr_debug ("Confirming conntrack %p\n" , ct);/* We have to check the DYING flag after unlink to prevent * a race against nf_ct_get_next_corpse() possibly called from
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 144/246 ARM: 8833/1: Ensure that NEON code always compiles with Clang
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit de9c0d49d85dc563549972edc5589d195cd5e859 ]
While building arm32 allyesconfig, I ran into the following errors:
arch/arm/lib/xor-neon.c:17:2: error: You should compile this file with '-mfloat-abi=softfp -mfpu=neon'
In file included from lib/raid6/neon1.c:27:
/home/nathan/cbl/prebuilt/lib/clang/8.0.0/include/arm_neon.h:28:2:
error: "NEON support not enabled"
Building V=1 showed NEON_FLAGS getting passed along to Clang but __ARM_NEON__ was not getting defined. Ultimately, it boils down to Clang only defining __ARM_NEON__ when targeting armv7, rather than armv6k, which is the '-march' value for allyesconfig.
Quoted 1 line
From
lib/Basic/Targets/ARM.cppin the Clang source:
// This only gets set when Neon instructions are actually available, unlike // the VFP define, hence the soft float and arch check. This is subtly // different from gcc, we follow the intent which was that it should be set // when Neon instructions are actually available.
if ((FPU & NeonFPU) && !SoftFloat && ArchVersion >= 7) {
Builder.defineMacro("__ARM_NEON", "1");
Builder.defineMacro("__ARM_NEON__");
// current AArch32 NEON implementations do not support double-precision
// floating-point even when it is present in VFP.
Builder.defineMacro("__ARM_NEON_FP",
"0x" + Twine::utohexstr(HW_FP & ~HW_FP_DP));}
Ard Biesheuvel recommended explicitly adding '-march=armv7-a' at the beginning of the NEON_FLAGS definitions so that __ARM_NEON__ always gets definined by Clang. This doesn't functionally change anything because that code will only run where NEON is supported, which is implicitly armv7.
--- Documentation/arm/kernel_mode_neon.txt | 4 ++-- arch/arm/lib/Makefile | 2 +- arch/arm/lib/xor-neon.c | 2 +- lib/raid6/Makefile | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
Documentation/arm/kernel_mode_neon.txt +2 -2
@@ -6,7 +6,7 @@ TL;DR summary * Use only NEON instructions, or VFP instructions that don't rely on support code * Isolate your NEON code in a separate compilation unit, and compile it with - '-mfpu=neon -mfloat-abi=softfp' + '-march=armv7-a -mfpu=neon -mfloat-abi=softfp' * Put kernel_neon_begin() and kernel_neon_end() calls around the calls into your NEON code * Don't sleep in your NEON code, and be aware that it will be executed with
@@ -87,7 +87,7 @@ instructions appearing in unexpected places if no special care is taken. Therefore, the recommended and only supported way of using NEON/VFP in the kernel is by adhering to the following rules: * isolate the NEON code in a separate compilation unit and compile it with - '-mfpu=neon -mfloat-abi=softfp'; + '-march=armv7-a -mfpu=neon -mfloat-abi=softfp'; * issue the calls to kernel_neon_begin(), kernel_neon_end() as well as the calls into the unit containing the NEON code from a compilation unit which is *not* built with the GCC flag '-mfpu=neon' set.
arch/arm/lib/Makefile +1 -1
@@ -39,7 +39,7 @@ $(obj)/csumpartialcopy.o: $(obj)/csumpartialcopygeneric.S $(obj)/csumpartialcopyuser.o: $(obj)/csumpartialcopygeneric.S ifeq ($(CONFIG_KERNEL_MODE_NEON),y) - NEON_FLAGS := -mfloat-abi=softfp -mfpu=neon + NEON_FLAGS := -march=armv7-a -mfloat-abi=softfp -mfpu=neon CFLAGS_xor-neon.o += $(NEON_FLAGS) obj-$(CONFIG_XOR_BLOCKS) += xor-neon.o endif
arch/arm/lib/xor-neon.c +1 -1
@@ -14,7 +14,7 @@MODULE_LICENSE ("GPL" );#ifndef __ARM_NEON__ -#error You should compile this file with '-mfloat-abi=softfp -mfpu=neon' +#error You should compile this file with '-march=armv7-a -mfloat-abi=softfp -mfpu=neon'#endif /*
lib/raid6/Makefile +1 -1
@@ -39,7 +39,7 @@ endif ifeq ($(CONFIG_KERNEL_MODE_NEON),y) NEON_FLAGS := -ffreestanding ifeq ($(ARCH),arm) -NEON_FLAGS += -mfloat-abi=softfp -mfpu=neon +NEON_FLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=neon endif CFLAGS_recov_neon_inner.o += $(NEON_FLAGS) ifeq ($(ARCH),arm64)
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 145/246 ARM: dts: meson8b: fix the Ethernet data line signals in eth_rgmii_pins
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 29f0023d01f063feacfc404f0446905aee4f82ee ]
According to the Odroid-C1+ schematics the Ethernet TXD1 signal is routed to GPIOH_5 and the TXD0 signal is routed to GPIOH_6. The public S805 datasheet shows that TXD0 can be routed to DIF_2_P and TXD1 can be routed to DIF_2_N instead.
The pin groups eth_txd0_0 (GPIOH_6) and eth_txd0_1 (DIF_2_P) are both configured as Ethernet TXD0 and TXD1 data lines in meson8b.dtsi. At the same time eth_txd1_0 (GPIOH_5) and eth_txd1_1 (DIF_2_N) are configured as TXD0 and TXD1 data lines as well.
This results in a bad Ethernet receive performance. Presumably this is due to the eth_txd0 and eth_txd1 signal being routed to the wrong pins. As a result of that data can only be transmitted on eth_txd2 and eth_txd3. However, I have no scope to fully confirm this assumption.
The vendor u-boot sources for Odroid-C1 use the following Ethernet pinmux configuration:
SET_CBUS_REG_MASK(PERIPHS_PIN_MUX_6, 0x3f4f); SET_CBUS_REG_MASK(PERIPHS_PIN_MUX_7, 0xf00000);
This translates to the following pin groups in the mainline kernel:
- register 6 bit 0: eth_rxd1 (DIF_0_P) - register 6 bit 1: eth_rxd0 (DIF_0_N) - register 6 bit 2: eth_rx_dv (DIF_1_P) - register 6 bit 3: eth_rx_clk (DIF_1_N) - register 6 bit 6: eth_tx_en (DIF_3_P) - register 6 bit 8: eth_ref_clk (DIF_3_N) - register 6 bit 9: eth_mdc (DIF_4_P)
- register 6 bit 10: eth_mdio_en (DIF_4_N)
- register 6 bit 11: eth_tx_clk (GPIOH_9)
- register 6 bit 12: eth_txd2 (GPIOH_8)
- register 6 bit 13: eth_txd3 (GPIOH_7)
- register 7 bit 20: eth_txd0_0 (GPIOH_6)
- register 7 bit 21: eth_txd1_0 (GPIOH_5)
- register 7 bit 22: eth_rxd3 (DIF_2_P)
- register 7 bit 23: eth_rxd2 (DIF_2_N)
Drop the eth_txd0_1 and eth_txd1_1 groups from eth_rgmii_pins to fix the Ethernet transmit performance on Odroid-C1. Also add the eth_rxd2 and eth_rxd3 groups so we don't rely on the bootloader to set them up.
iperf3 statistics before this change:
- transmitting from Odroid-C1: 741 Mbits/sec (0 retries)
- receiving on Odroid-C1: 199 Mbits/sec (1713 retries)
iperf3 statistics after this change:
- transmitting from Odroid-C1: 667 Mbits/sec (0 retries)
- receiving on Odroid-C1: 750 Mbits/sec (0 retries)
--- arch/arm/boot/dts/meson8b.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/meson8b.dtsi +3 -3
@@ -270,9 +270,7 @@ groups = "eth_tx_clk", "eth_tx_en", "eth_txd1_0", - "eth_txd1_1", "eth_txd0_0", - "eth_txd0_1", "eth_rx_clk", "eth_rx_dv", "eth_rxd1",
@@ -281,7 +279,9 @@ "eth_mdc", "eth_ref_clk", "eth_txd2", - "eth_txd3"; + "eth_txd3", + "eth_rxd3", + "eth_rxd2"; function = "ethernet"; bias-disable; };
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 146/246 ALSA: PCM: check if ops are defined before suspending PCM
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit d9c0b2afe820fa3b3f8258a659daee2cc71ca3ef ]
BE dai links only have internal PCM's and their substream ops may not be set. Suspending these PCM's will result in their
ops->trigger() being invoked and cause a kernel oops.
So skip suspending PCM's if their ops are NULL.
[ NOTE: this change is required now for following the recent PCM core
change to get rid of snd_pcm_suspend() call. Since DPCM BE takes the runtime carried from FE while keeping NULL ops, it can hit this bug. See details at:
https://github.com/thesofproject/linux/pull/582
-- tiwai ]
--- sound/core/pcm_native.c | 8 ++++++++ 1 file changed, 8 insertions(+)
sound/core/pcm_native.c +8 -0
@@ -1513,6 +1513,14 @@ int snd_pcm_suspend_all(struct snd_pcm *pcm)/* FIXME: the open/close code should lock this as well */ if (substream->runtime ==NULL )continue ; + +/* +* Skip BE dai link PCM's that are internal and may +* not have their substream ops set. +*/ +if (!substream->ops) +continue ; + err =snd_pcm_suspend (substream);if (err <0 && err != -EBUSY )return err;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 147/246 ath10k: fix shadow register implementation for WCN3990
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 1863008369ae0407508033b4b00f98b985adeb15 ]
WCN3990 supports shadow registers write operation support for copy engine for regular operation in powersave mode.
Since WCN3990 is a 64-bit target, the shadow register implementation needs to be done in the copy engine handlers for 64-bit target. Currently the shadow register implementation is present in the 32-bit target handlers of copy engine.
Fix the shadow register copy engine write operation implementation for 64-bit target(WCN3990).
Tested HW: WCN3990
Tested FW: WLAN.HL.2.0-01188-QCAHLSWMTPLZ-1
--- drivers/net/wireless/ath/ath10k/ce.c | 26 +++++++++++++------------- drivers/net/wireless/ath/ath10k/ce.h | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-)
drivers/net/wireless/ath/ath10k/ce.c +13 -13
@@ -500,14 +500,8 @@ static int _ath10k_ce_send_nolock(struct ath10k_ce_pipe *ce_state, write_index =CE_RING_IDX_INCR (nentries_mask, write_index);/* WORKAROUND */ -if (!(flags &CE_SEND_FLAG_GATHER )) { -if (ar->hw_params.shadow_reg_support) -ath10k_ce_shadow_src_ring_write_index_set (ar, ce_state, - write_index); -else -ath10k_ce_src_ring_write_index_set (ar, ctrl_addr, - write_index); - } +if (!(flags &CE_SEND_FLAG_GATHER )) +ath10k_ce_src_ring_write_index_set (ar, ctrl_addr, write_index); src_ring->write_index = write_index; exit:
@@ -581,8 +575,14 @@ static int _ath10k_ce_send_nolock_64(struct ath10k_ce_pipe *ce_state,/* Update Source Ring Write Index */ write_index =CE_RING_IDX_INCR (nentries_mask, write_index); -if (!(flags &CE_SEND_FLAG_GATHER )) -ath10k_ce_src_ring_write_index_set (ar, ctrl_addr, write_index); +if (!(flags &CE_SEND_FLAG_GATHER )) { +if (ar->hw_params.shadow_reg_support) +ath10k_ce_shadow_src_ring_write_index_set (ar, ce_state, + write_index); +else +ath10k_ce_src_ring_write_index_set (ar, ctrl_addr, + write_index); + } src_ring->write_index = write_index; exit:
@@ -1404,12 +1404,12 @@ static int ath10k_ce_alloc_shadow_base(struct ath10k *ar, u32 nentries) { src_ring->shadow_base_unaligned =kcalloc (nentries, -sizeof (struct ce_desc ), +sizeof (struct ce_desc_64 ),GFP_KERNEL );if (!src_ring->shadow_base_unaligned)return -ENOMEM ; - src_ring->shadow_base = (struct ce_desc *) + src_ring->shadow_base = (struct ce_desc_64 *)PTR_ALIGN (src_ring->shadow_base_unaligned,CE_DESC_RING_ALIGN );return 0 ;
@@ -1461,7 +1461,7 @@ ath10k_ce_alloc_src_ring(struct ath10k *ar, unsigned int ce_id, ret =ath10k_ce_alloc_shadow_base (ar, src_ring, nentries);if (ret) {dma_free_coherent (ar->dev, - (nentries *sizeof (struct ce_desc ) + + (nentries *sizeof (struct ce_desc_64 ) +CE_DESC_RING_ALIGN ), src_ring->base_addr_owner_space_unaligned, base_addr);
drivers/net/wireless/ath/ath10k/ce.h +1 -1
@@ -118,7 +118,7 @@ struct ath10k_ce_ring {u32 base_addr_ce_space;char *shadow_base_unaligned; -struct ce_desc *shadow_base; +struct ce_desc_64 *shadow_base;/* keep last */ void *per_transfer_context[0 ];
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 148/246 usb: f_fs: Avoid crash due to out-of-scope stack ptr access
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 54f64d5c983f939901dacc8cfc0983727c5c742e ]
Since the 5.0 merge window opened, I've been seeing frequent crashes on suspend and reboot with the trace:
[ 36.911170] Unable to handle kernel paging request at virtual address ffffff801153d660 [ 36.912769] Unable to handle kernel paging request at virtual address ffffff800004b564 ... [ 36.950666] Call trace: [ 36.950670] queued_spin_lock_slowpath+0x1cc/0x2c8 [ 36.950681] _raw_spin_lock_irqsave+0x64/0x78 [ 36.950692] complete+0x28/0x70 [ 36.950703] ffs_epfile_io_complete+0x3c/0x50 [ 36.950713] usb_gadget_giveback_request+0x34/0x108 [ 36.950721] dwc3_gadget_giveback+0x50/0x68 [ 36.950723] dwc3_thread_interrupt+0x358/0x1488 [ 36.950731] irq_thread_fn+0x30/0x88 [ 36.950734] irq_thread+0x114/0x1b0 [ 36.950739] kthread+0x104/0x130 [ 36.950747] ret_from_fork+0x10/0x1c
I isolated this down to in ffs_epfile_io():
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/gadget/function/f_fs.c#n1065
Where the completion done is setup on the stack:
DECLARE_COMPLETION_ONSTACK(done);
Then later we setup a request and queue it, and wait for it:
if (unlikely(wait_for_completion_interruptible(&done))) {
/*
* To avoid race condition with ffs_epfile_io_complete,
* dequeue the request first then check
* status. usb_ep_dequeue API should guarantee no race
* condition with req->complete callback.
*/
usb_ep_dequeue(ep->ep, req);
interrupted = ep->status < 0;
}
The problem is, that we end up being interrupted, dequeue the request, and exit.
But then the irq triggers and we try calling complete() on the context pointer which points to now random stack space, which results in the panic.
Alan Stern pointed out there is a bug here, in that the snippet above "assumes that usb_ep_dequeue() waits until the request has been completed." And that:
wait_for_completion(&done);
Is needed right after the usb_ep_dequeue().
Thus this patch implements that change. With it I no longer see the crashes on suspend or reboot.
This issue seems to have been uncovered by behavioral changes in the dwc3 driver in commit fec9095bdef4e ("usb: dwc3: gadget:
remove wait_end_transfer").
--- drivers/usb/gadget/function/f_fs.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/gadget/function/f_fs.c +1 -0
@@ -1082,6 +1082,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)* condition with req->complete callback. */ usb_ep_dequeue (ep->ep, req); +wait_for_completion (&done); interrupted = ep->status <0 ; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 149/246 sched/topology: Fix percpu data types in struct sd_data & struct s_data
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 99687cdbb3f6c8e32bcc7f37496e811f30460e48 ]
The percpu members of struct sd_data and s_data are declared as:
struct ... ** __percpu member;
So their type is:
__percpu pointer to pointer to struct ...
But looking at how they're used, their type should be:
pointer to __percpu pointer to struct ...
and they should thus be declared as:
struct ... * __percpu *member;
So fix the placement of '__percpu' in the definition of these structures.
This addresses a bunch of Sparse's warnings like:
warning: incorrect type in initializer (different address spaces)
expected void const [noderef] <asn:3> *__vpp_verify got struct sched_domain **
--- include/linux/sched/topology.h | 8 ++++---- kernel/sched/topology.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)
include/linux/sched/topology.h +4 -4
@@ -176,10 +176,10 @@ typedef int (*sched_domain_flags_f)(void);#define SDTL_OVERLAP 0x01struct sd_data { -struct sched_domain **__percpu sd; -struct sched_domain_shared **__percpu sds; -struct sched_group **__percpu sg; -struct sched_group_capacity **__percpu sgc; +struct sched_domain *__percpu *sd; +struct sched_domain_shared *__percpu *sds; +struct sched_group *__percpu *sg; +struct sched_group_capacity *__percpu *sgc; };struct sched_domain_topology_level {
kernel/sched/topology.c +1 -1
@@ -676,7 +676,7 @@ cpu_attach_domain(struct sched_domain *sd, struct root_domain *rd, int cpu) }struct s_data { -struct sched_domain **__percpu sd; +struct sched_domain *__percpu *sd;struct root_domain *rd; };
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 150/246 bcache: fix input overflow to cache set sysfs file io_error_halflife
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit a91fbda49f746119828f7e8ad0f0aa2ab0578f65 ]
Cache set sysfs entry io_error_halflife is used to set c->error_decay. c->error_decay is in type unsigned int, and it is converted by strtoul_or_return(), therefore overflow to c->error_decay is possible for a large input value.
This patch fixes the overflow by using strtoul_safe_clamp() to convert input string to an unsigned long value in range [0, UINT_MAX], then divides by 88 and set it to c->error_decay.
--- drivers/md/bcache/sysfs.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/md/bcache/sysfs.c +11 -2
@@ -778,8 +778,17 @@ STORE(__bch_cache_set) c->error_limit =strtoul_or_return (buf);/* See count_io_errors() for why 88 */ -if (attr == &sysfs_io_error_halflife) - c->error_decay =strtoul_or_return (buf) /88 ; +if (attr == &sysfs_io_error_halflife) { +unsigned long v =0 ; +ssize_t ret; + + ret =strtoul_safe_clamp (buf, v,0 ,UINT_MAX ); +if (!ret) { + c->error_decay = v /88 ; +return size; + } +return ret; + }if (attr == &sysfs_io_disable) { v =strtoul_or_return (buf);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 151/246 bcache: fix input overflow to sequential_cutoff
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 8c27a3953e92eb0b22dbb03d599f543a05f9574e ]
People may set sequential_cutoff of a cached device via sysfs file, but current code does not check input value overflow. E.g. if value 4294967295 (UINT_MAX) is written to file sequential_cutoff, its value is 4GB, but if 4294967296 (UINT_MAX + 1) is written into, its value will be 0. This is an unexpected behavior.
This patch replaces d_strtoi_h() by sysfs_strtoul_clamp() to convert input string to unsigned integer value, and limit its range in [0, UINT_MAX]. Then the input overflow can be fixed.
--- drivers/md/bcache/sysfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/md/bcache/sysfs.c +3 -1
@@ -299,7 +299,9 @@ STORE(__cached_dev) dc->io_disable = v ?1 :0 ; } -d_strtoi_h (sequential_cutoff); +sysfs_strtoul_clamp (sequential_cutoff, + dc->sequential_cutoff, +0 ,UINT_MAX );d_strtoi_h (readahead);if (attr == &sysfs_clear_stats)
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 152/246 bcache: fix potential div-zero error of writeback_rate_i_term_inverse
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit c3b75a2199cdbfc1c335155fe143d842604b1baa ]
dc->writeback_rate_i_term_inverse can be set via sysfs interface. It is in type unsigned int, and convert from input string by d_strtoul(). The problem is d_strtoul() does not check valid range of the input, if 4294967296 is written into sysfs file writeback_rate_i_term_inverse, an overflow of unsigned integer will happen and value 0 is set to dc->writeback_rate_i_term_inverse.
In writeback.c:__update_writeback_rate(), there are following lines of code,
integral_scaled = div_s64(dc->writeback_rate_integral,
dc->writeback_rate_i_term_inverse);If dc->writeback_rate_i_term_inverse is set to 0 via sysfs interface, a div-zero error might be triggered in the above code.
Therefore we need to add a range limitation in the sysfs interface, this is what this patch does, use sysfs_stroul_clamp() to replace d_strtoul() and restrict the input range in [1, UINT_MAX].
--- drivers/md/bcache/sysfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/md/bcache/sysfs.c +3 -1
@@ -287,7 +287,9 @@ STORE(__cached_dev)sysfs_strtoul_clamp (writeback_rate_update_seconds, dc->writeback_rate_update_seconds,1 ,WRITEBACK_RATE_UPDATE_SECS_MAX ); -d_strtoul (writeback_rate_i_term_inverse); +sysfs_strtoul_clamp (writeback_rate_i_term_inverse, + dc->writeback_rate_i_term_inverse, +1 ,UINT_MAX );d_strtoul_nonzero (writeback_rate_p_term_inverse);d_strtoul_nonzero (writeback_rate_minimum);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 153/246 bcache: improve sysfs_strtoul_clamp()
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 596b5a5dd1bc2fa019fdaaae522ef331deef927f ]
Currently sysfs_strtoul_clamp() is defined as,
82 #define sysfs_strtoul_clamp(file, var, min, max) \
83 do { \
84 if (attr == &sysfs_ ## file) \
85 return strtoul_safe_clamp(buf, var, min, max) \
86 ?: (ssize_t) size; \87 } while (0)
The problem is, if bit width of var is less then unsigned long, min and max may not protect var from integer overflow, because overflow happens in strtoul_safe_clamp() before checking min and max.
To fix such overflow in sysfs_strtoul_clamp(), to make min and max take effect, this patch adds an unsigned long variable, and uses it to macro strtoul_safe_clamp() to convert an unsigned long value in range defined by [min, max]. Then assign this value to var. By this method, if bit width of var is less than unsigned long, integer overflow won't happen before min and max are checking.
Now sysfs_strtoul_clamp() can properly handle smaller data type like unsigned int, of cause min and max should be defined in range of unsigned int too.
--- drivers/md/bcache/sysfs.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/md/bcache/sysfs.h +10 -3
@@ -81,9 +81,16 @@ do { \#define sysfs_strtoul_clamp (file, var, min, max) \ do { \ - if (attr == &sysfs_ ## file) \ - return strtoul_safe_clamp(buf, var, min, max) \ - ?: (ssize_t) size; \ + if (attr == &sysfs_ ## file) { \ + unsigned long v = 0; \ + ssize_t ret; \ + ret = strtoul_safe_clamp(buf, v, min, max); \ + if (!ret) { \ + var = v; \ + return size; \ + } \ + return ret; \ + } \ } while (0)#define strtoul_or_return (cp) \
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 154/246 genirq: Avoid summation loops for /proc/stat
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 1136b0728969901a091f0471968b2b76ed14d9ad ]
Waiman reported that on large systems with a large amount of interrupts the readout of /proc/stat takes a long time to sum up the interrupt statistics. In principle this is not a problem. but for unknown reasons some enterprise quality software reads /proc/stat with a high frequency.
The reason for this is that interrupt statistics are accounted per cpu. So the /proc/stat logic has to sum up the interrupt stats for each interrupt.
This can be largely avoided for interrupts which are not marked as 'PER_CPU' interrupts by simply adding a per interrupt summation counter which is incremented along with the per interrupt per cpu counter.
The PER_CPU interrupts need to avoid that and use only per cpu accounting because they share the interrupt number and the interrupt descriptor and concurrent updates would conflict or require unwanted synchronization.
8<-------------
v2: Undo the unintentional layout change of struct irq_desc.
include/linux/irqdesc.h | 1 + kernel/irq/chip.c | 12 ++++++++++-- kernel/irq/internals.h | 8 +++++++- kernel/irq/irqdesc.c | 7 ++++++- 4 files changed, 24 insertions(+), 4 deletions(-)
--- include/linux/irqdesc.h | 1 + kernel/irq/chip.c | 12 ++++++++++-- kernel/irq/internals.h | 8 +++++++- kernel/irq/irqdesc.c | 7 ++++++- 4 files changed, 24 insertions(+), 4 deletions(-)
include/linux/irqdesc.h +1 -0
@@ -65,6 +65,7 @@ struct irq_desc {unsigned int core_internal_state__do_not_mess_with_it;unsigned int depth;/* nested irq disables */ unsigned int wake_depth;/* nested wake enables */ +unsigned int tot_count;unsigned int irq_count;/* For detecting broken IRQs */ unsigned long last_unhandled;/* Aging timer for unhandled count */ unsigned int irqs_unhandled;
kernel/irq/chip.c +10 -2
@@ -855,7 +855,11 @@ void handle_percpu_irq(struct irq_desc *desc) {struct irq_chip *chip =irq_desc_get_chip (desc); -kstat_incr_irqs_this_cpu (desc); +/* +* PER CPU interrupts are not serialized. Do not touch +* desc->tot_count. +*/ +__kstat_incr_irqs_this_cpu (desc);if (chip->irq_ack) chip->irq_ack (&desc->irq_data);
@@ -884,7 +888,11 @@ void handle_percpu_devid_irq(struct irq_desc *desc)unsigned int irq =irq_desc_get_irq (desc);irqreturn_t res; -kstat_incr_irqs_this_cpu (desc); +/* +* PER CPU interrupts are not serialized. Do not touch +* desc->tot_count. +*/ +__kstat_incr_irqs_this_cpu (desc);if (chip->irq_ack) chip->irq_ack (&desc->irq_data);
kernel/irq/internals.h +7 -1
@@ -242,12 +242,18 @@ static inline void irq_state_set_masked(struct irq_desc *desc)#undef __irqd_to_state -static inline void kstat_incr_irqs_this_cpu (struct irq_desc *desc) +static inline void __kstat_incr_irqs_this_cpu (struct irq_desc *desc) {__this_cpu_inc (*desc->kstat_irqs);__this_cpu_inc (kstat.irqs_sum); } +static inline void kstat_incr_irqs_this_cpu (struct irq_desc *desc) +{ +__kstat_incr_irqs_this_cpu (desc); + desc->tot_count++; +} +static inline int irq_desc_get_node (struct irq_desc *desc) {return irq_common_data_get_node (&desc->irq_common_data);
kernel/irq/irqdesc.c +6 -1
@@ -119,6 +119,7 @@ static void desc_set_defaults(unsigned int irq, struct irq_desc *desc, int node, desc->depth =1 ; desc->irq_count =0 ; desc->irqs_unhandled =0 ; + desc->tot_count =0 ; desc->name =NULL ; desc->owner = owner;for_each_possible_cpu (cpu)
@@ -919,11 +920,15 @@ unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)unsigned int kstat_irqs (unsigned int irq) {struct irq_desc *desc =irq_to_desc (irq); -int cpu;unsigned int sum =0 ; +int cpu;if (!desc || !desc->kstat_irqs)return 0 ; +if (!irq_settings_is_per_cpu_devid (desc) && + !irq_settings_is_per_cpu (desc)) +return desc->tot_count; +for_each_possible_cpu (cpu) sum += *per_cpu_ptr (desc->kstat_irqs, cpu);return sum;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 155/246 net: marvell: mvpp2: fix stuck in-band SGMII negotiation
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 316734fdcf70900a83065360cff11a5826919067 ]
It appears that the mvpp22 can get stuck with SGMII negotiation. The symptoms are that in-band negotiation never completes and the partner (eg, PHY) never reports SGMII link up, or if it supports negotiation bypass, goes into negotiation bypass mode (which will happen when the PHY sees that the MAC is alive but gets no response.)
Triggering the PHY end of the link to re-negotiate results in the bypass bit clearing on the PHY, and then re-setting - indicating that the problem is at the mvpp22 GMAC end.
Asserting the GMAC reset and de-asserting it resolves the issue. Arrange to assert the GMAC reset at probe time, and deassert it only after we have configured the GMAC for the appropriate mode. This resolves the issue.
--- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +11 -6
@@ -1380,13 +1380,9 @@ static void mvpp2_port_reset(struct mvpp2_port *port)for (i =0 ; i <ARRAY_SIZE (mvpp2_ethtool_regs); i++)mvpp2_read_count (port, &mvpp2_ethtool_regs[i]); - val =readl (port->base +MVPP2_GMAC_CTRL_2_REG ) & - ~MVPP2_GMAC_PORT_RESET_MASK ; + val =readl (port->base +MVPP2_GMAC_CTRL_2_REG ) | +MVPP2_GMAC_PORT_RESET_MASK ;writel (val, port->base +MVPP2_GMAC_CTRL_2_REG ); - -while (readl (port->base +MVPP2_GMAC_CTRL_2_REG ) & -MVPP2_GMAC_PORT_RESET_MASK ) -continue ; }/* Change maximum receive size of the port */
@@ -4543,12 +4539,15 @@ static void mvpp2_gmac_config(struct mvpp2_port *port, unsigned int mode, const struct phylink_link_state *state) {u32 an, ctrl0, ctrl2, ctrl4; +u32 old_ctrl2; an =readl (port->base +MVPP2_GMAC_AUTONEG_CONFIG ); ctrl0 =readl (port->base +MVPP2_GMAC_CTRL_0_REG ); ctrl2 =readl (port->base +MVPP2_GMAC_CTRL_2_REG ); ctrl4 =readl (port->base +MVPP22_GMAC_CTRL_4_REG ); + old_ctrl2 = ctrl2; +/* Force link down */ an &= ~MVPP2_GMAC_FORCE_LINK_PASS ; an |=MVPP2_GMAC_FORCE_LINK_DOWN ;
@@ -4621,6 +4620,12 @@ static void mvpp2_gmac_config(struct mvpp2_port *port, unsigned int mode,writel (ctrl2, port->base +MVPP2_GMAC_CTRL_2_REG );writel (ctrl4, port->base +MVPP22_GMAC_CTRL_4_REG );writel (an, port->base +MVPP2_GMAC_AUTONEG_CONFIG ); + +if (old_ctrl2 &MVPP2_GMAC_PORT_RESET_MASK ) { +while (readl (port->base +MVPP2_GMAC_CTRL_2_REG ) & +MVPP2_GMAC_PORT_RESET_MASK ) +continue ; + } } static void mvpp2_mac_config(struct net_device *dev, unsigned int mode,
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 156/246 iw_cxgb4: fix srqidx leak during connection abort
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit f368ff188ae4b3ef6f740a15999ea0373261b619 ]
When an application aborts the connection by moving QP from RTS to ERROR, then iw_cxgb4's modify_rc_qp() RTS->ERROR logic sets the *srqidxp to 0 via t4_set_wq_in_error(&qhp->wq, 0), and aborts the connection by calling c4iw_ep_disconnect().
c4iw_ep_disconnect() does the following:
1. sends up a close_complete_upcall(ep, -ECONNRESET) to libcxgb4.
2. sends abort request CPL to hw.
But, since the close_complete_upcall() is sent before sending the ABORT_REQ to hw, libcxgb4 would fail to release the srqidx if the connection holds one. Because, the srqidx is passed up to libcxgb4 only after corresponding ABORT_RPL is processed by kernel in abort_rpl().
This patch handle the corner-case by moving the call to close_complete_upcall() from c4iw_ep_disconnect() to abort_rpl(). So that libcxgb4 is notified about the -ECONNRESET only after abort_rpl(), and libcxgb4 can relinquish the srqidx properly.
--- drivers/infiniband/hw/cxgb4/cm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/infiniband/hw/cxgb4/cm.c +3 -2
@@ -1903,8 +1903,10 @@ static int abort_rpl(struct c4iw_dev *dev, struct sk_buff *skb) }mutex_unlock (&ep->com.mutex); -if (release) +if (release) { +close_complete_upcall (ep, -ECONNRESET );release_ep_resources (ep); + }c4iw_put_ep (&ep->com);return 0 ; }
@@ -3606,7 +3608,6 @@ int c4iw_ep_disconnect(struct c4iw_ep *ep, int abrupt, gfp_t gfp)if (close) {if (abrupt) {set_bit (EP_DISC_ABORT , &ep->com.history); -close_complete_upcall (ep, -ECONNRESET ); ret =send_abort (ep); }else {set_bit (EP_DISC_CLOSE , &ep->com.history);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 157/246 net: phy: consider latched link-down status in polling mode
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 93c0970493c71f264e6c3c7caf1ff24a9e1de786 ]
The link status value latches link-down events. To get the current status we read the register twice in genphy_update_link(). There's a potential risk that we miss a link-down event in polling mode. This may cause issues if the user e.g. connects his machine to a different network.
On the other hand reading the latched value may cause issues in interrupt mode. Following scenario:
- After boot link goes up
- phy_start() is called triggering an aneg restart, hence link goes down and link-down info is latched.
- After aneg has finished link goes up and triggers an interrupt. Interrupt handler reads link status, means it reads the latched "link is down" info. But there won't be another interrupt as long as link stays up, therefore phylib will never recognize that link is up.
Deal with both scenarios by reading the register twice in interrupt mode only.
--- drivers/net/phy/phy-c45.c | 10 ++++++++-- drivers/net/phy/phy_device.c | 13 +++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-)
drivers/net/phy/phy-c45.c +8 -2
@@ -147,9 +147,15 @@ int genphy_c45_read_link(struct phy_device *phydev, u32 mmd_mask) mmd_mask &= ~BIT (devad);/* The link state is latched low so that momentary link -* drops can be detected. Do not double-read the status -* register if the link is down. +* drops can be detected. Do not double-read the status +* in polling mode to detect such short link drops. */ +if (!phy_polling_mode (phydev)) { + val =phy_read_mmd (phydev, devad,MDIO_STAT1 ); +if (val <0 ) +return val; + } + val =phy_read_mmd (phydev, devad,MDIO_STAT1 );if (val <0 )return val;
drivers/net/phy/phy_device.c +9 -4
@@ -1683,10 +1683,15 @@ int genphy_update_link(struct phy_device *phydev) {int status; -/* Do a fake read */ - status =phy_read (phydev,MII_BMSR ); -if (status <0 ) -return status; +/* The link state is latched low so that momentary link +* drops can be detected. Do not double-read the status +* in polling mode to detect such short link drops. +*/ +if (!phy_polling_mode (phydev)) { + status =phy_read (phydev,MII_BMSR ); +if (status <0 ) +return status; + }/* Read link and autonegotiation status */ status =phy_read (phydev,MII_BMSR );
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 158/246 fbdev: fbmem: fix memory access if logo is bigger than the screen
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit a5399db139cb3ad9b8502d8b1bd02da9ce0b9df0 ]
There is no clipping on the x or y axis for logos larger that the framebuffer size. Therefore: a logo bigger than screen size leads to invalid memory access:
[ 1.254664] Backtrace: [ 1.254728] [<c02714e0>] (cfb_imageblit) from [<c026184c>] (fb_show_logo+0x620/0x684) [ 1.254763] r10:00000003 r9:00027fd8 r8:c6a40000 r7:c6a36e50 r6:00000000 r5:c06b81e4 [ 1.254774] r4:c6a3e800 [ 1.254810] [<c026122c>] (fb_show_logo) from [<c026c1e4>] (fbcon_switch+0x3fc/0x46c) [ 1.254842] r10:c6a3e824 r9:c6a3e800 r8:00000000 r7:c6a0c000 r6:c070b014 r5:c6a3e800 [ 1.254852] r4:c6808c00 [ 1.254889] [<c026bde8>] (fbcon_switch) from [<c029c8f8>] (redraw_screen+0xf0/0x1e8) [ 1.254918] r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:c070d5a0 r5:00000080 [ 1.254928] r4:c6808c00 [ 1.254961] [<c029c808>] (redraw_screen) from [<c029d264>] (do_bind_con_driver+0x194/0x2e4) [ 1.254991] r9:00000000 r8:00000000 r7:00000014 r6:c070d5a0 r5:c070d5a0 r4:c070d5a0
So prevent displaying a logo bigger than screen size and avoid invalid memory access.
--- drivers/video/fbdev/core/fbmem.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/video/fbdev/core/fbmem.c +3 -0
@@ -431,6 +431,9 @@ static void fb_do_show_logo(struct fb_info *info, struct fb_image *image, {unsigned int x; +if (image->width > info->var.xres || image->height > info->var.yres) +return ; +if (rotate ==FB_ROTATE_UR ) { for (x = 0; x < num && image->dx + image->width <= info->var.xres;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 159/246 cdrom: Fix race condition in cdrom_sysctl_register
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit f25191bb322dec8fa2979ecb8235643aa42470e1 ]
The following traceback is sometimes seen when booting an image in qemu:
[ 54.608293] cdrom: Uniform CD-ROM driver Revision: 3.20 [ 54.611085] Fusion MPT base driver 3.04.20 [ 54.611877] Copyright (c) 1999-2008 LSI Corporation [ 54.616234] Fusion MPT SAS Host driver 3.04.20 [ 54.635139] sysctl duplicate entry: /dev/cdrom//info [ 54.639578] CPU: 0 PID: 266 Comm: kworker/u4:5 Not tainted 5.0.0-rc5 #1 [ 54.639578] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015 [ 54.641273] Workqueue: events_unbound async_run_entry_fn [ 54.641273] Call Trace: [ 54.641273] dump_stack+0x67/0x90 [ 54.641273] __register_sysctl_table+0x50b/0x570 [ 54.641273] ? rcu_read_lock_sched_held+0x6f/0x80 [ 54.641273] ? kmem_cache_alloc_trace+0x1c7/0x1f0 [ 54.646814] __register_sysctl_paths+0x1c8/0x1f0 [ 54.646814] cdrom_sysctl_register.part.7+0xc/0x5f [ 54.646814] register_cdrom.cold.24+0x2a/0x33 [ 54.646814] sr_probe+0x4bd/0x580 [ 54.646814] ? __driver_attach+0xd0/0xd0 [ 54.646814] really_probe+0xd6/0x260 [ 54.646814] ? __driver_attach+0xd0/0xd0 [ 54.646814] driver_probe_device+0x4a/0xb0 [ 54.646814] ? __driver_attach+0xd0/0xd0 [ 54.646814] bus_for_each_drv+0x73/0xc0 [ 54.646814] __device_attach+0xd6/0x130 [ 54.646814] bus_probe_device+0x9a/0xb0 [ 54.646814] device_add+0x40c/0x670 [ 54.646814] ? __pm_runtime_resume+0x4f/0x80 [ 54.646814] scsi_sysfs_add_sdev+0x81/0x290 [ 54.646814] scsi_probe_and_add_lun+0x888/0xc00 [ 54.646814] ? scsi_autopm_get_host+0x21/0x40 [ 54.646814] __scsi_add_device+0x116/0x130 [ 54.646814] ata_scsi_scan_host+0x93/0x1c0 [ 54.646814] async_run_entry_fn+0x34/0x100 [ 54.646814] process_one_work+0x237/0x5e0 [ 54.646814] worker_thread+0x37/0x380 [ 54.646814] ? rescuer_thread+0x360/0x360 [ 54.646814] kthread+0x118/0x130 [ 54.646814] ? kthread_create_on_node+0x60/0x60 [ 54.646814] ret_from_fork+0x3a/0x50
The only sensible explanation is that cdrom_sysctl_register() is called twice, once from the module init function and once from register_cdrom(). cdrom_sysctl_register() is not mutex protected and may happily execute twice if the second call is made before the first call is complete.
Use a static atomic to ensure that the function is executed exactly once.
--- drivers/cdrom/cdrom.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/cdrom/cdrom.c +3 -4
@@ -265,6 +265,7 @@/* #define ERRLOGMASK (CD_WARNING|CD_OPEN|CD_COUNT_TRACKS|CD_CLOSE) */ /* #define ERRLOGMASK (CD_WARNING|CD_REG_UNREG|CD_DO_IOCTL|CD_OPEN|CD_CLOSE|CD_COUNT_TRACKS) */ +#include <linux/atomic.h> #include <linux/module.h> #include <linux/fs.h> #include <linux/major.h>
@@ -3692,9 +3693,9 @@ static struct ctl_table_header *cdrom_sysctl_header;static void cdrom_sysctl_register (void ) { -static int initialized; +static atomic_t initialized =ATOMIC_INIT (0 ); -if (initialized ==1 ) +if (!atomic_add_unless (&initialized,1 ,1 ))return ; cdrom_sysctl_header =register_sysctl_table (cdrom_root_table);
@@ -3705,8 +3706,6 @@ static void cdrom_sysctl_register(void) cdrom_sysctl_settings.debug = debug; cdrom_sysctl_settings.lock = lockdoor; cdrom_sysctl_settings.check = check_media_type; - - initialized =1 ; }static void cdrom_sysctl_unregister (void )
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 160/246 drm: rcar-du: add missing of_node_put
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 4c6d8fc20b09f9684743afd72e4dbc3f15524479 ]
Add an of_node_put when the result of of_graph_get_remote_port_parent is not available.
Add a second of_node_put if no encoder is selected (encoder remains NULL).
The semantic match that finds the first problem is as follows
(http://coccinelle.lip6.fr):
// <smpl>
@r exists@
local idexpression e;
expression x;
@@
e = of_graph_get_remote_port_parent(...);
... when != x = e
when != true e == NULL
when != of_node_put(e)
when != of_fwnode_handle(e)(
return e;
|
*return ...;
)
// </smpl>
--- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/rcar-du/rcar_du_kms.c +2 -0
@@ -331,6 +331,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,dev_dbg (rcdu->dev,"connected entity %pOF is disabled, skipping\n" , entity); +of_node_put (entity);return -ENODEV ; }
@@ -366,6 +367,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,dev_warn (rcdu->dev,"no encoder found for endpoint %pOF, skipping\n" , ep->local_node); +of_node_put (entity);return -ENODEV ; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 161/246 drm/amd/display: Dont re-program planes for DPMS changes
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 5062b797db4103218fa00ee254417b8ecaab7401 ]
[Why]
There are opt1c lock warnings and CRTC read timeouts when running the "igt@kms_plane@plane-position-hole-dpms-pipe-*" tests. These are caused by trying to reprogram planes that are not in the current context.
DPMS off removes the stream from the context. In this case:
new_crtc_state->active_changed = truenew_crtc_state->mode_changed = false
The planes are reprogrammed before the stream is removed from the context because stream_state->mode_changed = false.
For DPMS adds the stream and planes back to the context:
new_crtc_state->active_changed = truenew_crtc_state->mode_changed = false
The planes are also reprogrammed here before the stream is added to the context because stream_state->mode_changed = true. They were not previously in the current context so warnings occur here.
[How]
Set stream_state->mode_changed = true whennew_crtc_state->active_changed = true too.
This prevents reprogramming before the context is applied in DC. The programming will be done after the context is applied.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
@@ -4975,7 +4975,8 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,static void amdgpu_dm_crtc_copy_transient_flags (struct drm_crtc_state *crtc_state,struct dc_stream_state *stream_state) { - stream_state->mode_changed = crtc_state->mode_changed; + stream_state->mode_changed = + crtc_state->mode_changed || crtc_state->active_changed; } static int amdgpu_dm_atomic_commit(struct drm_device *dev,
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 162/246 bpf: test_maps: fix possible out of bound access warning
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit dd9cef43c222df7c0d76d34451808e789952379d ]
When compiling test_maps selftest with GCC-8, it warns that an array might be indexed with a negative value, which could cause a negative out of bound access, depending on parameters of the function. This is the GCC-8 warning:
gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../lib/bpf -I../../../../include/generated -DHAVE_GENHDR -I../../../include test_maps.c /home/breno/Devel/linux/tools/testing/selftests/bpf/libbpf.a -lcap -lelf -lrt -lpthread -o /home/breno/Devel/linux/tools/testing/selftests/bpf/test_maps In file included from test_maps.c:16: test_maps.c: In function ‘run_all_tests’: test_maps.c:1079:10: warning: array subscript -1 is below array bounds of ‘pid_t[<Ube20> + 1]’ [-Warray-bounds] assert(waitpid(pid[i], &status, 0) == pid[i]); ^~~~~~~~~~~~~~~~~~~~~~~~~~~ test_maps.c:1059:6: warning: array subscript -1 is below array bounds of ‘pid_t[<Ube20> + 1]’ [-Warray-bounds] pid[i] = fork(); ~~~^~~
This patch simply guarantees that the task(s) variables are unsigned, thus, they could never be a negative number (which they are not in current code anyway), hence avoiding an out of bound access warning.
--- tools/testing/selftests/bpf/test_maps.c | 27 +++++++++++++------------ 1 file changed, 14 insertions(+), 13 deletions(-)
tools/testing/selftests/bpf/test_maps.c +14 -13
@@ -43,7 +43,7 @@ static int map_flags; } \ }) -static void test_hashmap (int task,void *data) +static void test_hashmap (unsigned int task,void *data) {long long key, next_key, first_key, value;int fd;
@@ -133,7 +133,7 @@ static void test_hashmap(int task, void *data)close (fd); } -static void test_hashmap_sizes (int task,void *data) +static void test_hashmap_sizes (unsigned int task,void *data) {int fd, i, j;
@@ -153,7 +153,7 @@ static void test_hashmap_sizes(int task, void *data) } } -static void test_hashmap_percpu (int task,void *data) +static void test_hashmap_percpu (unsigned int task,void *data) {unsigned int nr_cpus =bpf_num_possible_cpus ();BPF_DECLARE_PERCPU (long, value);
@@ -280,7 +280,7 @@ static int helper_fill_hashmap(int max_entries)return fd; } -static void test_hashmap_walk (int task,void *data) +static void test_hashmap_walk (unsigned int task,void *data) {int fd, i, max_entries =1000 ;long long key, value, next_key;
@@ -351,7 +351,7 @@ static void test_hashmap_zero_seed(void)close (second); } -static void test_arraymap (int task,void *data) +static void test_arraymap (unsigned int task,void *data) {int key, next_key, fd;long long value;
@@ -406,7 +406,7 @@ static void test_arraymap(int task, void *data)close (fd); } -static void test_arraymap_percpu (int task,void *data) +static void test_arraymap_percpu (unsigned int task,void *data) {unsigned int nr_cpus =bpf_num_possible_cpus ();BPF_DECLARE_PERCPU (long, values);
@@ -502,7 +502,7 @@ static void test_arraymap_percpu_many_keys(void)close (fd); } -static void test_devmap (int task,void *data) +static void test_devmap (unsigned int task,void *data) {int fd;__u32 key, value;
@@ -517,7 +517,7 @@ static void test_devmap(int task, void *data)close (fd); } -static void test_queuemap (int task,void *data) +static void test_queuemap (unsigned int task,void *data) {const int MAP_SIZE =32 ;__u32 vals[MAP_SIZE +MAP_SIZE /2 ], val;
@@ -575,7 +575,7 @@ static void test_queuemap(int task, void *data)close (fd); } -static void test_stackmap (int task,void *data) +static void test_stackmap (unsigned int task,void *data) {const int MAP_SIZE =32 ;__u32 vals[MAP_SIZE +MAP_SIZE /2 ], val;
@@ -641,7 +641,7 @@ static void test_stackmap(int task, void *data)#define SOCKMAP_PARSE_PROG "./sockmap_parse_prog.o"#define SOCKMAP_VERDICT_PROG "./sockmap_verdict_prog.o"#define SOCKMAP_TCP_MSG_PROG "./sockmap_tcp_msg_prog.o" -static void test_sockmap (int tasks,void *data) +static void test_sockmap (unsigned int tasks,void *data) {struct bpf_map *bpf_map_rx, *bpf_map_tx, *bpf_map_msg, *bpf_map_break;int map_fd_msg =0 , map_fd_rx =0 , map_fd_tx =0 , map_fd_break;
@@ -1258,10 +1258,11 @@ static void test_map_large(void) }#define run_parallel (N ,FN ,DATA ) \ - printf("Fork %d tasks to '" #FN "'\n", N); \ + printf("Fork %u tasks to '" #FN "'\n", N); \ __run_parallel(N, FN, DATA) -static void __run_parallel (int tasks,void (*fn)(int task,void *data), +static void __run_parallel (unsigned int tasks, +void (*fn)(unsigned int task,void *data),void *data) {pid_t pid[tasks];
@@ -1302,7 +1303,7 @@ static void test_map_stress(void)#define DO_UPDATE 1#define DO_DELETE 0 -static void test_update_delete (int fn,void *data) +static void test_update_delete (unsigned int fn,void *data) {int do_update = ((int *)data)[1 ];int fd = ((int *)data)[0 ];
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 163/246 x86/kexec: Fill in acpi_rsdp_addr from the first kernel
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit ccec81e4251f5a5421e02874e394338a897056ca ]
When efi=noruntime or efi=oldmap is used on the kernel command line, EFI services won't be available in the second kernel, therefore the second kernel will not be able to get the ACPI RSDP address from firmware by calling EFI services and so it won't boot.
Commit
e6e094e053af ("x86/acpi, x86/boot: Take RSDP address from boot params if available")
added an acpi_rsdp_addr field to boot_params which stores the RSDP address for other kernel users.
Recently, after
3a63f70bf4c3 ("x86/boot: Early parse RSDP and save it in boot_params")
the acpi_rsdp_addr will always be filled with a valid RSDP address.
So fill in that value into the second kernel's boot_params thus ensuring that the second kernel receives the RSDP value from the first kernel.
[ bp: massage commit message. ]
--- arch/x86/kernel/kexec-bzimage64.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/x86/kernel/kexec-bzimage64.c +3 -1
@@ -218,6 +218,9 @@ setup_boot_parameters(struct kimage *image, struct boot_params *params, params->screen_info.ext_mem_k =0 ; params->alt_mem_k =0 ; +/* Always fill in RSDP: it is either 0 or a valid value */ + params->acpi_rsdp_addr = boot_params.acpi_rsdp_addr; +/* Default APM info */ memset (¶ms->apm_bios_info,0 ,sizeof (params->apm_bios_info));
@@ -256,7 +259,6 @@ setup_boot_parameters(struct kimage *image, struct boot_params *params,setup_efi_state (params, params_load_addr, efi_map_offset, efi_map_sz, efi_setup_data_offset);#endif -/* Setup EDD info */ memcpy (params->eddbuf, boot_params.eddbuf,EDDMAXNR *sizeof (struct edd_info ));
Signature · 9 lines
2.19.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Greg Kroah-Hartman
maintainerPATCH 164/246 powerpc/ptrace: Mitigate potential Spectre v1
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit ebb0e13ead2ddc186a80b1b0235deeefc5a1a667 ]
'regno' is directly controlled by user space, hence leading to a potential exploitation of the Spectre variant 1 vulnerability.
On PTRACE_SETREGS and PTRACE_GETREGS requests, user space passes the register number that would be read or written. This register number is called 'regno' which is part of the 'addr' syscall parameter.
This 'regno' value is checked against the maximum pt_regs structure size, and then used to dereference it, which matches the initial part of a Spectre v1 (and Spectre v1.1) attack. The dereferenced value, then, is returned to userspace in the GETREGS case.
This patch sanitizes 'regno' before using it to dereference pt_reg.
Notice that given that speculation windows are large, the policy is to kill the speculation on the first load and not worry if it can be completed with a dependent load/store [1].
[1] https://marc.info/?l=linux-kernel&m=152449131114778&w=2
--- arch/powerpc/kernel/ptrace.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
arch/powerpc/kernel/ptrace.c +7 -1
@@ -33,6 +33,7 @@#include <linux/hw_breakpoint.h> #include <linux/perf_event.h> #include <linux/context_tracking.h> +#include <linux/nospec.h> #include <linux/uaccess.h> #include <linux/pkeys.h>
@@ -274,6 +275,8 @@ static int set_user_trap(struct task_struct *task, unsigned long trap)*/ int ptrace_get_reg (struct task_struct *task,int regno,unsigned long *data) { +unsigned int regs_max; +if ((task->thread.regs ==NULL ) || !data)return -EIO ;
@@ -297,7 +300,9 @@ int ptrace_get_reg(struct task_struct *task, int regno, unsigned long *data) }#endif -if (regno < (sizeof (struct user_pt_regs ) /sizeof (unsigned long ))) { + regs_max =sizeof (struct user_pt_regs ) /sizeof (unsigned long ); +if (regno < regs_max) { + regno =array_index_nospec (regno, regs_max); *data = ((unsigned long *)task->thread.regs)[regno];return 0 ; }
@@ -321,6 +326,7 @@ int ptrace_put_reg(struct task_struct *task, int regno, unsigned long data)return set_user_dscr (task, data);if (regno <=PT_MAX_PUT_REG ) { + regno =array_index_nospec (regno,PT_MAX_PUT_REG +1 ); ((unsigned long *)task->thread.regs)[regno] = data;return 0 ; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 165/246 drm/amd/display: Disconnect mpcc when changing tg
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 77476360f173c127c191bfe8ca8113130ef283b8 ]
[Why]
This fixes an mpc programming error for the following sequence of atomic commits when pipe split is enabled:
Commit 1: CRTC0 (plane 4, plane 3)
Pipe 0: old_plane_state = A0, new_plane_state = A1, new_tg = T0
Pipe 1: old_plane_state = B0, new_plane_state = B1, new_tg = T0
Pipe 2: old_plane_state = A0, new_plane_state = A1, new_tg = T0
Pipe 3: old_plane_state = B0, new_plane_state = B1, new_tg = T0
Commit 2: CRTC0 (plane 3), CRTC1 (plane 2)
Pipe 0: old_plane_state = A1, new_plane_state = A2, new_tg = T0
Pipe 1: old_plane_state = B1, new_plane_state = B2, new_tg = T1
Pipe 2: old_plane_state = A1, new_plane_state = NULL, new_tg = NULL Pipe 3: old_plane_state = B1, new_plane_state = NULL, new_tg = NULL
In the second commit the assertion for mpcc in use is hit because mpcc disconnect never occurs for pipe 1. This is because the stream changes for pipe 1 and the opp_list is empty.
This sequence occurs when running the "igt@kms_plane_multiple@atomic-pipe-A-tiling-none" test with two displays connected.
[How]
Expand the reset condition to include:
"old_pipe_ctx->stream_res.tg != new_pipe_ctx->stream_res.tg"
...but only when the plane state is non-NULL for both old and new.
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +4 -3
@@ -2334,9 +2334,10 @@ static void dcn10_apply_ctx_for_surface( } } -if (!pipe_ctx->plane_state && - old_pipe_ctx->plane_state && - old_pipe_ctx->stream_res.tg == tg) { +if ((!pipe_ctx->plane_state || + pipe_ctx->stream_res.tg != old_pipe_ctx->stream_res.tg) && + old_pipe_ctx->plane_state && + old_pipe_ctx->stream_res.tg == tg) { dc->hwss.plane_atomic_disconnect (dc, old_pipe_ctx); removed_pipe[i] = true;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 166/246 perf/aux: Make perf_event accessible to setup_aux()
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 840018668ce2d96783356204ff282d6c9b0e5f66 ]
When pmu::setup_aux() is called the coresight PMU needs to know which sink to use for the session by looking up the information in the event's attr::config2 field.
As such simply replace the cpu information by the complete perf_event structure and change all affected customers.
--- arch/s390/kernel/perf_cpum_sf.c | 6 +++--- arch/x86/events/intel/bts.c | 4 +++- arch/x86/events/intel/pt.c | 5 +++-- drivers/hwtracing/coresight/coresight-etm-perf.c | 6 +++--- drivers/perf/arm_spe_pmu.c | 6 +++--- include/linux/perf_event.h | 2 +- kernel/events/ring_buffer.c | 2 +- 7 files changed, 17 insertions(+), 14 deletions(-)
arch/s390/kernel/perf_cpum_sf.c +3 -3
@@ -1600,7 +1600,7 @@ static void aux_sdb_init(unsigned long sdb)/* * aux_buffer_setup() - Setup AUX buffer for diagnostic mode sampling -* @cpu: On which to allocate, -1 means current +* @event: Event the buffer is setup for, event->cpu == -1 means current * @pages: Array of pointers to buffer pages passed from perf core * @nr_pages: Total pages * @snapshot: Flag for snapshot mode
@@ -1612,8 +1612,8 @@ static void aux_sdb_init(unsigned long sdb)* * Return the private AUX buffer structure if success or NULL if fails. */ -static void *aux_buffer_setup (int cpu,void **pages,int nr_pages, -bool snapshot) +static void *aux_buffer_setup (struct perf_event *event,void **pages, +int nr_pages,bool snapshot) {struct sf_buffer *sfb;struct aux_buffer *aux;
arch/x86/events/intel/bts.c +3 -1
@@ -77,10 +77,12 @@ static size_t buf_size(struct page *page) }static void * -bts_buffer_setup_aux (int cpu,void **pages,int nr_pages,bool overwrite) +bts_buffer_setup_aux (struct perf_event *event,void **pages, +int nr_pages,bool overwrite) {struct bts_buffer *buf;struct page *page; +int cpu = event->cpu;int node = (cpu ==-1 ) ? cpu :cpu_to_node (cpu);unsigned long offset;size_t size = nr_pages <<PAGE_SHIFT ;
arch/x86/events/intel/pt.c +3 -2
@@ -1114,10 +1114,11 @@ static int pt_buffer_init_topa(struct pt_buffer *buf, unsigned long nr_pages,* Return: Our private PT buffer structure. */ static void * -pt_buffer_setup_aux (int cpu,void **pages,int nr_pages,bool snapshot) +pt_buffer_setup_aux (struct perf_event *event,void **pages, +int nr_pages,bool snapshot) {struct pt_buffer *buf; -int node, ret; +int node, ret, cpu = event->cpu;if (!nr_pages)return NULL ;
drivers/hwtracing/coresight/coresight-etm-perf.c +3 -3
@@ -177,15 +177,15 @@ static void etm_free_aux(void *data)schedule_work (&event_data->work); } -static void *etm_setup_aux (int event_cpu,void **pages, +static void *etm_setup_aux (struct perf_event *event,void **pages,int nr_pages,bool overwrite) { -int cpu; +int cpu = event->cpu;cpumask_t *mask;struct coresight_device *sink;struct etm_event_data *event_data =NULL ; - event_data =alloc_event_data (event_cpu); + event_data =alloc_event_data (cpu);if (!event_data)return NULL ;INIT_WORK (&event_data->work, free_event_data);
drivers/perf/arm_spe_pmu.c +3 -3
@@ -824,10 +824,10 @@ static void arm_spe_pmu_read(struct perf_event *event) { } -static void *arm_spe_pmu_setup_aux (int cpu,void **pages,int nr_pages, -bool snapshot) +static void *arm_spe_pmu_setup_aux (struct perf_event *event,void **pages, +int nr_pages,bool snapshot) { -int i; +int i, cpu = event->cpu;struct page **pglist;struct arm_spe_pmu_buf *buf;
include/linux/perf_event.h +1 -1
@@ -409,7 +409,7 @@ struct pmu {/* * Set up pmu-private data structures for an AUX area */ -void *(*setup_aux) (int cpu,void **pages, +void *(*setup_aux) (struct perf_event *event,void **pages,int nr_pages,bool overwrite);/* optional */
kernel/events/ring_buffer.c +1 -1
@@ -658,7 +658,7 @@ int rb_alloc_aux(struct ring_buffer *rb, struct perf_event *event, goto out; } - rb->aux_priv = event->pmu->setup_aux (event->cpu, rb->aux_pages, nr_pages, + rb->aux_priv = event->pmu->setup_aux (event, rb->aux_pages, nr_pages, overwrite);if (!rb->aux_priv) goto out;
Signature · 9 lines
2.19.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 167/246 e1000e: fix cyclic resets at link up with active tx
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 0f9e980bf5ee1a97e2e401c846b2af989eb21c61 ]
I'm seeing series of e1000e resets (sometimes endless) at system boot if something generates tx traffic at this time. In my case this is netconsole who sends message "e1000e 0000:02:00.0: Some CPU C-states have been disabled in order to enable jumbo frames" from e1000e itself. As result e1000_watchdog_task sees used tx buffer while carrier is off and start this reset cycle again.
[ 17.794359] e1000e: eth1 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None [ 17.794714] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready [ 22.936455] e1000e 0000:02:00.0 eth1: changing MTU from 1500 to 9000 [ 23.033336] e1000e 0000:02:00.0: Some CPU C-states have been disabled in order to enable jumbo frames [ 26.102364] e1000e: eth1 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None [ 27.174495] 8021q: 802.1Q VLAN Support v1.8 [ 27.174513] 8021q: adding VLAN 0 to HW filter on device eth1 [ 30.671724] cgroup: cgroup: disabling cgroup2 socket matching due to net_prio or net_cls activation [ 30.898564] netpoll: netconsole: local port 6666 [ 30.898566] netpoll: netconsole: local IPv6 address 2a02:6b8:0:80b:beae:c5ff:fe28:23f8 [ 30.898567] netpoll: netconsole: interface 'eth1' [ 30.898568] netpoll: netconsole: remote port 6666 [ 30.898568] netpoll: netconsole: remote IPv6 address 2a02:6b8:b000:605c:e61d:2dff:fe03:3790 [ 30.898569] netpoll: netconsole: remote ethernet address b0:a8:6e:f4:ff:c0 [ 30.917747] console [netcon0] enabled [ 30.917749] netconsole: network logging started [ 31.453353] e1000e 0000:02:00.0: Some CPU C-states have been disabled in order to enable jumbo frames [ 34.185730] e1000e 0000:02:00.0: Some CPU C-states have been disabled in order to enable jumbo frames [ 34.321840] e1000e 0000:02:00.0: Some CPU C-states have been disabled in order to enable jumbo frames [ 34.465822] e1000e 0000:02:00.0: Some CPU C-states have been disabled in order to enable jumbo frames [ 34.597423] e1000e 0000:02:00.0: Some CPU C-states have been disabled in order to enable jumbo frames [ 34.745417] e1000e 0000:02:00.0: Some CPU C-states have been disabled in order to enable jumbo frames [ 34.877356] e1000e 0000:02:00.0: Some CPU C-states have been disabled in order to enable jumbo frames [ 35.005441] e1000e 0000:02:00.0: Some CPU C-states have been disabled in order to enable jumbo frames [ 35.157376] e1000e 0000:02:00.0: Some CPU C-states have been disabled in order to enable jumbo frames [ 35.289362] e1000e 0000:02:00.0: Some CPU C-states have been disabled in order to enable jumbo frames [ 35.417441] e1000e 0000:02:00.0: Some CPU C-states have been disabled in order to enable jumbo frames [ 37.790342] e1000e: eth1 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
This patch flushes tx buffers only once when carrier is off rather than at each watchdog iteration.
--- drivers/net/ethernet/intel/e1000e/netdev.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/net/ethernet/intel/e1000e/netdev.c +6 -9
@@ -5309,8 +5309,13 @@ static void e1000_watchdog_task(struct work_struct *work)/* 8000ES2LAN requires a Rx packet buffer work-around * on link down event; reset the controller to flush * the Rx packet buffer. +* +* If the link is lost the controller stops DMA, but +* if there is queued Tx work it cannot be done. So +* reset the controller to flush the Tx packet buffers. */ -if (adapter->flags &FLAG_RX_NEEDS_RESTART ) +if ((adapter->flags &FLAG_RX_NEEDS_RESTART ) || +e1000_desc_unused (tx_ring) +1 < tx_ring->count) adapter->flags |=FLAG_RESTART_NOW ;else pm_schedule_suspend(netdev->dev.parent,
@@ -5333,14 +5338,6 @@ link_up: adapter->gotc_old = adapter->stats.gotc;spin_unlock (&adapter->stats64_lock); -/* If the link is lost the controller stops DMA, but -* if there is queued Tx work it cannot be done. So -* reset the controller to flush the Tx packet buffers. -*/ -if (!netif_carrier_ok (netdev) && - (e1000_desc_unused (tx_ring) +1 < tx_ring->count)) - adapter->flags |=FLAG_RESTART_NOW ; -/* If reset is necessary, do it outside of interrupt context. */ if (adapter->flags &FLAG_RESTART_NOW ) {schedule_work (&adapter->reset_task);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 168/246 e1000e: Exclude device from suspend direct complete optimization
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 59f58708c5047289589cbf6ee95146b76cf57d1e ]
e1000e sets different WoL settings in system suspend callback and runtime suspend callback.
The suspend direct complete optimization leaves e1000e in runtime suspended state with wrong WoL setting during system suspend.
To fix this, we need to disable suspend direct complete optimization to let e1000e always use suspend callback to set correct WoL during system suspend.
--- drivers/net/ethernet/intel/e1000e/netdev.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/intel/e1000e/netdev.c +2 -0
@@ -7348,6 +7348,8 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)e1000_print_device_info (adapter); +dev_pm_set_driver_flags (&pdev->dev,DPM_FLAG_NEVER_SKIP ); +if (pci_dev_run_wake (pdev))pm_runtime_put_noidle (&pdev->dev);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 169/246 platform/x86: intel_pmc_core: Fix PCH IP sts reading
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 0e68eeea9894feeba2edf7ec63e4551b87f39621 ]
A previous commit "platform/x86: intel_pmc_core: Make the driver PCH family agnostic <c977b98bbef5898ed3d30b08ea67622e9e82082a>" provided better abstraction to this driver but has some fundamental issues.
e.g. the following condition
for (index = 0; index < pmcdev->map->ppfear_buckets &&
index < PPFEAR_MAX_NUM_ENTRIES; index++, iter++)
is wrong because for CNL, PPFEAR_MAX_NUM_ENTRIES is hardcoded as 5 which is _wrong_ and even though ppfear_buckets is 8, the loop fails to read all eight registers needed for CNL PCH i.e. PPFEAR0 and PPFEAR1. This patch refactors the pfear show logic to correctly read PCH IP power gating status for Cannonlake and beyond.
--- drivers/platform/x86/intel_pmc_core.c | 3 ++- drivers/platform/x86/intel_pmc_core.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/platform/x86/intel_pmc_core.c +2 -1
@@ -380,7 +380,8 @@ static int pmc_core_ppfear_show(struct seq_file *s, void *unused) index < PPFEAR_MAX_NUM_ENTRIES; index++, iter++) pf_regs[index] =pmc_core_reg_read_byte (pmcdev, iter); -for (index =0 ; map[index].name; index++) +for (index =0 ; map[index].name && + index < pmcdev->map->ppfear_buckets *8 ; index++)pmc_core_display_map (s, index, pf_regs[index /8 ], map);return 0 ;
drivers/platform/x86/intel_pmc_core.h +1 -1
@@ -32,7 +32,7 @@#define SPT_PMC_SLP_S0_RES_COUNTER_STEP 0x64#define PMC_BASE_ADDR_MASK ~(SPT_PMC_MMIO_REG_LEN - 1)#define MTPMC_MASK 0xffff0000 -#define PPFEAR_MAX_NUM_ENTRIES 5 +#define PPFEAR_MAX_NUM_ENTRIES 12#define SPT_PPFEAR_NUM_ENTRIES 5#define SPT_PMC_READ_DISABLE_BIT 0x16#define SPT_PMC_MSG_FULL_STS_BIT 0x18
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 170/246 i2c: of: Try to find an I2C adapter matching the parent
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit e814e688413aabd7b0d75e2a8ed1caa472951dec ]
If an I2C adapter doesn't match the provided device tree node, also try matching the parent's device tree node. This allows finding an adapter based on the device node of the parent device that was used to register it.
This fixes a regression on Tegra124-based Chromebooks (Nyan) where the eDP controller registers an I2C adapter that is used to read to EDID. After commit 993a815dcbb2 ("dt-bindings: panel: Add missing .txt suffix") this stopped working because the I2C adapter could no longer be found. The approach in this patch fixes the regression without introducing the issues that the above commit solved.
--- drivers/i2c/i2c-core-of.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/i2c/i2c-core-of.c +13 -1
@@ -121,6 +121,17 @@ static int of_dev_node_match(struct device *dev, void *data)return dev->of_node == data; } +static int of_dev_or_parent_node_match (struct device *dev,void *data) +{ +if (dev->of_node == data) +return 1 ; + +if (dev->parent) +return dev->parent->of_node == data; + +return 0 ; +} +/* must call put_device() when done with returned i2c_client device */ struct i2c_client *of_find_i2c_device_by_node (struct device_node *node) {
@@ -145,7 +156,8 @@ struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node)struct device *dev;struct i2c_adapter *adapter; - dev =bus_find_device (&i2c_bus_type,NULL , node, of_dev_node_match); + dev =bus_find_device (&i2c_bus_type,NULL , node, + of_dev_or_parent_node_match);if (!dev)return NULL ;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 171/246 staging: spi: mt7621: Add return code check on device_reset()
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 46c337872f34bc6387b0c29a4964f562c70139e3 ]
This patch adds a return code check on device_reset() and removes the compile warning.
--- drivers/staging/mt7621-spi/spi-mt7621.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/staging/mt7621-spi/spi-mt7621.c +6 -1
@@ -330,6 +330,7 @@ static int mt7621_spi_probe(struct platform_device *pdev)int status =0 ;struct clk *clk;struct mt7621_spi_ops *ops; +int ret; match =of_match_device (mt7621_spi_match, &pdev->dev);if (!match)
@@ -377,7 +378,11 @@ static int mt7621_spi_probe(struct platform_device *pdev) rs->pending_write =0 ;dev_info (&pdev->dev,"sys_freq: %u\n" , rs->sys_freq); -device_reset (&pdev->dev); + ret =device_reset (&pdev->dev); +if (ret) { +dev_err (&pdev->dev,"SPI reset failed!\n" ); +return ret; + }mt7621_spi_reset (rs);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 172/246 iwlwifi: mvm: fix RFH config command with >=10 CPUs
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit dbf592f3d14fb7d532cb7c820b1065cf33e02aaa ]
If we have >=10 (logical) CPUs, our command size exceeds the internal buffer size and the command fails; fix that by using IWL_HCMD_DFL_NOCOPY for the command that's allocated anyway.
While at it, also fix the leak of cmd, and use struct_size() to calculate its size.
--- drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/fw.c +14 -6
@@ -127,13 +127,17 @@ static int iwl_send_rss_cfg_cmd(struct iwl_mvm *mvm)static int iwl_configure_rxq (struct iwl_mvm *mvm) { -int i, num_queues, size; +int i, num_queues, size, ret;struct iwl_rfh_queue_config *cmd; +struct iwl_host_cmd hcmd = { + .id =WIDE_ID (DATA_PATH_GROUP ,RFH_QUEUE_CONFIG_CMD ), + .dataflags[0 ] =IWL_HCMD_DFL_NOCOPY , + };/* Do not configure default queue, it is configured via context info */ num_queues = mvm->trans->num_rx_queues -1 ; - size =sizeof (*cmd) + num_queues *sizeof (struct iwl_rfh_queue_data ); + size =struct_size (cmd, data, num_queues); cmd =kzalloc (size,GFP_KERNEL );if (!cmd)
@@ -154,10 +158,14 @@ static int iwl_configure_rxq(struct iwl_mvm *mvm) cmd->data[i].fr_bd_wid =cpu_to_le32 (data.fr_bd_wid); } -return iwl_mvm_send_cmd_pdu (mvm, -WIDE_ID (DATA_PATH_GROUP , -RFH_QUEUE_CONFIG_CMD ), -0 , size, cmd); + hcmd.data[0 ] = cmd; + hcmd.len[0 ] = size; + + ret =iwl_mvm_send_cmd (mvm, &hcmd); + +kfree (cmd); + +return ret; }static int iwl_mvm_send_dqa_cmd (struct iwl_mvm *mvm)
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 173/246 ASoC: fsl-asoc-card: fix object reference leaks in fsl_asoc_card_probe
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 11907e9d3533648615db08140e3045b829d2c141 ]
The of_find_device_by_node() takes a reference to the underlying device structure, we should release that reference.
--- sound/soc/fsl/fsl-asoc-card.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/fsl/fsl-asoc-card.c +1 -0
@@ -689,6 +689,7 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) asrc_fail:of_node_put (asrc_np);of_node_put (codec_np); +put_device (&cpu_pdev->dev); fail:of_node_put (cpu_np);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 174/246 sched/debug: Initialize sd_sysctl_cpus if !CONFIG_CPUMASK_OFFSTACK
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 1ca4fa3ab604734e38e2a3000c9abf788512ffa7 ]
register_sched_domain_sysctl() copies the cpu_possible_mask into sd_sysctl_cpus, but only if sd_sysctl_cpus hasn't already been allocated (ie, CONFIG_CPUMASK_OFFSTACK is set). However, when CONFIG_CPUMASK_OFFSTACK is not set, sd_sysctl_cpus is left uninitialized (all zeroes) and the kernel may fail to initialize sched_domain sysctl entries for all possible CPUs.
This is visible to the user if the kernel is booted with maxcpus=n, or if ACPI tables have been modified to leave CPUs offline, and then checking for missing /proc/sys/kernel/sched_domain/cpu* entries.
Fix this by separating the allocation and initialization, and adding a flag to initialize the possible CPU entries while system booting only.
--- kernel/sched/debug.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/sched/debug.c +4 -0
@@ -315,6 +315,7 @@ void register_sched_domain_sysctl(void) {static struct ctl_table *cpu_entries;static struct ctl_table **cpu_idx; +static bool init_done = false;char buf[32 ];int i;
@@ -344,7 +345,10 @@ void register_sched_domain_sysctl(void)if (!cpumask_available (sd_sysctl_cpus)) {if (!alloc_cpumask_var (&sd_sysctl_cpus,GFP_KERNEL ))return ; + } +if (!init_done) { + init_done = true;/* init to possible to not have holes in @cpu_entries */ cpumask_copy (sd_sysctl_cpus, cpu_possible_mask); }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 175/246 efi/memattr: Dont bail on zero VA if it equals the regions PA
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 5de0fef0230f3c8d75cff450a71740a7bf2db866 ]
The EFI memory attributes code cross-references the EFI memory map with the more granular EFI memory attributes table to ensure that they are in sync before applying the strict permissions to the regions it describes.
Since we always install virtual mappings for the EFI runtime regions to which these strict permissions apply, we currently perform a sanity check on the EFI memory descriptor, and ensure that the EFI_MEMORY_RUNTIME bit is set, and that the virtual address has been assigned.
However, in cases where a runtime region exists at physical address 0x0, and the virtual mapping equals the physical mapping, e.g., when running in mixed mode on x86, we encounter a memory descriptor with the runtime attribute and virtual address 0x0, and incorrectly draw the conclusion that a runtime region exists for which no virtual mapping was installed, and give up altogether. The consequence of this is that firmware mappings retain their read-write-execute permissions, making the system more vulnerable to attacks.
So let's only bail if the virtual address of 0x0 has been assigned to a physical region that does not reside at address 0x0.
--- drivers/firmware/efi/memattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/efi/memattr.c +1 -1
@@ -94,7 +94,7 @@ static bool entry_is_valid(const efi_memory_desc_t *in, efi_memory_desc_t *out)if (!(md->attribute &EFI_MEMORY_RUNTIME ))continue ; -if (md->virt_addr ==0 ) { +if (md->virt_addr ==0 && md->phys_addr !=0 ) {/* no virtual mapping has been installed by the stub */ break ; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 176/246 sched/core: Use READ_ONCE()/WRITE_ONCE() in move_queued_task()/task_rq_lock()
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit c546951d9c9300065bad253ecdf1ac59ce9d06c8 ]
move_queued_task() synchronizes with task_rq_lock() as follows:
move_queued_task() task_rq_lock() [S] ->on_rq = MIGRATING [L] rq = task_rq() WMB (__set_task_cpu()) ACQUIRE (rq->lock); [S] ->cpu = new_cpu [L] ->on_rq
where "[L] rq = task_rq()" is ordered before "ACQUIRE (rq->lock)" by an address dependency and, in turn, "ACQUIRE (rq->lock)" is ordered before "[L] ->on_rq" by the ACQUIRE itself.
Use READ_ONCE() to load ->cpu in task_rq() (c.f., task_cpu()) to honor this address dependency. Also, mark the accesses to ->cpu and ->on_rq with READ_ONCE()/WRITE_ONCE() to comply with the LKMM.
--- include/linux/sched.h | 4 ++-- kernel/sched/core.c | 9 +++++---- kernel/sched/sched.h | 6 +++--- 3 files changed, 10 insertions(+), 9 deletions(-)
include/linux/sched.h +2 -2
@@ -1748,9 +1748,9 @@ static __always_inline bool need_resched(void)static inline unsigned int task_cpu (const struct task_struct *p) {#ifdef CONFIG_THREAD_INFO_IN_TASK -return p->cpu; +return READ_ONCE (p->cpu);#else -return task_thread_info (p)->cpu; +return READ_ONCE (task_thread_info (p)->cpu);#endif }
kernel/sched/core.c +5 -4
@@ -107,11 +107,12 @@ struct rq *task_rq_lock(struct task_struct *p, struct rq_flags *rf)* [L] ->on_rq * RELEASE (rq->lock) * -* If we observe the old CPU in task_rq_lock, the acquire of +* If we observe the old CPU in task_rq_lock(), the acquire of * the old rq->lock will fully serialize against the stores. * -* If we observe the new CPU in task_rq_lock, the acquire will -* pair with the WMB to ensure we must then also see migrating. +* If we observe the new CPU in task_rq_lock(), the address +* dependency headed by '[L] rq = task_rq()' and the acquire +* will pair with the WMB to ensure we then also see migrating. */ if (likely (rq ==task_rq (p) && !task_on_rq_migrating (p))) {rq_pin_lock (rq, rf);
@@ -928,7 +929,7 @@ static struct rq *move_queued_task(struct rq *rq, struct rq_flags *rf, {lockdep_assert_held (&rq->lock); - p->on_rq =TASK_ON_RQ_MIGRATING ; +WRITE_ONCE (p->on_rq,TASK_ON_RQ_MIGRATING );dequeue_task (rq, p,DEQUEUE_NOCLOCK );set_task_cpu (p, new_cpu);rq_unlock (rq, rf);
kernel/sched/sched.h +3 -3
@@ -1460,9 +1460,9 @@ static inline void __set_task_cpu(struct task_struct *p, unsigned int cpu)*/ smp_wmb ();#ifdef CONFIG_THREAD_INFO_IN_TASK - p->cpu = cpu; +WRITE_ONCE (p->cpu, cpu);#else -task_thread_info (p)->cpu = cpu; +WRITE_ONCE (task_thread_info (p)->cpu, cpu);#endif p->wake_cpu = cpu;#endif
@@ -1563,7 +1563,7 @@ static inline int task_on_rq_queued(struct task_struct *p)static inline int task_on_rq_migrating (struct task_struct *p) { -return p->on_rq ==TASK_ON_RQ_MIGRATING ; +return READ_ONCE (p->on_rq) ==TASK_ON_RQ_MIGRATING ; }/*
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 177/246 drm/vkms: Bugfix racing hrtimer vblank handle
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit ba420afab565bdc7b028ddd4f222260f2de7a1db ]
When the vblank irq happens, kernel time subsystem executes vkms_vblank_simulate. In parallel or not, it prepares all stuff necessary to the next vblank with arm, and it must flush these stuff before the next vblank irq. However, vblank counter is ahead when arm is executed in parallel with handle vblank.
CPU 0: CPU 1:
| | atomic_commit_tail is ongoing | | | | hrtimer: vkms_vblank_simulate() | | | drm_crtc_handle_vblank() | | drm_crtc_arm_vblank() | | | ->get_vblank_timestamp() | | | | hrtimer_forward_now()
Then, we should guarantee that the vblank interval time is correct (not changed) before finish the vblank handle.
Fix the bug including the call to hrtimer_forward_now() in the same lock of drm_crtc_handle_vblank() to ensure that the timestamp update is correct when finish the vblank handle.
--- drivers/gpu/drm/vkms/vkms_crtc.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-)
drivers/gpu/drm/vkms/vkms_crtc.c +6 -12
@@ -4,13 +4,17 @@#include <drm/drm_atomic_helper.h> #include <drm/drm_crtc_helper.h> -static void _vblank_handle (struct vkms_output *output) +static enum hrtimer_restart vkms_vblank_simulate (struct hrtimer *timer) { + struct vkms_output *output = container_of(timer, struct vkms_output, + vblank_hrtimer);struct drm_crtc *crtc = &output->crtc;struct vkms_crtc_state *state =to_vkms_crtc_state (crtc->state); +int ret_overrun;bool ret;spin_lock (&output->lock); + ret =drm_crtc_handle_vblank (crtc);if (!ret)DRM_ERROR ("vkms failure on handling vblank" );
@@ -31,19 +35,9 @@ static void _vblank_handle(struct vkms_output *output)DRM_WARN ("failed to queue vkms_crc_work_handle" ); } -spin_unlock (&output->lock); -} - -static enum hrtimer_restart vkms_vblank_simulate (struct hrtimer *timer) -{ - struct vkms_output *output = container_of(timer, struct vkms_output, - vblank_hrtimer); -int ret_overrun; - -_vblank_handle (output); - ret_overrun =hrtimer_forward_now (&output->vblank_hrtimer, output->period_ns); +spin_unlock (&output->lock);return HRTIMER_RESTART ; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 178/246 drm/vkms: Bugfix extra vblank frame
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit def35e7c592616bc09be328de8795e5e624a3cf8 ]
kms_flip tests are breaking on vkms when simulate vblank because vblank event sequence count returns one extra frame after arm vblank event to make a page flip.
When vblank interrupt happens, userspace processes the vblank event and issues the next page flip command. Kernel calls queue_work to call commit_planes and arm the new page flip. The next vblank picks up the newly armed vblank event and vblank interrupt happens again.
The arm and vblank event are asynchronous, then, on the next vblank, we receive x+2 from get_vblank_timestamp, instead x+1, although timestamp and vblank seqno matches.
Function get_vblank_timestamp is reached by 2 ways:
- from drm_mode_page_flip_ioctl: driver is doing one atomic operation to synchronize planes in the same output. There is no vblank simulation, the drm_crtc_arm_vblank_event function adds 1 on vblank count, and the variable in_vblank_irq is false
- from vkms_vblank_simulate: since the driver is doing a vblank simulation, the variable in_vblank_irq is true.
Fix this problem subtracting one vblank period from vblank_time when get_vblank_timestamp is called from trace drm_mode_page_flip_ioctl, i.e., is not a real vblank interrupt, and getting the timestamp and vblank seqno when it is a real vblank interrupt.
The reason for all this is that get_vblank_timestamp always supplies the timestamp for the next vblank event. The hrtimer is the vblank simulator, and it needs the correct previous value to present the next vblank. Since this is how hw timestamp registers work and what the vblank core expects.
--- drivers/gpu/drm/vkms/vkms_crtc.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/vkms/vkms_crtc.c +3 -0
@@ -75,6 +75,9 @@ bool vkms_get_vblank_timestamp(struct drm_device *dev, unsigned int pipe, *vblank_time = output->vblank_hrtimer.node.expires; +if (!in_vblank_irq) + *vblank_time -= output->period_ns; +return true; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 179/246 ARM: dts: lpc32xx: Remove leading 0x and 0s from bindings notation
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 3e3380d0675d5e20b0af067d60cb947a4348bf9b ]
Improve the DTS files by removing all the leading "0x" and zeros to fix the following dtc warnings:
Warning (unit_address_format): Node /XXX unit name should not have leading "0x"
and
Warning (unit_address_format): Node /XXX unit name should not have leading 0s
Converted using the following command:
find . -type f \( -iname *.dts -o -iname *.dtsi \) -exec sed -i -e "s/@\([0-9a-fA-FxX\.;:#]+\)\s*{/@\L\1 {/g" -e "s/@0x\(.*\) {/@\1 {/g" -e "s/@0+\(.*\) {/@\1 {/g" {} +
For simplicity, two sed expressions were used to solve each warnings separately.
To make the regex expression more robust a few other issues were resolved, namely setting unit-address to lower case, and adding a whitespace before the opening curly brace:
https://elinux.org/Device_Tree_Linux#Linux_conventions
This will solve as a side effect warning:
Warning (simple_bus_reg): Node /XXX@<UPPER> simple-bus unit address format error, expected "<lower>"
This is a follow up to commit 4c9847b7375a ("dt-bindings: Remove leading 0x from bindings notation")
--- arch/arm/boot/dts/lpc32xx.dtsi | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
arch/arm/boot/dts/lpc32xx.dtsi +9 -9
@@ -230,7 +230,7 @@ status = "disabled"; }; - i2s1: i2s@2009C000 { + i2s1: i2s@2009c000 { compatible = "nxp,lpc3220-i2s"; reg = <0x2009C000 0x1000>; };
@@ -273,7 +273,7 @@ status = "disabled"; }; - i2c1: i2c@400A0000 { + i2c1: i2c@400a0000 { compatible = "nxp,pnx-i2c"; reg = <0x400A0000 0x100>; interrupt-parent = <&sic1>;
@@ -284,7 +284,7 @@ clocks = <&clk LPC32XX_CLK_I2C1>; }; - i2c2: i2c@400A8000 { + i2c2: i2c@400a8000 { compatible = "nxp,pnx-i2c"; reg = <0x400A8000 0x100>; interrupt-parent = <&sic1>;
@@ -295,7 +295,7 @@ clocks = <&clk LPC32XX_CLK_I2C2>; }; - mpwm: mpwm@400E8000 { + mpwm: mpwm@400e8000 { compatible = "nxp,lpc3220-motor-pwm"; reg = <0x400E8000 0x78>; status = "disabled";
@@ -394,7 +394,7 @@ #gpio-cells = <3>; /* bank, pin, flags */ }; - timer4: timer@4002C000 { + timer4: timer@4002c000 { compatible = "nxp,lpc3220-timer"; reg = <0x4002C000 0x1000>; interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
@@ -412,7 +412,7 @@ status = "disabled"; }; - watchdog: watchdog@4003C000 { + watchdog: watchdog@4003c000 { compatible = "nxp,pnx4008-wdt"; reg = <0x4003C000 0x1000>; clocks = <&clk LPC32XX_CLK_WDOG>;
@@ -451,7 +451,7 @@ status = "disabled"; }; - timer1: timer@4004C000 { + timer1: timer@4004c000 { compatible = "nxp,lpc3220-timer"; reg = <0x4004C000 0x1000>; interrupts = <17 IRQ_TYPE_LEVEL_LOW>;
@@ -475,7 +475,7 @@ status = "disabled"; }; - pwm1: pwm@4005C000 { + pwm1: pwm@4005c000 { compatible = "nxp,lpc3220-pwm"; reg = <0x4005C000 0x4>; clocks = <&clk LPC32XX_CLK_PWM1>;
@@ -484,7 +484,7 @@ status = "disabled"; }; - pwm2: pwm@4005C004 { + pwm2: pwm@4005c004 { compatible = "nxp,lpc3220-pwm"; reg = <0x4005C004 0x4>; clocks = <&clk LPC32XX_CLK_PWM2>;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 180/246 efi/arm/arm64: Allow SetVirtualAddressMap() to be omitted
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 4e46c2a956215482418d7b315749fb1b6c6bc224 ]
The UEFI spec revision 2.7 errata A section 8.4 has the following to say about the virtual memory runtime services:
"This section contains function definitions for the virtual memory support that may be optionally used by an operating system at runtime. If an operating system chooses to make EFI runtime service calls in a virtual addressing mode instead of the flat physical mode, then the operating system must use the services in this section to switch the EFI runtime services from flat physical addressing to virtual addressing."
So it is pretty clear that calling SetVirtualAddressMap() is entirely optional, and so there is no point in doing so unless it achieves anything useful for us.
This is not the case for 64-bit ARM. The identity mapping used by the firmware is arbitrarily converted into another permutation of userland addresses (i.e., bits [63:48] cleared), and the runtime code could easily deal with the original layout in exactly the same way as it deals with the converted layout. However, due to constraints related to page size differences if the OS is not running with 4k pages, and related to systems that may expose the individual sections of PE/COFF runtime modules as different memory regions, creating the virtual layout is a bit fiddly, and requires us to sort the memory map and reason about adjacent regions with identical memory types etc etc.
So the obvious fix is to stop calling SetVirtualAddressMap() altogether on arm64 systems. However, to avoid surprises, which are notoriously hard to diagnose when it comes to OS<->firmware interactions, let's start by making it an opt-out feature, and implement support for the 'efi=novamap' kernel command line parameter on ARM and arm64 systems.
( Note that 32-bit ARM generally does require SetVirtualAddressMap() to be
used, given that the physical memory map and the kernel virtual address map are not guaranteed to be non-overlapping like on arm64. However, having support for efi=novamap,noruntime on 32-bit ARM, combined with the recently proposed support for earlycon=efifb, is likely to be useful to diagnose boot issues on such systems if they have no accessible serial port. )
--- drivers/firmware/efi/libstub/arm-stub.c | 5 +++++ drivers/firmware/efi/libstub/efi-stub-helper.c | 10 ++++++++++ drivers/firmware/efi/libstub/efistub.h | 1 + drivers/firmware/efi/libstub/fdt.c | 3 +++ 4 files changed, 19 insertions(+)
drivers/firmware/efi/libstub/arm-stub.c +5 -0
@@ -367,6 +367,11 @@ void efi_get_virtmap(efi_memory_desc_t *memory_map, unsigned long map_size, paddr = in->phys_addr; size = in->num_pages *EFI_PAGE_SIZE ; +if (novamap ()) { + in->virt_addr = in->phys_addr; +continue ; + } +/* * Make the mapping compatible with 64k pages: this allows * a 4k page size kernel to kexec a 64k page size kernel and
drivers/firmware/efi/libstub/efi-stub-helper.c +10 -0
@@ -34,6 +34,7 @@ static unsigned long __chunk_size = EFI_READ_CHUNK_SIZE; static int __section(.data) __nokaslr; static int __section(.data) __quiet; +static int __section(.data) __novamap; int __pure nokaslr(void) {
@@ -43,6 +44,10 @@ int __pure is_quiet(void) {return __quiet; } +int __pure novamap (void ) +{ +return __novamap; +}#define EFI_MMAP_NR_SLACK_SLOTS 8
@@ -482,6 +487,11 @@ efi_status_t efi_parse_options(char const *cmdline) __chunk_size =-1UL ; } +if (!strncmp (str,"novamap" ,7 )) { + str +=strlen ("novamap" ); + __novamap =1 ; + } +/* Group words together, delimited by "," */ while (*str && *str !=' ' && *str !=',' ) str++;
drivers/firmware/efi/libstub/efistub.h +1 -0
@@ -27,6 +27,7 @@extern int __pure nokaslr (void );extern int __pure is_quiet (void ); +extern int __pure novamap (void );#define pr_efi (sys_table, msg) do { \ if (!is_quiet()) efi_printk(sys_table, "EFI stub: "msg); \
drivers/firmware/efi/libstub/fdt.c +3 -0
@@ -327,6 +327,9 @@ efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table,if (status ==EFI_SUCCESS ) {efi_set_virtual_address_map_t *svam; +if (novamap ()) +return EFI_SUCCESS ; +/* Install the new virtual address map */ svam = sys_table->runtime->set_virtual_address_map; status = svam(runtime_entry_count * desc_size, desc_size,
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 181/246 soc: qcom: gsbi: Fix error handling in gsbi_probe()
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 8cd09a3dd3e176c62da67efcd477a44a8d87185e ]
If of_platform_populate() fails in gsbi_probe(), gsbi->hclk is left undisabled.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/soc/qcom/qcom_gsbi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/soc/qcom/qcom_gsbi.c +5 -2
@@ -138,7 +138,7 @@ static int gsbi_probe(struct platform_device *pdev)struct resource *res;void __iomem *base;struct gsbi_info *gsbi; -int i; +int i, ret;u32 mask, gsbi_num;const struct crci_config *config =NULL ;
@@ -221,7 +221,10 @@ static int gsbi_probe(struct platform_device *pdev)platform_set_drvdata (pdev, gsbi); -return of_platform_populate (node,NULL ,NULL , &pdev->dev); + ret =of_platform_populate (node,NULL ,NULL , &pdev->dev); +if (ret) +clk_disable_unprepare (gsbi->hclk); +return ret; }static int gsbi_remove (struct platform_device *pdev)
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 182/246 drm/msm/dpu: Convert to a chained irq chip
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 070e64dc1bbc879b7e0e9fffccd9dd139baf89f0 ]
Devices that make up DPU, i.e. graphics card, request their interrupts from this "virtual" interrupt chip. The interrupt chip builds upon a GIC SPI interrupt that raises high when any of the interrupts in the DPU's irq status register are triggered. From the kernel's perspective this is a chained irq chip, so requesting a flow handler for the GIC SPI and then calling generic IRQ handling code from that irq handler is not completely proper. It's better to convert this to a chained irq so that the GIC SPI irq doesn't appear in /proc/interrupts, can't have CPU affinity changed, and won't be accounted for with irq stats. Doing this also silences a recursive lockdep warning because we can specify a different lock class for the chained interrupts, silencing a warning that is easy to see with 'threadirqs' on the kernel commandline.
WARNING: inconsistent lock state
4.19.10 #76 Tainted: G W
--------------------------------
inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage. irq/40-dpu_mdss/203 [HC0[0]:SC0[2]:HE1:SE0] takes:
0000000053ea9021 (&irq_desc_lock_class){?.-.}, at: handle_level_irq+0x34/0x26c {IN-HARDIRQ-W} state was registered at:
lock_acquire+0x244/0x360 _raw_spin_lock+0x64/0xa0 handle_fasteoi_irq+0x54/0x2ec generic_handle_irq+0x44/0x5c __handle_domain_irq+0x9c/0x11c gic_handle_irq+0x208/0x260 el1_irq+0xb4/0x130 arch_cpu_idle+0x178/0x3cc default_idle_call+0x3c/0x54 do_idle+0x1a8/0x3dc cpu_startup_entry+0x24/0x28 rest_init+0x240/0x270 start_kernel+0x5a8/0x6bc irq event stamp: 18 hardirqs last enabled at (17): [<ffffff9042385e80>] _raw_spin_unlock_irq+0x40/0xc0 hardirqs last disabled at (16): [<ffffff904237a1f4>] __schedule+0x20c/0x1bbc softirqs last enabled at (0): [<ffffff9040f318d0>] copy_process+0xb50/0x3964 softirqs last disabled at (18): [<ffffff9041036364>] local_bh_disable+0x8/0x20
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
----
lock(&irq_desc_lock_class);
<Interrupt>
lock(&irq_desc_lock_class);*** DEADLOCK ***
no locks held by irq/40-dpu_mdss/203.
stack backtrace: CPU: 0 PID: 203 Comm: irq/40-dpu_mdss Tainted: G W 4.19.10 #76 Call trace: dump_backtrace+0x0/0x2f8 show_stack+0x20/0x2c __dump_stack+0x20/0x28 dump_stack+0xcc/0x10c mark_lock+0xbe0/0xe24 __lock_acquire+0x4cc/0x2708 lock_acquire+0x244/0x360 _raw_spin_lock+0x64/0xa0 handle_level_irq+0x34/0x26c generic_handle_irq+0x44/0x5c dpu_mdss_irq+0x64/0xec irq_forced_thread_fn+0x58/0x9c irq_thread+0x120/0x1dc kthread+0x248/0x260 ret_from_fork+0x10/0x18 ------------[ cut here ]------------ irq 169 handler irq_default_primary_handler+0x0/0x18 enabled interrupts
--- drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c | 36 ++++++++++++++---------- 1 file changed, 21 insertions(+), 15 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c +21 -15
@@ -23,11 +23,14 @@ struct dpu_mdss {struct dpu_irq_controller irq_controller; }; -static irqreturn_t dpu_mdss_irq (int irq,void *arg) +static void dpu_mdss_irq (struct irq_desc *desc) { -struct dpu_mdss *dpu_mdss = arg; +struct dpu_mdss *dpu_mdss =irq_desc_get_handler_data (desc); +struct irq_chip *chip =irq_desc_get_chip (desc);u32 interrupts; +chained_irq_enter (chip, desc); + interrupts =readl_relaxed (dpu_mdss->mmio +HW_INTR_STATUS );while (interrupts) {
@@ -39,20 +42,20 @@ static irqreturn_t dpu_mdss_irq(int irq, void *arg) hwirq);if (mapping ==0 ) {DRM_ERROR ("couldn't find irq mapping for %lu\n" , hwirq); -return IRQ_NONE ; +break ; } rc =generic_handle_irq (mapping);if (rc <0 ) {DRM_ERROR ("handle irq fail: irq=%lu mapping=%u rc=%d\n" , hwirq, mapping, rc); -return IRQ_NONE ; +break ; } interrupts &= ~(1 << hwirq); } -return IRQ_HANDLED ; +chained_irq_exit (chip, desc); }static void dpu_mdss_irq_mask (struct irq_data *irqd)
@@ -83,16 +86,16 @@ static struct irq_chip dpu_mdss_irq_chip = { .irq_unmask = dpu_mdss_irq_unmask, }; +static struct lock_class_key dpu_mdss_lock_key, dpu_mdss_request_key; +static int dpu_mdss_irqdomain_map (struct irq_domain *domain,unsigned int irq,irq_hw_number_t hwirq) {struct dpu_mdss *dpu_mdss = domain->host_data; -int ret; +irq_set_lockdep_class (irq, &dpu_mdss_lock_key, &dpu_mdss_request_key);irq_set_chip_and_handler (irq, &dpu_mdss_irq_chip, handle_level_irq); - ret =irq_set_chip_data (irq, dpu_mdss); - -return ret; +return irq_set_chip_data (irq, dpu_mdss); }static const struct irq_domain_ops dpu_mdss_irqdomain_ops = {
@@ -159,11 +162,13 @@ static void dpu_mdss_destroy(struct drm_device *dev)struct msm_drm_private *priv = dev->dev_private;struct dpu_mdss *dpu_mdss =to_dpu_mdss (priv->mdss);struct dss_module_power *mp = &dpu_mdss->mp; +int irq;pm_runtime_suspend (dev->dev);pm_runtime_disable (dev->dev);_dpu_mdss_irq_domain_fini (dpu_mdss); -free_irq (platform_get_irq (pdev,0 ), dpu_mdss); + irq =platform_get_irq (pdev,0 ); +irq_set_chained_handler_and_data (irq,NULL ,NULL );msm_dss_put_clk (mp->clk_config, mp->num_clk);devm_kfree (&pdev->dev, mp->clk_config);
@@ -187,6 +192,7 @@ int dpu_mdss_init(struct drm_device *dev)struct dpu_mdss *dpu_mdss;struct dss_module_power *mp;int ret =0 ; +int irq; dpu_mdss =devm_kzalloc (dev->dev,sizeof (*dpu_mdss),GFP_KERNEL );if (!dpu_mdss)
@@ -219,12 +225,12 @@ int dpu_mdss_init(struct drm_device *dev)if (ret) goto irq_domain_error; - ret =request_irq (platform_get_irq (pdev,0 ), - dpu_mdss_irq,0 ,"dpu_mdss_isr" , dpu_mdss); -if (ret) { -DPU_ERROR ("failed to init irq: %d\n" , ret); + irq =platform_get_irq (pdev,0 ); +if (irq <0 ) goto irq_error; - } + +irq_set_chained_handler_and_data (irq, dpu_mdss_irq, + dpu_mdss);pm_runtime_enable (dev->dev);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 183/246 mt7601u: bump supported EEPROM version
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 3bd1505fed71d834f45e87b32ff07157fdda47e0 ]
As reported by Michael eeprom 0d is supported and work with the driver.
Dump of /sys/kernel/debug/ieee80211/phy1/mt7601u/eeprom_param with 0d EEPORM looks like this:
RSSI offset: 0 0
Reference temp: f9
LNA gain: 8
Reg channels: 1-14
Per rate power:
raw:05 bw20:05 bw40:05 raw:05 bw20:05 bw40:05 raw:03 bw20:03 bw40:03 raw:03 bw20:03 bw40:03 raw:04 bw20:04 bw40:04 raw:00 bw20:00 bw40:00 raw:00 bw20:00 bw40:00 raw:00 bw20:00 bw40:00 raw:02 bw20:02 bw40:02 raw:00 bw20:00 bw40:00 Per channel power: tx_power ch1:09 ch2:09 tx_power ch3:0a ch4:0a tx_power ch5:0a ch6:0a tx_power ch7:0b ch8:0b tx_power ch9:0b ch10:0b tx_power ch11:0b ch12:0b tx_power ch13:0b ch14:0b
--- drivers/net/wireless/mediatek/mt7601u/eeprom.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt7601u/eeprom.h +1 -1
@@ -17,7 +17,7 @@struct mt7601u_dev ; -#define MT7601U_EE_MAX_VER 0x0c +#define MT7601U_EE_MAX_VER 0x0d#define MT7601U_EEPROM_SIZE 256#define MT7601U_DEFAULT_TX_POWER 6
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 184/246 ARM: 8830/1: NOMMU: Toggle only bits in EXC_RETURN we are really care of
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 72cd4064fccaae15ab84d40d4be23667402df4ed ]
ARMv8M introduces support for Security extension to M class, among other things it affects exception handling, especially, encoding of EXC_RETURN.
The new bits have been added:
Bit [6] Secure or Non-secure stack
Bit [5] Default callee register stacking
Bit [0] Exception Secure
which conflicts with hard-coded value of EXC_RETURN:
In fact, we only care of few bits:
Bit [3] Mode (0 - Handler, 1 - Thread)
Bit [2] Stack pointer selection (0 - Main, 1 - Process)
We can toggle only those bits and left other bits as they were on exception entry.
It is basically, what patch does - saves EXC_RETURN when we do transition form Thread to Handler mode (it is first svc), so later saved value is used instead of EXC_RET_THREADMODE_PROCESSSTACK.
--- arch/arm/include/asm/v7m.h | 2 +- arch/arm/kernel/entry-header.S | 3 ++- arch/arm/kernel/entry-v7m.S | 4 ++++ arch/arm/mm/proc-v7m.S | 3 +++ 4 files changed, 10 insertions(+), 2 deletions(-)
arch/arm/include/asm/v7m.h +1 -1
@@ -49,7 +49,7 @@* (0 -> msp; 1 -> psp). Bits [1:0] are fixed to 0b01. */ #define EXC_RET_STACK_MASK 0x00000004 -#define EXC_RET_THREADMODE_PROCESSSTACK 0xfffffffd +#define EXC_RET_THREADMODE_PROCESSSTACK (3 << 2)/* Cache related definitions */
arch/arm/kernel/entry-header.S +2 -1
@@ -127,7 +127,8 @@ */ .macro v7m_exception_slow_exit ret_r0 cpsid i - ldr lr, =EXC_RET_THREADMODE_PROCESSSTACK + ldr lr, =exc_ret + ldr lr, [lr] @ read original r12, sp, lr, pc and xPSR add r12, sp, #S_IP
arch/arm/kernel/entry-v7m.S +4 -0
@@ -146,3 +146,7 @@ ENTRY(vector_table) .rept CONFIG_CPU_V7M_NUM_IRQ .long __irq_entry @ External Interrupts .endr + .align 2 + .globl exc_ret +exc_ret: + .space 4
arch/arm/mm/proc-v7m.S +3 -0
@@ -139,6 +139,9 @@ __v7m_setup_cont: cpsie i svc #0 1: cpsid i + ldr r0, =exc_ret + orr lr, lr, #EXC_RET_THREADMODE_PROCESSSTACK + str lr, [r0] ldmia sp, {r0-r3, r12} str r5, [r12, #11 * 4] @ restore the original SVC vector entry mov lr, r6 @ restore LR
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 185/246 ARM: avoid Cortex-A9 livelock on tight dmb loops
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 5388a5b82199facacd3d7ac0d05aca6e8f902fed ]
machine_crash_nonpanic_core() does this:
while (1) cpu_relax();
because the kernel has crashed, and we have no known safe way to deal with the CPU. So, we place the CPU into an infinite loop which we expect it to never exit - at least not until the system as a whole is reset by some method.
In the absence of erratum 754327, this code assembles to:
b .
In other words, an infinite loop. When erratum 754327 is enabled, this becomes:
1: dmb
b 1b
It has been observed that on some systems (eg, OMAP4) where, if a crash is triggered, the system tries to kexec into the panic kernel, but fails after taking the secondary CPU down - placing it into one of these loops. This causes the system to livelock, and the most noticable effect is the system stops after issuing:
Loading crashdump kernel...
to the system console.
The tested as working solution I came up with was to add wfe() to these infinite loops thusly:
while (1) {
cpu_relax();
wfe();
}which, without 754327 builds to:
1: wfe
b 1b
or with 754327 is enabled:
1: dmb
wfe b 1b
Adding "wfe" does two things depending on the environment we're running under:
- where we're running on bare metal, and the processor implements "wfe", it stops us spinning endlessly in a loop where we're never going to do any useful work.
- if we're running in a VM, it allows the CPU to be given back to the hypervisor and rescheduled for other purposes (maybe a different VM) rather than wasting CPU cycles inside a crashed VM.
However, in light of erratum 794072, Will Deacon wanted to see 10 nops as well - which is reasonable to cover the case where we have erratum 754327 enabled _and_ we have a processor that doesn't implement the wfe hint.
So, we now end up with:
1: wfe
b 1b
when erratum 754327 is disabled, or:
1: dmb
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
wfe
b 1b
when erratum 754327 is enabled. We also get the dmb + 10 nop sequence elsewhere in the kernel, in terminating loops.
This is reasonable - it means we get the workaround for erratum 794072 when erratum 754327 is enabled, but still relinquish the dead processor - either by placing it in a lower power mode when wfe is implemented as such or by returning it to the hypervisior, or in the case where wfe is a no-op, we use the workaround specified in erratum 794072 to avoid the problem.
These as two entirely orthogonal problems - the 10 nops addresses erratum 794072, and the wfe is an optimisation that makes the system more efficient when crashed either in terms of power consumption or by allowing the host/other VMs to make use of the CPU.
I don't see any reason not to use kexec() inside a VM - it has the potential to provide automated recovery from a failure of the VMs kernel with the opportunity for saving a crashdump of the failure. A panic() with a reboot timeout won't do that, and reading the libvirt documentation, setting on_reboot to "preserve" won't either (the documentation states "The preserve action for an on_reboot event is treated as a destroy".) Surely it has to be a good thing to avoiding having CPUs spinning inside a VM that is doing no useful work.
--- arch/arm/include/asm/barrier.h | 2 ++ arch/arm/include/asm/processor.h | 6 +++++- arch/arm/kernel/machine_kexec.c | 5 ++++- arch/arm/kernel/smp.c | 4 +++- arch/arm/mach-omap2/prm_common.c | 4 +++- 5 files changed, 17 insertions(+), 4 deletions(-)
arch/arm/include/asm/barrier.h +2 -0
@@ -11,6 +11,8 @@#define sev () __asm__ __volatile__ ("sev" : : : "memory")#define wfe () __asm__ __volatile__ ("wfe" : : : "memory")#define wfi () __asm__ __volatile__ ("wfi" : : : "memory") +#else +#define wfe () do { } while (0)#endif #if __LINUX_ARM_ARCH__ >=7
arch/arm/include/asm/processor.h +5 -1
@@ -89,7 +89,11 @@ extern void release_thread(struct task_struct *);unsigned long get_wchan (struct task_struct *p);#if __LINUX_ARM_ARCH__ ==6 || defined(CONFIG_ARM_ERRATA_754327 ) -#define cpu_relax () smp_mb() +#define cpu_relax () \ + do { \ + smp_mb(); \ + __asm__ __volatile__("nop; nop; nop; nop; nop; nop; nop; nop; nop; nop;"); \ + } while (0)#else #define cpu_relax () barrier()#endif
arch/arm/kernel/machine_kexec.c +4 -1
@@ -91,8 +91,11 @@ void machine_crash_nonpanic_core(void *unused)set_cpu_online (smp_processor_id (), false);atomic_dec (&waiting_for_crash_ipi); -while (1 ) + +while (1 ) {cpu_relax (); +wfe (); + } }void crash_smp_send_stop (void )
arch/arm/kernel/smp.c +3 -1
@@ -604,8 +604,10 @@ static void ipi_cpu_stop(unsigned int cpu)local_fiq_disable ();local_irq_disable (); -while (1 ) +while (1 ) {cpu_relax (); +wfe (); + } } static DEFINE_PER_CPU(struct completion *, cpu_completion);
arch/arm/mach-omap2/prm_common.c +3 -1
@@ -523,8 +523,10 @@ void omap_prm_reset_system(void) prm_ll_data->reset_system (); -while (1 ) +while (1 ) {cpu_relax (); +wfe (); + } }/**
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 186/246 block, bfq: fix in-service-queue check for queue merging
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 058fdecc6de7cdecbf4c59b851e80eb2d6c5295f ]
When a new I/O request arrives for a bfq_queue, say Q, bfq checks whether that request is close to
(a) the head request of some other queue waiting to be served, or
(b) the last request dispatched for the in-service queue (in case Q itself is not the in-service queue)
If a queue, say Q2, is found for which the above condition holds, then bfq merges Q and Q2, to hopefully get a more sequential I/O in the resulting merged queue, and thus a possibly higher throughput.
Case (b) is checked by comparing the new request for Q with the last request dispatched, assuming that the latter necessarily belonged to the in-service queue. Unfortunately, this assumption is no longer always correct, since commit d0edc2473be9 ("block, bfq: inject other-queue I/O into seeky idle queues on NCQ flash").
When the assumption does not hold, queues that must not be merged may be merged, causing unexpected loss of control on per-queue service guarantees.
This commit solves this problem by adding an extra field, which stores the actual last request dispatched for the in-service queue, and by using this new field to correctly check case (b).
--- block/bfq-iosched.c | 5 ++++- block/bfq-iosched.h | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-)
block/bfq-iosched.c +4 -1
@@ -2224,7 +2224,8 @@ bfq_setup_cooperator(struct bfq_data *bfqd, struct bfq_queue *bfqq,if (in_service_bfqq && in_service_bfqq != bfqq &&likely (in_service_bfqq != &bfqd->oom_bfqq) && -bfq_rq_close_to_sector (io_struct, request, bfqd->last_position) && +bfq_rq_close_to_sector (io_struct, request, + bfqd->in_serv_last_pos) && bfqq->entity.parent == in_service_bfqq->entity.parent &&bfq_may_be_close_cooperator (bfqq, in_service_bfqq)) { new_bfqq =bfq_setup_merge (bfqq, in_service_bfqq);
@@ -2764,6 +2765,8 @@ update_rate_and_reset:bfq_update_rate_reset (bfqd, rq); update_last_values: bfqd->last_position =blk_rq_pos (rq) +blk_rq_sectors (rq); +if (RQ_BFQQ (rq) == bfqd->in_service_queue) + bfqd->in_serv_last_pos = bfqd->last_position; bfqd->last_dispatch = now_ns; }
block/bfq-iosched.h +3 -0
@@ -537,6 +537,9 @@ struct bfq_data {/* on-disk position of the last served request */ sector_t last_position; +/* position of the last served request for the in-service queue */ +sector_t in_serv_last_pos; +/* time of last request completion (ns) */ u64 last_completion;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 187/246 block, bfq: fix queue removal from weights tree
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 9dee8b3b057e1da26f85f1842f2aaf3bb200fb94 ]
bfq maintains an ordered list, through a red-black tree, of unique weights of active bfq_queues. This list is used to detect whether there are active queues with differentiated weights. The weight of a queue is removed from the list when both the following two conditions become true:
(1) the bfq_queue is flagged as inactive
(2) the has no in-flight request any longer;
Unfortunately, in the rare cases where condition (2) becomes true before condition (1), the removal fails, because the function to remove the weight of the queue (bfq_weights_tree_remove) is rightly invoked in the path that deactivates the bfq_queue, but mistakenly invoked *before* the function that actually performs the deactivation (bfq_deactivate_bfqq).
This commits moves the invocation of bfq_weights_tree_remove for condition (1) to after bfq_deactivate_bfqq. As a consequence of this move, it is necessary to add a further reference to the queue when the weight of a queue is added, because the queue might otherwise be freed before bfq_weights_tree_remove is invoked. This commit adds this reference and makes all related modifications.
--- block/bfq-iosched.c | 17 +++++++++++++---- block/bfq-wf2q.c | 6 +++--- 2 files changed, 16 insertions(+), 7 deletions(-)
block/bfq-iosched.c +13 -4
@@ -747,6 +747,7 @@ void bfq_weights_tree_add(struct bfq_data *bfqd, struct bfq_queue *bfqq, inc_counter: bfqq->weight_counter->num_active++; + bfqq->ref++; }/*
@@ -771,6 +772,7 @@ void __bfq_weights_tree_remove(struct bfq_data *bfqd, reset_entity_pointer: bfqq->weight_counter =NULL ; +bfq_put_queue (bfqq); }/*
@@ -782,9 +784,6 @@ void bfq_weights_tree_remove(struct bfq_data *bfqd, {struct bfq_entity *entity = bfqq->entity.parent; -__bfq_weights_tree_remove (bfqd, bfqq, - &bfqd->queue_weights_tree); -for_each_entity (entity) {struct bfq_sched_data *sd = entity->my_sched_data;
@@ -818,6 +817,15 @@ void bfq_weights_tree_remove(struct bfq_data *bfqd, bfqd->num_groups_with_pending_reqs--; } } + +/* +* Next function is invoked last, because it causes bfqq to be +* freed if the following holds: bfqq is not in service and +* has no dispatched request. DO NOT use bfqq after the next +* function invocation. +*/ +__bfq_weights_tree_remove (bfqd, bfqq, + &bfqd->queue_weights_tree); }/*
@@ -1011,7 +1019,8 @@ bfq_bfqq_resume_state(struct bfq_queue *bfqq, struct bfq_data *bfqd,static int bfqq_process_refs (struct bfq_queue *bfqq) { -return bfqq->ref - bfqq->allocated - bfqq->entity.on_st; +return bfqq->ref - bfqq->allocated - bfqq->entity.on_st - + (bfqq->weight_counter !=NULL ); }/* Empty burst list and add just bfqq (see comments on bfq_handle_burst) */
block/bfq-wf2q.c +3 -3
@@ -1667,15 +1667,15 @@ void bfq_del_bfqq_busy(struct bfq_data *bfqd, struct bfq_queue *bfqq, bfqd->busy_queues--; -if (!bfqq->dispatched) -bfq_weights_tree_remove (bfqd, bfqq); -if (bfqq->wr_coeff >1 ) bfqd->wr_busy_queues--;bfqg_stats_update_dequeue (bfqq_group (bfqq));bfq_deactivate_bfqq (bfqd, bfqq, true, expiration); + +if (!bfqq->dispatched) +bfq_weights_tree_remove (bfqd, bfqq); }/*
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 188/246 bpf: fix missing prototype warnings
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 116bfa96a255123ed209da6544f74a4f2eaca5da ]
Compiling with W=1 generates warnings:
CC kernel/bpf/core.okernel/bpf/core.c:721:12: warning: no previous prototype for ?bpf_jit_alloc_exec_limit? [-Wmissing-prototypes]
721 | u64 __weak bpf_jit_alloc_exec_limit(void)
| ^~~~~~~~~~~~~~~~~~~~~~~~
kernel/bpf/core.c:757:14: warning: no previous prototype for ?bpf_jit_alloc_exec? [-Wmissing-prototypes]
757 | void *__weak bpf_jit_alloc_exec(unsigned long size)
| ^~~~~~~~~~~~~~~~~~
kernel/bpf/core.c:762:13: warning: no previous prototype for ?bpf_jit_free_exec? [-Wmissing-prototypes]
762 | void __weak bpf_jit_free_exec(void *addr)
| ^~~~~~~~~~~~~~~~~All three are weak functions that archs can override, provide proper prototypes for when a new arch provides their own.
--- include/linux/filter.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
include/linux/filter.h +3 -1
@@ -874,7 +874,9 @@ bpf_jit_binary_alloc(unsigned int proglen, u8 **image_ptr,unsigned int alignment, bpf_jit_fill_hole_t bpf_fill_ill_insns);void bpf_jit_binary_free (struct bpf_binary_header *hdr); - +u64 bpf_jit_alloc_exec_limit (void ); +void *bpf_jit_alloc_exec (unsigned long size); +void bpf_jit_free_exec (void *addr);void bpf_jit_free (struct bpf_prog *fp); int bpf_jit_get_func_addr(const struct bpf_prog *prog,
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 189/246 selftests/bpf: skip verifier tests for unsupported program types
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 8184d44c9a577a2f1842ed6cc844bfd4a9981d8e ]
Use recently introduced bpf_probe_prog_type() to skip tests in the test_verifier() if bpf_verify_program() fails. The skipped test is indicated in the output.
Example:
...
679/p bpf_get_stack return R0 within range SKIP (unsupported program type 5)
680/p ld_abs: invalid op 1 OK
...
Summary: 863 PASSED, 165 SKIPPED, 3 FAILED
--- tools/testing/selftests/bpf/test_verifier.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
tools/testing/selftests/bpf/test_verifier.c +8 -1
@@ -34,6 +34,7 @@#include <linux/if_ether.h> #include <bpf/bpf.h> +#include <bpf/libbpf.h> #ifdef HAVE_GENHDR # include "autoconf.h"
@@ -59,6 +60,7 @@#define UNPRIV_SYSCTL "kernel/unprivileged_bpf_disabled"static bool unpriv_disabled = false; +static int skips;struct bpf_test {const char *descr;
@@ -15946,6 +15948,11 @@ static void do_test_single(struct bpf_test *test, bool unpriv, pflags |=BPF_F_ANY_ALIGNMENT ; fd_prog =bpf_verify_program (prog_type, prog, prog_len, pflags,"GPL" ,0 , bpf_vlog,sizeof (bpf_vlog),1 ); +if (fd_prog <0 && !bpf_probe_prog_type (prog_type,0 )) { +printf ("SKIP (unsupported program type %d)\n" , prog_type); + skips++; + goto close_fds; + } expected_ret = unpriv && test->result_unpriv !=UNDEF ? test->result_unpriv : test->result;
@@ -16099,7 +16106,7 @@ static bool test_as_unpriv(struct bpf_test *test)static int do_test (bool unpriv,unsigned int from,unsigned int to) { -int i, passes =0 , errors =0 , skips =0 ; +int i, passes =0 , errors =0 ;for (i = from; i < to; i++) {struct bpf_test *test = &tests[i];
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 190/246 powerpc/64s: Clear on-stack exception marker upon exception return
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit eddd0b332304d554ad6243942f87c2fcea98c56b ]
The ppc64 specific implementation of the reliable stacktracer, save_stack_trace_tsk_reliable(), bails out and reports an "unreliable trace" whenever it finds an exception frame on the stack. Stack frames are classified as exception frames if the STACK_FRAME_REGS_MARKER magic, as written by exception prologues, is found at a particular location.
However, as observed by Joe Lawrence, it is possible in practice that non-exception stack frames can alias with prior exception frames and thus, that the reliable stacktracer can find a stale STACK_FRAME_REGS_MARKER on the stack. It in turn falsely reports an unreliable stacktrace and blocks any live patching transition to finish. Said condition lasts until the stack frame is overwritten/initialized by function call or other means.
In principle, we could mitigate this by making the exception frame classification condition in save_stack_trace_tsk_reliable() stronger:
in addition to testing for STACK_FRAME_REGS_MARKER, we could also take into account that for all exceptions executing on the kernel stack
- their stack frames's backlink pointers always match what is saved
in their pt_regs instance's ->gpr[1] slot and that
- their exception frame size equals STACK_INT_FRAME_SIZE, a value uncommonly large for non-exception frames.
However, while these are currently true, relying on them would make the reliable stacktrace implementation more sensitive towards future changes in the exception entry code. Note that false negatives, i.e. not detecting exception frames, would silently break the live patching consistency model.
Furthermore, certain other places (diagnostic stacktraces, perf, xmon) rely on STACK_FRAME_REGS_MARKER as well.
Make the exception exit code clear the on-stack STACK_FRAME_REGS_MARKER for those exceptions running on the "normal" kernel stack and returning to kernelspace: because the topmost frame is ignored by the reliable stack tracer anyway, returns to userspace don't need to take care of clearing the marker.
Furthermore, as I don't have the ability to test this on Book 3E or 32 bits, limit the change to Book 3S and 64 bits.
--- arch/powerpc/kernel/entry_64.S | 7 +++++++ 1 file changed, 7 insertions(+)
arch/powerpc/kernel/entry_64.S +7 -0
@@ -1002,6 +1002,13 @@ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR) ld r2,_NIP(r1) mtspr SPRN_SRR0,r2 + /* + * Leaving a stale exception_marker on the stack can confuse + * the reliable stack unwinder later on. Clear it. + */ + li r2,0 + std r2,STACK_FRAME_OVERHEAD-16(r1) + ld r0,GPR0(r1) ld r2,GPR2(r1) ld r3,GPR3(r1)
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 191/246 cgroup/pids: turn cgroup_subsys->free() into cgroup_subsys->release() to fix the accounting
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 51bee5abeab2058ea5813c5615d6197a23dbf041 ]
The only user of cgroup_subsys->free() callback is pids_cgrp_subsys which needs pids_free() to uncharge the pid.
However, ->free() is called from __put_task_struct()->cgroup_free() and this is too late. Even the trivial program which does
for (;;) {
int pid = fork();
assert(pid >= 0);
if (pid)
wait(NULL);
else
exit(0);
}can run out of limits because release_task()->call_rcu(delayed_put_task_struct) implies an RCU gp after the task/pid goes away and before the final put().
Test-case:
mkdir -p /tmp/CG
mount -t cgroup2 none /tmp/CG
echo '+pids' > /tmp/CG/cgroup.subtree_control
mkdir /tmp/CG/PID
echo 2 > /tmp/CG/PID/pids.max
perl -e 'while ($p = fork) { wait; } $p // die "fork failed: $!\n"' & echo $! > /tmp/CG/PID/cgroup.procs
Without this patch the forking process fails soon after migration.
Rename cgroup_subsys->free() to cgroup_subsys->release() and move the callsite into the new helper, cgroup_release(), called by release_task() which actually frees the pid(s).
--- include/linux/cgroup-defs.h | 2 +- include/linux/cgroup.h | 2 ++ kernel/cgroup/cgroup.c | 15 +++++++++------ kernel/cgroup/pids.c | 4 ++-- kernel/exit.c | 1 + 5 files changed, 15 insertions(+), 9 deletions(-)
include/linux/cgroup-defs.h +1 -1
@@ -602,7 +602,7 @@ struct cgroup_subsys {void (*cancel_fork)(struct task_struct *task);void (*fork)(struct task_struct *task);void (*exit)(struct task_struct *task); -void (*free)(struct task_struct *task); +void (*release)(struct task_struct *task);void (*bind)(struct cgroup_subsys_state *root_css); bool early_init:1;
include/linux/cgroup.h +2 -0
@@ -121,6 +121,7 @@ extern int cgroup_can_fork(struct task_struct *p);extern void cgroup_cancel_fork (struct task_struct *p);extern void cgroup_post_fork (struct task_struct *p);void cgroup_exit (struct task_struct *p); +void cgroup_release (struct task_struct *p);void cgroup_free (struct task_struct *p);int cgroup_init_early (void );
@@ -697,6 +698,7 @@ static inline int cgroup_can_fork(struct task_struct *p) { return 0; }static inline void cgroup_cancel_fork (struct task_struct *p) {}static inline void cgroup_post_fork (struct task_struct *p) {}static inline void cgroup_exit (struct task_struct *p) {} +static inline void cgroup_release (struct task_struct *p) {}static inline void cgroup_free (struct task_struct *p) {}static inline int cgroup_init_early (void ) {return 0 ; }
kernel/cgroup/cgroup.c +9 -6
@@ -197,7 +197,7 @@ static u64 css_serial_nr_next = 1;*/ static u16 have_fork_callback__read_mostly ;static u16 have_exit_callback__read_mostly ; -static u16 have_free_callback__read_mostly ; +static u16 have_release_callback__read_mostly ;static u16 have_canfork_callback__read_mostly ;/* cgroup namespace for init task */
@@ -5316,7 +5316,7 @@ static void __init cgroup_init_subsys(struct cgroup_subsys *ss, bool early) have_fork_callback |= (bool )ss->fork << ss->id; have_exit_callback |= (bool )ss->exit << ss->id; - have_free_callback |= (bool )ss->free << ss->id; + have_release_callback |= (bool )ss->release << ss->id; have_canfork_callback |= (bool )ss->can_fork << ss->id;/* At system boot, before all subsystems have been
@@ -5752,16 +5752,19 @@ void cgroup_exit(struct task_struct *tsk) }while_each_subsys_mask (); } -void cgroup_free (struct task_struct *task) +void cgroup_release (struct task_struct *task) { -struct css_set *cset =task_css_set (task);struct cgroup_subsys *ss;int ssid; - do_each_subsys_mask(ss, ssid, have_free_callback) { - ss->free (task); + do_each_subsys_mask(ss, ssid, have_release_callback) { + ss->release (task); }while_each_subsys_mask (); +} +void cgroup_free (struct task_struct *task) +{ +struct css_set *cset =task_css_set (task);put_css_set (cset); }
kernel/cgroup/pids.c +2 -2
@@ -247,7 +247,7 @@ static void pids_cancel_fork(struct task_struct *task)pids_uncharge (pids,1 ); } -static void pids_free (struct task_struct *task) +static void pids_release (struct task_struct *task) {struct pids_cgroup *pids =css_pids (task_css (task, pids_cgrp_id));
@@ -342,7 +342,7 @@ struct cgroup_subsys pids_cgrp_subsys = { .cancel_attach = pids_cancel_attach, .can_fork = pids_can_fork, .cancel_fork = pids_cancel_fork, - .free = pids_free, + .release = pids_release, .legacy_cftypes = pids_files, .dfl_cftypes = pids_files, .threaded = true,
kernel/exit.c +1 -0
@@ -219,6 +219,7 @@ repeat: }write_unlock_irq (&tasklist_lock); +cgroup_release (p);release_thread (p);call_rcu (&p->rcu, delayed_put_task_struct);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 192/246 backlight: pwm_bl: Use gpiod_get_value_cansleep() to get initial state
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit cec2b18832e26bc866bef2be22eff4e25bbc4034 ]
gpiod_get_value() gives out a warning if access to the underlying gpiochip requires sleeping, which is common for I2C based chips:
WARNING: CPU: 0 PID: 77 at drivers/gpio/gpiolib.c:2500 gpiod_get_value+0xd0/0x100
Modules linked in:
CPU: 0 PID: 77 Comm: kworker/0:2 Not tainted 4.14.0-rc3-00589-gf32897915d48-dirty #90
Hardware name: Allwinner sun4i/sun5i Families
Workqueue: events deferred_probe_work_func
[<c010ec50>] (unwind_backtrace) from [<c010b784>] (show_stack+0x10/0x14)
[<c010b784>] (show_stack) from [<c0797224>] (dump_stack+0x88/0x9c)
[<c0797224>] (dump_stack) from [<c0125b08>] (__warn+0xe8/0x100)
[<c0125b08>] (__warn) from [<c0125bd0>] (warn_slowpath_null+0x20/0x28)
[<c0125bd0>] (warn_slowpath_null) from [<c037069c>] (gpiod_get_value+0xd0/0x100)
[<c037069c>] (gpiod_get_value) from [<c03778d0>] (pwm_backlight_probe+0x238/0x508)
[<c03778d0>] (pwm_backlight_probe) from [<c0411a2c>] (platform_drv_probe+0x50/0xac)
[<c0411a2c>] (platform_drv_probe) from [<c0410224>] (driver_probe_device+0x238/0x2e8)
[<c0410224>] (driver_probe_device) from [<c040e820>] (bus_for_each_drv+0x44/0x94)
[<c040e820>] (bus_for_each_drv) from [<c040ff0c>] (__device_attach+0xb0/0x114)
[<c040ff0c>] (__device_attach) from [<c040f4f8>] (bus_probe_device+0x84/0x8c)
[<c040f4f8>] (bus_probe_device) from [<c040f944>] (deferred_probe_work_func+0x50/0x14c)
[<c040f944>] (deferred_probe_work_func) from [<c013be84>] (process_one_work+0x1ec/0x414)
[<c013be84>] (process_one_work) from [<c013ce5c>] (worker_thread+0x2b0/0x5a0)
[<c013ce5c>] (worker_thread) from [<c0141908>] (kthread+0x14c/0x154)
[<c0141908>] (kthread) from [<c0107ab0>] (ret_from_fork+0x14/0x24)This was missed in commit 0c9501f823a4 ("backlight: pwm_bl: Handle gpio that can sleep"). The code was then moved to a separate function in commit 7613c922315e ("backlight: pwm_bl: Move the checks for initial power state to a separate function").
The only usage of gpiod_get_value() is during the probe stage, which is safe to sleep in. Switch to gpiod_get_value_cansleep().
--- drivers/video/backlight/pwm_bl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/backlight/pwm_bl.c +1 -1
@@ -435,7 +435,7 @@ static int pwm_backlight_initial_power_state(const struct pwm_bl_data *pb)*/ /* if the enable GPIO is disabled, do not enable the backlight */ -if (pb->enable_gpio &&gpiod_get_value (pb->enable_gpio) ==0 ) +if (pb->enable_gpio &&gpiod_get_value_cansleep (pb->enable_gpio) ==0 )return FB_BLANK_POWERDOWN ;/* The regulator is disabled, do not enable the backlight */
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 193/246 tty: increase the default flip buffer limit to 2*640K
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 7ab57b76ebf632bf2231ccabe26bea33868118c6 ]
We increase the default limit for buffer memory allocation by a factor of 10 to 640K to prevent data loss when using fast serial interfaces.
For example when using RS485 without flow-control at speeds of 1Mbit/s an upwards we've run into problems such as applications being too slow to read out this buffer (on embedded devices based on imx53 or imx6).
If you want to write transmitted data to a slow SD card and thus have realtime requirements, this limit can become a problem.
That shouldn't be the case and 640K buffers fix such problems for us.
This value is a maximum limit for allocation only. It has no effect on systems that currently run fine. When transmission is slow enough applications and hardware can keep up and increasing this limit doesn't change anything.
It only _allows_ to allocate more than 2*64K in cases we currently fail to allocate memory despite having some.
--- drivers/tty/tty_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/tty_buffer.c +1 -1
@@ -26,7 +26,7 @@* Byte threshold to limit memory consumption for flip buffers. * The actual memory limit is > 2x this amount. */ -#define TTYB_DEFAULT_MEM_LIMIT 65536 +#define TTYB_DEFAULT_MEM_LIMIT (640 * 1024UL)/* * We default to dicing tty buffer allocations to this many characters
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 194/246 powerpc/pseries: Perform full re-add of CPU for topology update post-migration
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 81b61324922c67f73813d8a9c175f3c153f6a1c6 ]
On pseries systems, performing a partition migration can result in altering the nodes a CPU is assigned to on the destination system. For exampl, pre-migration on the source system CPUs are in node 1 and 3, post-migration on the destination system CPUs are in nodes 2 and 3.
Handling the node change for a CPU can cause corruption in the slab cache if we hit a timing where a CPUs node is changed while cache_reap() is invoked. The corruption occurs because the slab cache code appears to rely on the CPU and slab cache pages being on the same node.
The current dynamic updating of a CPUs node done in arch/powerpc/mm/numa.c does not prevent us from hitting this scenario.
Changing the device tree property update notification handler that recognizes an affinity change for a CPU to do a full DLPAR remove and add of the CPU instead of dynamically changing its node resolves this issue.
--- arch/powerpc/include/asm/topology.h | 2 ++ arch/powerpc/mm/numa.c | 9 +-------- arch/powerpc/platforms/pseries/hotplug-cpu.c | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+), 8 deletions(-)
arch/powerpc/include/asm/topology.h +2 -0
@@ -132,6 +132,8 @@ static inline void shared_proc_topology_init(void) {}#define topology_sibling_cpumask (cpu) (per_cpu(cpu_sibling_map, cpu))#define topology_core_cpumask (cpu) (per_cpu(cpu_core_map, cpu))#define topology_core_id (cpu) (cpu_to_core_id(cpu)) + +int dlpar_cpu_readd (int cpu);#endif #endif
arch/powerpc/mm/numa.c +1 -8
@@ -1460,13 +1460,6 @@ static void reset_topology_timer(void)#ifdef CONFIG_SMP -static void stage_topology_update (int core_id) -{ -cpumask_or (&cpu_associativity_changes_mask, - &cpu_associativity_changes_mask,cpu_sibling_mask (core_id)); -reset_topology_timer (); -} -static int dt_update_callback (struct notifier_block *nb,unsigned long action,void *data) {
@@ -1479,7 +1472,7 @@ static int dt_update_callback(struct notifier_block *nb, !of_prop_cmp(update->prop->name, "ibm,associativity")) {u32 core_id;of_property_read_u32 (update->dn,"reg" , &core_id); -stage_topology_update (core_id); + rc =dlpar_cpu_readd (core_id); rc =NOTIFY_OK ; }break ;
arch/powerpc/platforms/pseries/hotplug-cpu.c +19 -0
@@ -802,6 +802,25 @@ static int dlpar_cpu_add_by_count(u32 cpus_to_add)return rc; } +int dlpar_cpu_readd (int cpu) +{ +struct device_node *dn; +struct device *dev; +u32 drc_index; +int rc; + + dev =get_cpu_device (cpu); + dn = dev->of_node; + + rc =of_property_read_u32 (dn,"ibm,my-drc-index" , &drc_index); + + rc =dlpar_cpu_remove_by_index (drc_index); +if (!rc) + rc =dlpar_cpu_add (drc_index); + +return rc; +} +int dlpar_cpu (struct pseries_hp_errorlog *hp_elog) {u32 count, drc_index;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 195/246 drm/amd/display: Enable vblank interrupt during CRC capture
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 428da2bdb05d76c48d0bd8fbfa2e4c102685be08 ]
[Why]
In order to read CRC events when CRC capture is enabled the vblank interrput handler needs to be running for the CRTC. The handler is enabled while there is an active vblank reference.
When running IGT tests there will often be no active vblank reference but the test expects to read a CRC value. This is valid usage (and works on i915 since they have a CRC interrupt handler) so the reference to the vblank should be grabbed while capture is active.
This issue was found running:
igt@kms_plane_multiple@atomic-pipe-b-tiling-none
The pipe-b is the only one in the initial commit and was not previously active so no vblank reference is grabbed. The vblank interrupt is not enabled and the test times out.
[How]
Keep a reference to the vblank as long as CRC capture is enabled. If userspace never explicitly disables it then the reference is also dropped when removing the CRTC from the context (stream = NULL).
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 14 ++++++- .../drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c | 42 +++++++++---------- 2 files changed, 34 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +13 -1
@@ -4997,10 +4997,22 @@ static int amdgpu_dm_atomic_commit(struct drm_device *dev,*/ for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) {struct dm_crtc_state *dm_old_crtc_state =to_dm_crtc_state (old_crtc_state); +struct dm_crtc_state *dm_new_crtc_state =to_dm_crtc_state (new_crtc_state);struct amdgpu_crtc *acrtc =to_amdgpu_crtc (crtc); -if (drm_atomic_crtc_needs_modeset (new_crtc_state) && dm_old_crtc_state->stream) +if (drm_atomic_crtc_needs_modeset (new_crtc_state) + && dm_old_crtc_state->stream) { +/* +* CRC capture was enabled but not disabled. +* Release the vblank reference. +*/ +if (dm_new_crtc_state->crc_enabled) { +drm_crtc_vblank_put (crtc); + dm_new_crtc_state->crc_enabled = false; + } +manage_dm_interrupts (adev, acrtc, false); + } }/* * Add check here for SoC's that support hardware cursor plane, to
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c +21 -21
55 lines not on this page · raw message
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 196/246 ALSA: dice: add support for Solid State Logic Duende Classic/Mini
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit b2e9e1c8810ee05c95f4d55800b8afae70ab01b4 ]
Duende Classic was produced by Solid State Logic in 2006, as a first model of Duende DSP series. The following model, Duende Mini was produced in 2008. They are designed to receive isochronous packets for PCM frames via IEEE 1394 bus, perform signal processing by downloaded program, then transfer isochronous packets for converted PCM frames.
These two models includes the same embedded board, consists of several ICs below:
- Texus Instruments Inc, TSB41AB3 for physical layer of IEEE 1394 bus
- WaveFront semiconductor, DICE II STD ASIC for link/protocol layer
- Altera MAX 3000A CPLD for programs
- Analog devices, SHARC ADSP-21363 for signal processing (4 chips)
This commit adds support for the two models to ALSA dice driver. Like support for the other devices, packet streaming is just available. Userspace applications should be developed if full features became available; e.g. program uploader and parameter controller.
$ ./hinawa-config-rom-printer /dev/fw1
{ 'bus-info': { 'adj': False,
'bmc': False,
'chip_ID': 349771402425,
'cmc': True,
'cyc_clk_acc': 255,
'generation': 1,
'imc': True,
'isc': True,
'link_spd': 2,
'max_ROM': 1,
'max_rec': 512,
'name': '1394',
'node_vendor_ID': 20674,
'pmc': False},
'root-directory': [ ['VENDOR', 20674],
['DESCRIPTOR', 'Solid State Logic'],
['MODEL', 112],
['DESCRIPTOR', 'Duende board'],
[ 'NODE_CAPABILITIES',
{ 'addressing': {'64': True, 'fix': True, 'prv': True},
'misc': {'int': False, 'ms': False, 'spt': True},
'state': { 'atn': False,
'ded': False,
'drq': True,
'elo': False,
'init': False,
'lst': True,
'off': False},
'testing': {'bas': False, 'ext': False}}],
[ 'UNIT',
[ ['SPECIFIER_ID', 20674],
['VERSION', 1],
['MODEL', 112],
['DESCRIPTOR', 'Duende board']]]]}--- sound/firewire/dice/dice.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
sound/firewire/dice/dice.c +11 -1
@@ -18,6 +18,7 @@ MODULE_LICENSE("GPL v2");#define OUI_ALESIS 0x000595#define OUI_MAUDIO 0x000d6c#define OUI_MYTEK 0x001ee8 +#define OUI_SSL 0x0050c2 // Actually ID reserved by IEEE.#define DICE_CATEGORY_ID 0x04#define WEISS_CATEGORY_ID 0x00
@@ -196,7 +197,7 @@ static int dice_probe(struct fw_unit *unit,struct snd_dice *dice;int err; -if (!entry->driver_data) { +if (!entry->driver_data && entry->vendor_id !=OUI_SSL ) { err =check_dice_category (unit);if (err <0 )return -ENODEV ;
@@ -361,6 +362,15 @@ static const struct ieee1394_device_id dice_id_table[] = { .model_id = 0x000002, .driver_data = (kernel_ulong_t)snd_dice_detect_mytek_formats, }, +// Solid State Logic, Duende Classic and Mini. +// NOTE: each field of GUID in config ROM is not compliant to standard +// DICE scheme. + { + .match_flags = IEEE1394_MATCH_VENDOR_ID | + IEEE1394_MATCH_MODEL_ID, + .vendor_id = OUI_SSL, + .model_id = 0x000070, + }, { .match_flags = IEEE1394_MATCH_VERSION, .version = DICE_INTERFACE,
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 197/246 regulator: mcp16502: Include linux/gpio/consumer.h to fix build error
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit f3c6a1a194317f3a31ee2b2067bb0a41de64bc8b ]
Fix below build error:drivers/regulator/mcp16502.c: In function ‘mcp16502_gpio_set_mode’:drivers/regulator/mcp16502.c:135:3: error: implicit declaration of function ‘gpiod_set_value’; did you mean ‘gpio_set_value’? [-Werror=implicit-function-declaration]
gpiod_set_value(mcp->lpm, 0);
^~~~~~~~~~~~~~~
gpio_set_valuedrivers/regulator/mcp16502.c: In function ‘mcp16502_probe’:drivers/regulator/mcp16502.c:486:13: error: implicit declaration of function ‘devm_gpiod_get’; did you mean ‘devm_gpio_free’? [-Werror=implicit-function-declaration]
mcp->lpm = devm_gpiod_get(dev, "lpm", GPIOD_OUT_LOW);
^~~~~~~~~~~~~~
devm_gpio_free
drivers/regulator/mcp16502.c:486:40: error: ‘GPIOD_OUT_LOW’ undeclared (first use in this function); did you mean ‘GPIOF_INIT_LOW’?
mcp->lpm = devm_gpiod_get(dev, "lpm", GPIOD_OUT_LOW);
^~~~~~~~~~~~~
GPIOF_INIT_LOW--- drivers/regulator/mcp16502.c | 1 + 1 file changed, 1 insertion(+)
drivers/regulator/mcp16502.c +1 -0
@@ -17,6 +17,7 @@#include <linux/regmap.h> #include <linux/regulator/driver.h> #include <linux/suspend.h> +#include <linux/gpio/consumer.h> #define VDD_LOW_SEL 0x0D#define VDD_HIGH_SEL 0x3F
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 198/246 usb: dwc3: gadget: Fix OTG events when gadget driver isnt loaded
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 169e3b68cadb5775daca009ced4faf01ffd97dcf ]
On v3.10a in dual-role mode, if port is in device mode and gadget driver isn't loaded, the OTG event interrupts don't come through.
It seems that if the core is configured to be OTG2.0 only, then we can't leave the DCFG.DEVSPD at Super-speed (default) if we expect OTG to work properly. It must be set to High-speed.
Fix this issue by configuring DCFG.DEVSPD to the supported maximum speed at gadget init. Device tree still needs to provide correct supported maximum speed for this to work.
This issue wasn't present on v2.40a but is seen on v3.10a. It doesn't cause any side effects on v2.40a.
--- drivers/usb/dwc3/gadget.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/dwc3/gadget.c +2 -0
@@ -3339,6 +3339,8 @@ int dwc3_gadget_init(struct dwc3 *dwc) goto err4; } +dwc3_gadget_set_speed (&dwc->gadget, dwc->maximum_speed); +return 0 ; err4:
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 199/246 platform/x86: intel-hid: Missing power button release on some Dell models
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit e97a34563d18606ee5db93e495382a967f999cd4 ]
Power button suspend for some Dell models was added in:
commit 821b85366284 ("platform/x86: intel-hid: Power button suspend on Dell Latitude 7275")
by checking against the power button press notification (0xCE) to report the power button press event. The corresponding power button release notification (0xCF) was caught and ignored to stop it from being reported as an "unknown event" in the logs.
The missing button release event is creating issues on Android-x86, as reported on the project mailing list for a Dell Latitude 5175 model, since the events are expected in down/up pairs.
Report the power button release event to fix this issue.
--- drivers/platform/x86/intel-hid.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/platform/x86/intel-hid.c +5 -2
@@ -363,7 +363,7 @@ wakeup:* the 5-button array, but still send notifies with power button * event code to this device object on power button actions. * -* Report the power button press; catch and ignore the button release. +* Report the power button press and release. */ if (!priv->array) {if (event ==0xce ) {
@@ -372,8 +372,11 @@ wakeup:return ; } -if (event ==0xcf ) +if (event ==0xcf ) { +input_report_key (priv->input_dev,KEY_POWER ,0 ); +input_sync (priv->input_dev);return ; + } }/* 0xC0 is for HID events, other values are for 5 button array */
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 200/246 perf trace: Fixup etcsnoop example
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 1d59cb1bbd4cbe5a8f8032242cdacea5658129cf ]
Where we don't have "raw_syscalls:sys_enter", so we need to look for a "*syscalls:sys_enter*" to initialize the offsets for the __augmented_syscalls__ evsel, which is the case with etcsnoop, that was segfaulting, fixed:
# trace -e /home/acme/git/perf/tools/perf/examples/bpf/etcsnoop.c
0.000 ( ): gnome-shell/2105 openat(dfd: CWD, filename: "/etc/localtime") ...
631.834 ( ): cat/6521 openat(dfd: CWD, filename: "/etc/ld.so.cache", flags: RDONLY|CLOEXEC) ...
632.637 ( ): bash/6521 openat(dfd: CWD, filename: "/etc/passwd") ...
^C#--- tools/perf/builtin-trace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/builtin-trace.c +2 -1
@@ -3868,7 +3868,8 @@ int cmd_trace(int argc, const char **argv) goto init_augmented_syscall_tp; } -if (strcmp (perf_evsel__name (evsel),"raw_syscalls:sys_enter" ) ==0 ) { +if (trace.syscalls.events.augmented->priv ==NULL && +strstr (perf_evsel__name (evsel),"syscalls:sys_enter" )) {struct perf_evsel *augmented = trace.syscalls.events.augmented;if (perf_evsel__init_augmented_syscall_tp (augmented, evsel) ||perf_evsel__init_augmented_syscall_tp_args (augmented))
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 201/246 perf script python: Use PyBytes for attr in trace-event-python
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 72e0b15cb24a497d7d0d4707cf51ff40c185ae8c ]
With Python3. PyUnicode_FromStringAndSize is unsafe to call on attr and will return NULL. Use _PyBytes_FromStringAndSize (as with raw_buf).
Below is the observed behavior without the fix. Note it is first necessary to apply the prior fix (Add trace_context extension module to sys,modules):
# ldd /usr/bin/perf | grep -i python
libpython3.6m.so.1.0 => /usr/lib64/libpython3.6m.so.1.0 (0x00007f8e1dfb2000)# perf record -e raw_syscalls:sys_enter /bin/false [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.018 MB perf.data (21 samples) ]
# perf script -g python | cat generated Python script: perf-script.py
# perf script -s ./perf-script.py in trace_begin Segmentation fault (core dumped)
--- tools/perf/util/scripting-engines/trace-event-python.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/util/scripting-engines/trace-event-python.c +1 -2
@@ -733,8 +733,7 @@ static PyObject *get_perf_sample_dict(struct perf_sample *sample,Py_FatalError ("couldn't create Python dictionary" );pydict_set_item_string_decref (dict,"ev_name" ,_PyUnicode_FromString (perf_evsel__name (evsel))); -pydict_set_item_string_decref (dict,"attr" ,_PyUnicode_FromStringAndSize ( - (const char *)&evsel->attr,sizeof (evsel->attr))); +pydict_set_item_string_decref (dict,"attr" ,_PyBytes_FromStringAndSize ((const char *)&evsel->attr,sizeof (evsel->attr)));pydict_set_item_string_decref (dict_sample,"pid" ,_PyLong_FromLong (sample->pid));
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 202/246 perf script python: Add trace_context extension module to sys.modules
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit cc437642255224e4140fed1f3e3156fc8ad91903 ]
In Python3, the result of PyModule_Create (called from scripts/python/Perf-Trace-Util/Context.c) is not automatically added to sys.modules. See: https://bugs.python.org/issue4592
Below is the observed behavior without the fix:
# ldd /usr/bin/perf | grep -i python libpython3.6m.so.1.0 => /usr/lib64/libpython3.6m.so.1.0 (0x00007f8e1dfb2000)
# perf record /bin/false [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.015 MB perf.data (17 samples) ]
# perf script -g python | cat generated Python script: perf-script.py
# perf script -s ./perf-script.py
Traceback (most recent call last):
File "./perf-script.py", line 18, in <module>
from perf_trace_context import *
ModuleNotFoundError: No module named 'perf_trace_context'
Error running python script ./perf-script.py
#Committer notes:
To build with python3 use:
$ make -C tools/perf PYTHON=python3
Use a non-const variable to pass the 'name' arg to PyImport_AppendInittab(), as python2.6 has that as 'char *', which ends up trowing this in some environments:
CC /tmp/build/perf/util/parse-branch-options.o
util/scripting-engines/trace-event-python.c: In function 'python_start_script':
util/scripting-engines/trace-event-python.c:1520:2: error: passing argument 1 of 'PyImport_AppendInittab' discards 'const' qualifier from pointer target type [-Werror]
PyImport_AppendInittab("perf_trace_context", initfunc);
^
In file included from /usr/include/python2.6/Python.h:130:0,
from util/scripting-engines/trace-event-python.c:22:
/usr/include/python2.6/import.h:54:17: note: expected 'char *' but argument is of type 'const char *'
PyAPI_FUNC(int) PyImport_AppendInittab(char *name, void (*initfunc)(void));
^cc1: all warnings being treated as errors
--- .../perf/util/scripting-engines/trace-event-python.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
tools/perf/util/scripting-engines/trace-event-python.c +9 -3
@@ -1493,34 +1493,40 @@ static void _free_command_line(wchar_t **command_line, int num)static int python_start_script (const char *script,int argc,const char **argv) {struct tables *tables = &tables_global; +PyMODINIT_FUNC (*initfunc)(void);#if PY_MAJOR_VERSION <3 const char **command_line;#else wchar_t **command_line;#endif -char buf[PATH_MAX ]; +/* +* Use a non-const name variable to cope with python 2.6's +* PyImport_AppendInittab prototype +*/ +char buf[PATH_MAX ], name[19 ] ="perf_trace_context" ;int i, err =0 ;FILE *fp;#if PY_MAJOR_VERSION <3 + initfunc = initperf_trace_context; command_line =malloc ((argc +1 ) *sizeof (const char *)); command_line[0 ] = script;for (i =1 ; i < argc +1 ; i++) command_line[i] = argv[i -1 ];#else + initfunc = PyInit_perf_trace_context; command_line =malloc ((argc +1 ) *sizeof (wchar_t *)); command_line[0 ] =Py_DecodeLocale (script,NULL );for (i =1 ; i < argc +1 ; i++) command_line[i] =Py_DecodeLocale (argv[i -1 ],NULL );#endif +PyImport_AppendInittab (name, initfunc);Py_Initialize ();#if PY_MAJOR_VERSION <3 -initperf_trace_context ();PySys_SetArgv (argc +1 , (char **)command_line);#else -PyInit_perf_trace_context ();PySys_SetArgv (argc +1 , command_line);#endif
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 203/246 media: mt9m111: set initial frame size other than 0x0
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 29856308137de1c21eda89411695f4fc6e9780ff ]
This driver sets initial frame width and height to 0x0, which is invalid. So set it to selection rectangle bounds instead.
This is detected by v4l2-compliance detected.
--- drivers/media/i2c/mt9m111.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/i2c/mt9m111.c +2 -0
@@ -1273,6 +1273,8 @@ static int mt9m111_probe(struct i2c_client *client, mt9m111->rect.top =MT9M111_MIN_DARK_ROWS ; mt9m111->rect.width =MT9M111_MAX_WIDTH ; mt9m111->rect.height =MT9M111_MAX_HEIGHT ; + mt9m111->width = mt9m111->rect.width; + mt9m111->height = mt9m111->rect.height; mt9m111->fmt = &mt9m111_colour_fmts[0 ]; mt9m111->lastpage =-1 ;mutex_init (&mt9m111->power_lock);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 204/246 hwrng: virtio - Avoid repeated init of completion
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit aef027db48da56b6f25d0e54c07c8401ada6ce21 ]
The virtio-rng driver uses a completion called have_data to wait for a virtio read to be fulfilled by the hypervisor. The completion is reset before placing a buffer on the virtio queue and completed by the virtio callback once data has been written into the buffer.
Prior to this commit, the driver called init_completion on this completion both during probe as well as when registering virtio buffers as part of a hwrng read operation. The second of these init_completion calls should instead be reinit_completion because the have_data completion has already been inited by probe. As described in Documentation/scheduler/completion.txt, "Calling init_completion() twice on the same completion object is most likely a bug".
This bug was present in the initial implementation of virtio-rng in f7f510ec1957 ("virtio: An entropy device, as suggested by hpa"). Back then the have_data completion was a single static completion rather than a member of one of potentially multiple virtrng_info structs as implemented later by 08e53fbdb85c ("virtio-rng: support multiple virtio-rng devices"). The original driver incorrectly used init_completion rather than INIT_COMPLETION to reset have_data during read.
Tested by running head -c48 /dev/random | hexdump within crosvm, the Chrome OS virtual machine monitor, and confirming that the virtio-rng driver successfully produces random bytes from the host.
--- drivers/char/hw_random/virtio-rng.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/hw_random/virtio-rng.c +1 -1
@@ -73,7 +73,7 @@ static int virtio_read(struct hwrng *rng, void *buf, size_t size, bool wait)if (!vi->busy) { vi->busy = true; -init_completion (&vi->have_data); +reinit_completion (&vi->have_data);register_buffer (vi, buf, size); }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 205/246 soc/tegra: fuse: Fix illegal free of IO base address
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 51294bf6b9e897d595466dcda5a3f2751906a200 ]
On cases where device tree entries for fuse and clock provider are in different order, fuse driver needs to defer probing. This leads to freeing incorrect IO base address as the fuse->base variable gets overwritten once during first probe invocation. This leads to the following spew during boot:
[ 3.082285] Trying to vfree() nonexistent vm area (00000000cfe8fd94) [ 3.082308] WARNING: CPU: 5 PID: 126 at /hdd/l4t/kernel/stable/mm/vmalloc.c:1511 __vunmap+0xcc/0xd8 [ 3.082318] Modules linked in: [ 3.082330] CPU: 5 PID: 126 Comm: kworker/5:1 Tainted: G S 4.19.7-tegra-gce119d3 #1 [ 3.082340] Hardware name: quill (DT) [ 3.082353] Workqueue: events deferred_probe_work_func [ 3.082364] pstate: 40000005 (nZcv daif -PAN -UAO) [ 3.082372] pc : __vunmap+0xcc/0xd8 [ 3.082379] lr : __vunmap+0xcc/0xd8 [ 3.082385] sp : ffff00000a1d3b60 [ 3.082391] x29: ffff00000a1d3b60 x28: 0000000000000000 [ 3.082402] x27: 0000000000000000 x26: ffff000008e8b610 [ 3.082413] x25: 0000000000000000 x24: 0000000000000009 [ 3.082423] x23: ffff000009221a90 x22: ffff000009f6d000 [ 3.082432] x21: 0000000000000000 x20: 0000000000000000 [ 3.082442] x19: ffff000009f6d000 x18: ffffffffffffffff [ 3.082452] x17: 0000000000000000 x16: 0000000000000000 [ 3.082462] x15: ffff0000091396c8 x14: 0720072007200720 [ 3.082471] x13: 0720072007200720 x12: 0720072907340739 [ 3.082481] x11: 0764076607380765 x10: 0766076307300730 [ 3.082491] x9 : 0730073007300730 x8 : 0730073007280720 [ 3.082501] x7 : 0761076507720761 x6 : 0000000000000102 [ 3.082510] x5 : 0000000000000000 x4 : 0000000000000000 [ 3.082519] x3 : ffffffffffffffff x2 : ffff000009150ff8 [ 3.082528] x1 : 3d95b1429fff5200 x0 : 0000000000000000 [ 3.082538] Call trace: [ 3.082545] __vunmap+0xcc/0xd8 [ 3.082552] vunmap+0x24/0x30 [ 3.082561] __iounmap+0x2c/0x38 [ 3.082569] tegra_fuse_probe+0xc8/0x118 [ 3.082577] platform_drv_probe+0x50/0xa0 [ 3.082585] really_probe+0x1b0/0x288 [ 3.082593] driver_probe_device+0x58/0x100 [ 3.082601] __device_attach_driver+0x98/0xf0 [ 3.082609] bus_for_each_drv+0x64/0xc8 [ 3.082616] __device_attach+0xd8/0x130 [ 3.082624] device_initial_probe+0x10/0x18 [ 3.082631] bus_probe_device+0x90/0x98 [ 3.082638] deferred_probe_work_func+0x74/0xb0 [ 3.082649] process_one_work+0x1e0/0x318 [ 3.082656] worker_thread+0x228/0x450 [ 3.082664] kthread+0x128/0x130 [ 3.082672] ret_from_fork+0x10/0x18 [ 3.082678] ---[ end trace 0810fe6ba772c1c7 ]---
Fix this by retaining the value of fuse->base until driver has successfully probed.
--- drivers/soc/tegra/fuse/fuse-tegra.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/soc/tegra/fuse/fuse-tegra.c +9 -3
@@ -137,13 +137,17 @@ static int tegra_fuse_probe(struct platform_device *pdev) res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); fuse->phys = res->start; fuse->base =devm_ioremap_resource (&pdev->dev, res); -if (IS_ERR (fuse->base)) -return PTR_ERR (fuse->base); +if (IS_ERR (fuse->base)) { + err =PTR_ERR (fuse->base); + fuse->base = base; +return err; + } fuse->clk =devm_clk_get (&pdev->dev,"fuse" );if (IS_ERR (fuse->clk)) {dev_err (&pdev->dev,"failed to get FUSE clock: %ld" ,PTR_ERR (fuse->clk)); + fuse->base = base;return PTR_ERR (fuse->clk); }
@@ -152,8 +156,10 @@ static int tegra_fuse_probe(struct platform_device *pdev)if (fuse->soc->probe) { err = fuse->soc->probe (fuse); -if (err <0 ) +if (err <0 ) { + fuse->base = base;return err; + } } if (tegra_fuse_create_sysfs(&pdev->dev, fuse->soc->info->size,
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 206/246 selftests/bpf: suppress readelf stderr when probing for BTF support
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 2f0921262ba943fe9d9f59037a033927d8c4789b ]
Before:
$ make -s -C tools/testing/selftests/bpf readelf: Error: Missing knowledge of 32-bit reloc types used in DWARF sections of machine number 247 readelf: Warning: unable to apply unsupported reloc type 10 to section .debug_info readelf: Warning: unable to apply unsupported reloc type 1 to section .debug_info readelf: Warning: unable to apply unsupported reloc type 10 to section .debug_info
After:
$ make -s -C tools/testing/selftests/bpf
v2:
* use llvm-readelf instead of redirecting binutils' readelf stderr to /dev/null
--- tools/testing/selftests/bpf/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/bpf/Makefile +2 -1
@@ -96,6 +96,7 @@ $(BPFOBJ): force CLANG ?= clang LLC ?= llc LLVM_OBJCOPY ?= llvm-objcopy +LLVM_READELF ?= llvm-readelf BTF_PAHOLE ?= pahole PROBE := $(shell $(LLC) -march=bpf -mcpu=probe -filetype=null /dev/null 2>&1)
@@ -132,7 +133,7 @@ BTF_PAHOLE_PROBE := $(shell $(BTF_PAHOLE) --help 2>&1 | grep BTF) BTF_OBJCOPY_PROBE := $(shell $(LLVM_OBJCOPY) --help 2>&1 | grep -i 'usage.*llvm') BTF_LLVM_PROBE := $(shell echo "int main() { return 0; }" | \ $(CLANG) -target bpf -O2 -g -c -x c - -o ./llvm_btf_verify.o; \ - readelf -S ./llvm_btf_verify.o | grep BTF; \ + $(LLVM_READELF) -S ./llvm_btf_verify.o | grep BTF; \ /bin/rm -f ./llvm_btf_verify.o) ifneq ($(BTF_LLVM_PROBE),)
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 207/246 HID: intel-ish: ipc: handle PIMR before ish_wakeup also clear PISR busy_clear bit
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 2edefc056e4f0e6ec9508dd1aca2c18fa320efef ]
Host driver should handle interrupt mask register earlier than wake up ish FW else there will be conditions when FW interrupt comes, host PIMR register still not set ready, so move the interrupt mask setting before ish_wakeup.
Clear PISR busy_clear bit in ish_irq_handler. If not clear, there will be conditions host driver received a busy_clear interrupt (before the busy_clear mask bit is ready), it will return IRQ_NONE after check_generated_interrupt, the interrupt will never be cleared, causing the DEVICE not sending following IRQ.
Since PISR clear should not be called for the CHV device we do this change. After the change, both ISH2HOST interrupt and busy_clear interrupt will be considered as interrupt from ISH, busy_clear interrupt will return IRQ_HANDLED from IPC_IS_BUSY check.
--- drivers/hid/intel-ish-hid/ipc/ipc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/hid/intel-ish-hid/ipc/ipc.c +6 -3
@@ -91,7 +91,10 @@ static bool check_generated_interrupt(struct ishtp_device *dev)IPC_INT_FROM_ISH_TO_HOST_CHV_AB (pisr_val); }else { pisr_val =ish_reg_read (dev,IPC_REG_PISR_BXT ); - interrupt_generated =IPC_INT_FROM_ISH_TO_HOST_BXT (pisr_val); + interrupt_generated = !!pisr_val; +/* only busy-clear bit is RW, others are RO */ +if (pisr_val) +ish_reg_write (dev,IPC_REG_PISR_BXT , pisr_val); }return interrupt_generated;
@@ -839,11 +842,11 @@ int ish_hw_start(struct ishtp_device *dev) {ish_set_host_rdy (dev); +set_host_ready (dev); +/* After that we can enable ISH DMA operation and wakeup ISHFW */ ish_wakeup (dev); -set_host_ready (dev); -/* wait for FW-initiated reset flow */ if (!dev->recvd_hw_ready) wait_event_interruptible_timeout(dev->wait_hw_ready,
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 208/246 f2fs: UBSAN: set boolean value iostat_enable correctly
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit ac92985864e187a1735502f6a02f54eaa655b2aa ]
When setting /sys/fs/f2fs/<DEV>/iostat_enable with non-bool value, UBSAN reports the following warning.
[ 7562.295484] ================================================================================ [ 7562.296531] UBSAN: Undefined behaviour in fs/f2fs/f2fs.h:2776:10 [ 7562.297651] load of value 64 is not a valid value for type '_Bool' [ 7562.298642] CPU: 1 PID: 7487 Comm: dd Not tainted 4.20.0-rc4+ #79 [ 7562.298653] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 [ 7562.298662] Call Trace: [ 7562.298760] dump_stack+0x46/0x5b [ 7562.298811] ubsan_epilogue+0x9/0x40 [ 7562.298830] __ubsan_handle_load_invalid_value+0x72/0x90 [ 7562.298863] f2fs_file_write_iter+0x29f/0x3f0 [ 7562.298905] __vfs_write+0x115/0x160 [ 7562.298922] vfs_write+0xa7/0x190 [ 7562.298934] ksys_write+0x50/0xc0 [ 7562.298973] do_syscall_64+0x4a/0xe0 [ 7562.298992] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 7562.299001] RIP: 0033:0x7fa45ec19c00 [ 7562.299004] Code: 73 01 c3 48 8b 0d 88 92 2c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 83 3d dd eb 2c 00 00 75 10 b8 01 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 31 c3 48 83 ec 08 e8 ce 8f 01 00 48 89 04 24 [ 7562.299044] RSP: 002b:00007ffca52b49e8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 [ 7562.299052] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fa45ec19c00 [ 7562.299059] RDX: 0000000000000400 RSI: 000000000093f000 RDI: 0000000000000001 [ 7562.299065] RBP: 000000000093f000 R08: 0000000000000004 R09: 0000000000000000 [ 7562.299071] R10: 00007ffca52b47b0 R11: 0000000000000246 R12: 0000000000000400 [ 7562.299077] R13: 000000000093f000 R14: 000000000093f400 R15: 0000000000000000 [ 7562.299091] ================================================================================
So, if iostat_enable is enabled, set its value as true.
--- fs/f2fs/sysfs.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
fs/f2fs/sysfs.c +9 -3
@@ -278,10 +278,16 @@ out:return count; } - *ui = t; -if (!strcmp (a->attr.name,"iostat_enable" ) && *ui ==0 ) -f2fs_reset_iostat (sbi); +if (!strcmp (a->attr.name,"iostat_enable" )) { + sbi->iostat_enable = !!t; +if (!sbi->iostat_enable) +f2fs_reset_iostat (sbi); +return count; + } + + *ui = (unsigned int )t; +return count; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 209/246 f2fs: fix to initialize variable to avoid UBSAN/smatch warning
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit f9aa52a8cbe09fe25244d59c29660bbe635df613 ]
As Dan Carpenter as below:
The patch df634f444ee9: "f2fs: use rb_*_cached friends" from Oct 4, 2018, leads to the following static checker warning:
fs/f2fs/extent_cache.c:606 f2fs_update_extent_tree_range() error: uninitialized symbol 'leftmost'.
And also Eric Biggers, and Kyungtae Kim reported, there is an UBSAN warning described as below:
We report a bug in linux-4.20.2: "UBSAN: Undefined behaviour in fs/f2fs/extent_cache.c"
kernel config: https://kt0755.github.io/etc/config_v4.20_stable
repro: https://kt0755.github.io/etc/repro.4a3e7.c (f2fs is mounted on /mnt/f2fs/)
This arose in f2fs_update_extent_tree_range (fs/f2fs/extent_cache.c:605). It seems that, for some reason, its last argument became "24" although that was supposed to be bool type.
=========================================
UBSAN: Undefined behaviour in fs/f2fs/extent_cache.c:605:4 load of value 24 is not a valid value for type '_Bool' CPU: 0 PID: 6774 Comm: syz-executor5 Not tainted 4.20.2 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0xb1/0x118 lib/dump_stack.c:113 ubsan_epilogue+0x12/0x94 lib/ubsan.c:159 __ubsan_handle_load_invalid_value+0x17a/0x1be lib/ubsan.c:457 f2fs_update_extent_tree_range+0x1d4a/0x1d50 fs/f2fs/extent_cache.c:605 f2fs_update_extent_cache+0x2b6/0x350 fs/f2fs/extent_cache.c:804 f2fs_update_data_blkaddr+0x61/0x70 fs/f2fs/data.c:656 f2fs_outplace_write_data+0x1d6/0x4b0 fs/f2fs/segment.c:3140 f2fs_convert_inline_page+0x86d/0x2060 fs/f2fs/inline.c:163 f2fs_convert_inline_inode+0x6b5/0xad0 fs/f2fs/inline.c:208 f2fs_preallocate_blocks+0x78b/0xb00 fs/f2fs/data.c:982 f2fs_file_write_iter+0x31b/0xf40 fs/f2fs/file.c:3062 call_write_iter include/linux/fs.h:1857 [inline] new_sync_write fs/read_write.c:474 [inline] __vfs_write+0x538/0x6e0 fs/read_write.c:487 vfs_write+0x1b3/0x520 fs/read_write.c:549 ksys_write+0xde/0x1c0 fs/read_write.c:598 __do_sys_write fs/read_write.c:610 [inline] __se_sys_write fs/read_write.c:607 [inline] __x64_sys_write+0x7e/0xc0 fs/read_write.c:607 do_syscall_64+0xbe/0x4f0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x4497b9 Code: e8 8c 9f 02 00 48 83 c4 18 c3 0f 1f 80 00 00 00 00 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 9b 6b fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f1ea15edc68 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f1ea15ee6cc RCX: 00000000004497b9
RDX: 0000000000001000 RSI: 0000000020000140 RDI: 0000000000000013
RBP: 000000000071bea0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 000000000000bb50 R14: 00000000006f4bf0 R15: 00007f1ea15ee700
=========================================
As I checked, this uninitialized variable won't cause extent cache corruption, but in order to avoid such kind of warning of both UBSAN and smatch, fix to initialize related variable.
--- fs/f2fs/extent_cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/extent_cache.c +1 -1
@@ -506,7 +506,7 @@ static void f2fs_update_extent_tree_range(struct inode *inode,unsigned int end = fofs + len;unsigned int pos = (unsigned int )fofs;bool updated = false; -bool leftmost; +bool leftmost = false;if (!et)return ;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 210/246 hpet: Fix missing = character in the __setup() code of hpet_mmap_enable
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 24d48a61f2666630da130cc2ec2e526eacf229e3 ]
Commit '3d035f580699 ("drivers/char/hpet.c: allow user controlled mmap for user processes")' introduced a new kernel command line parameter hpet_mmap, that is required to expose the memory map of the HPET registers to user-space. Unfortunately the kernel command line parameter 'hpet_mmap' is broken and never takes effect due to missing '=' character in the __setup() code of hpet_mmap_enable.
Before this patch:
dmesg output with the kernel command line parameter hpet_mmap=1
[ 0.204152] HPET mmap disabled
dmesg output with the kernel command line parameter hpet_mmap=0
[ 0.204192] HPET mmap disabled
After this patch:
dmesg output with the kernel command line parameter hpet_mmap=1
[ 0.203945] HPET mmap enabled
dmesg output with the kernel command line parameter hpet_mmap=0
[ 0.204652] HPET mmap disabled
--- drivers/char/hpet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/hpet.c +1 -1
@@ -377,7 +377,7 @@ static __init int hpet_mmap_enable(char *str)pr_info ("HPET mmap %s\n" , hpet_mmap_enabled ?"enabled" :"disabled" );return 1 ; } -__setup ("hpet_mmap" , hpet_mmap_enable); +__setup ("hpet_mmap=" , hpet_mmap_enable);static int hpet_mmap (struct file *file,struct vm_area_struct *vma) {
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 211/246 pinctrl: meson: fix G12A ao pull registers base address
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit e66dd48e8b0dee104d16417d30361074b08baca8 ]
Since Meson G12A SoC, Introduce new ao registers AO_RTI_PULL_UP_EN_REG and AO_GPIO_O.
These bits of controlling output level are remapped to the new register AO_GPIO_O, and the AO_GPIO_O_EN_N support only controlling output enable.
These bits of controlling pull enable are remapped to the new register AO_RTI_PULL_UP_EN_REG, and the AO_RTI_PULL_UP_REG support only controlling pull type(up/down).
The new layout of ao gpio/pull registers is as follows:
- AO_GPIO_O_EN_N [offset: 0x9 << 2] - AO_GPIO_I [offset: 0xa << 2] - AO_RTI_PULL_UP_REG [offset: 0xb << 2]
- AO_RTI_PULL_UP_EN_REG [offset: 0xc << 2]
- AO_GPIO_O [offset: 0xd << 2]
Quoted 1 line
From above, we can see ao GPIO registers region has been separated by the
ao pull registers. In order to ensure the continuity of the region on software, the ao GPIO and ao pull registers use the same base address, but can be identified by the offset.
--- drivers/pinctrl/meson/pinctrl-meson.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
drivers/pinctrl/meson/pinctrl-meson.c +12 -10
@@ -31,6 +31,9 @@* In some cases the register ranges for pull enable and pull * direction are the same and thus there are only 3 register ranges. * +* Since Meson G12A SoC, the ao register ranges for gpio, pull enable +* and pull direction are the same, so there are only 2 register ranges. +* * For the pull and GPIO configuration every bank uses a contiguous * set of bits in the register sets described above; the same register * can be shared by more banks with different offsets.
@@ -488,23 +491,22 @@ static int meson_pinctrl_parse_dt(struct meson_pinctrl *pc,return PTR_ERR (pc->reg_mux); } - pc->reg_pull =meson_map_resource (pc, gpio_np,"pull" ); -if (IS_ERR (pc->reg_pull)) { -dev_err (pc->dev,"pull registers not found\n" ); -return PTR_ERR (pc->reg_pull); + pc->reg_gpio =meson_map_resource (pc, gpio_np,"gpio" ); +if (IS_ERR (pc->reg_gpio)) { +dev_err (pc->dev,"gpio registers not found\n" ); +return PTR_ERR (pc->reg_gpio); } + pc->reg_pull =meson_map_resource (pc, gpio_np,"pull" ); +/* Use gpio region if pull one is not present */ +if (IS_ERR (pc->reg_pull)) + pc->reg_pull = pc->reg_gpio; + pc->reg_pullen =meson_map_resource (pc, gpio_np,"pull-enable" );/* Use pull region if pull-enable one is not present */ if (IS_ERR (pc->reg_pullen)) pc->reg_pullen = pc->reg_pull; - pc->reg_gpio =meson_map_resource (pc, gpio_np,"gpio" ); -if (IS_ERR (pc->reg_gpio)) { -dev_err (pc->dev,"gpio registers not found\n" ); -return PTR_ERR (pc->reg_gpio); - } -return 0 ; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 212/246 pinctrl: sh-pfc: r8a77990: Fix MOD_SEL bit numbering
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 3e3eebeacad79bda8a9664c86c04f5201e86fece ]
MOD_SEL register bit numbering was different from R-Car E3 SoC and R-Car H3/M3-[WN] SoCs.
MOD_SEL 1-bit H3/M3-[WN] E3 =============== ========== ===== Set Value = H'0 b'0 b'0 Set Value = H'1 b'1 b'1
MOD_SEL 2-bits H3/M3-[WN] E3 =============== ========== ===== Set Value = H'0 b'00 b'00 Set Value = H'1 b'01 b'10 Set Value = H'2 b'10 b'01 Set Value = H'3 b'11 b'11
MOD_SEL 3-bits H3/M3-[WN] E3 =============== ========== ===== Set Value = H'0 b'000 b'000 Set Value = H'1 b'001 b'100 Set Value = H'2 b'010 b'010 Set Value = H'3 b'011 b'110 Set Value = H'4 b'100 b'001 Set Value = H'5 b'101 b'101 Set Value = H'6 b'110 b'011 Set Value = H'7 b'111 b'111
This patch replaces the #define name and value of MOD_SEL.
--- drivers/pinctrl/sh-pfc/pfc-r8a77990.c | 32 +++++++++++++++------------ 1 file changed, 18 insertions(+), 14 deletions(-)
drivers/pinctrl/sh-pfc/pfc-r8a77990.c +18 -14
@@ -391,29 +391,33 @@ FM(IP12_23_20) IP12_23_20 FM(IP13_23_20) IP13_23_20 FM(IP14_23_20) IP14_23_20 FM FM(IP12_27_24) IP12_27_24 FM(IP13_27_24) IP13_27_24 FM(IP14_27_24) IP14_27_24 FM(IP15_27_24) IP15_27_24 \ FM(IP12_31_28) IP12_31_28 FM(IP13_31_28) IP13_31_28 FM(IP14_31_28) IP14_31_28 FM(IP15_31_28) IP15_31_28 +/* The bit numbering in MOD_SEL fields is reversed */ +#define REV4(f0, f1, f2, f3) f0 f2 f1 f3 +#define REV8(f0, f1, f2, f3, f4, f5, f6, f7) f0 f4 f2 f6 f1 f5 f3 f7 + /* MOD_SEL0 */ /* 0 */ /* 1 */ /* 2 */ /* 3 */ /* 4 */ /* 5 */ /* 6 */ /* 7 */ -#define MOD_SEL0_30_29 FM(SEL_ADGB_0) FM(SEL_ADGB_1) FM(SEL_ADGB_2) F_(0, 0) +#define MOD_SEL0_30_29 REV4(FM(SEL_ADGB_0), FM(SEL_ADGB_1), FM(SEL_ADGB_2), F_(0, 0)) #define MOD_SEL0_28 FM(SEL_DRIF0_0) FM(SEL_DRIF0_1) -#define MOD_SEL0_27_26 FM(SEL_FM_0) FM(SEL_FM_1) FM(SEL_FM_2) F_(0, 0) +#define MOD_SEL0_27_26 REV4(FM(SEL_FM_0), FM(SEL_FM_1), FM(SEL_FM_2), F_(0, 0)) #define MOD_SEL0_25 FM(SEL_FSO_0) FM(SEL_FSO_1) #define MOD_SEL0_24 FM(SEL_HSCIF0_0) FM(SEL_HSCIF0_1) #define MOD_SEL0_23 FM(SEL_HSCIF1_0) FM(SEL_HSCIF1_1) #define MOD_SEL0_22 FM(SEL_HSCIF2_0) FM(SEL_HSCIF2_1) -#define MOD_SEL0_21_20 FM(SEL_I2C1_0) FM(SEL_I2C1_1) FM(SEL_I2C1_2) FM(SEL_I2C1_3) -#define MOD_SEL0_19_18_17 FM(SEL_I2C2_0) FM(SEL_I2C2_1) FM(SEL_I2C2_2) FM(SEL_I2C2_3) FM(SEL_I2C2_4) F_(0, 0) F_(0, 0) F_(0, 0) +#define MOD_SEL0_21_20 REV4(FM(SEL_I2C1_0), FM(SEL_I2C1_1), FM(SEL_I2C1_2), FM(SEL_I2C1_3)) +#define MOD_SEL0_19_18_17 REV8(FM(SEL_I2C2_0), FM(SEL_I2C2_1), FM(SEL_I2C2_2), FM(SEL_I2C2_3), FM(SEL_I2C2_4), F_(0, 0), F_(0, 0), F_(0, 0)) #define MOD_SEL0_16 FM(SEL_NDFC_0) FM(SEL_NDFC_1) #define MOD_SEL0_15 FM(SEL_PWM0_0) FM(SEL_PWM0_1) #define MOD_SEL0_14 FM(SEL_PWM1_0) FM(SEL_PWM1_1) -#define MOD_SEL0_13_12 FM(SEL_PWM2_0) FM(SEL_PWM2_1) FM(SEL_PWM2_2) F_(0, 0) -#define MOD_SEL0_11_10 FM(SEL_PWM3_0) FM(SEL_PWM3_1) FM(SEL_PWM3_2) F_(0, 0) +#define MOD_SEL0_13_12 REV4(FM(SEL_PWM2_0), FM(SEL_PWM2_1), FM(SEL_PWM2_2), F_(0, 0)) +#define MOD_SEL0_11_10 REV4(FM(SEL_PWM3_0), FM(SEL_PWM3_1), FM(SEL_PWM3_2), F_(0, 0)) #define MOD_SEL0_9 FM(SEL_PWM4_0) FM(SEL_PWM4_1) #define MOD_SEL0_8 FM(SEL_PWM5_0) FM(SEL_PWM5_1) #define MOD_SEL0_7 FM(SEL_PWM6_0) FM(SEL_PWM6_1) -#define MOD_SEL0_6_5 FM(SEL_REMOCON_0) FM(SEL_REMOCON_1) FM(SEL_REMOCON_2) F_(0, 0) +#define MOD_SEL0_6_5 REV4(FM(SEL_REMOCON_0), FM(SEL_REMOCON_1), FM(SEL_REMOCON_2), F_(0, 0)) #define MOD_SEL0_4 FM(SEL_SCIF_0) FM(SEL_SCIF_1) #define MOD_SEL0_3 FM(SEL_SCIF0_0) FM(SEL_SCIF0_1) #define MOD_SEL0_2 FM(SEL_SCIF2_0) FM(SEL_SCIF2_1) -#define MOD_SEL0_1_0 FM(SEL_SPEED_PULSE_IF_0) FM(SEL_SPEED_PULSE_IF_1) FM(SEL_SPEED_PULSE_IF_2) F_(0, 0) +#define MOD_SEL0_1_0 REV4(FM(SEL_SPEED_PULSE_IF_0), FM(SEL_SPEED_PULSE_IF_1), FM(SEL_SPEED_PULSE_IF_2), F_(0, 0)) /* MOD_SEL1 */ /* 0 */ /* 1 */ /* 2 */ /* 3 */ /* 4 */ /* 5 */ /* 6 */ /* 7 */ #define MOD_SEL1_31 FM(SEL_SIMCARD_0) FM(SEL_SIMCARD_1)
@@ -422,18 +426,18 @@ FM(IP12_31_28) IP12_31_28 FM(IP13_31_28) IP13_31_28 FM(IP14_31_28) IP14_31_28 FM#define MOD_SEL1_28 FM(SEL_USB_20_CH0_0) FM(SEL_USB_20_CH0_1)#define MOD_SEL1_26 FM(SEL_DRIF2_0) FM(SEL_DRIF2_1)#define MOD_SEL1_25 FM(SEL_DRIF3_0) FM(SEL_DRIF3_1) -#define MOD_SEL1_24_23_22 FM(SEL_HSCIF3_0) FM(SEL_HSCIF3_1) FM(SEL_HSCIF3_2) FM(SEL_HSCIF3_3) FM(SEL_HSCIF3_4) F_(0, 0) F_(0, 0) F_(0, 0) -#define MOD_SEL1_21_20_19 FM(SEL_HSCIF4_0) FM(SEL_HSCIF4_1) FM(SEL_HSCIF4_2) FM(SEL_HSCIF4_3) FM(SEL_HSCIF4_4) F_(0, 0) F_(0, 0) F_(0, 0) +#define MOD_SEL1_24_23_22 REV8(FM(SEL_HSCIF3_0), FM(SEL_HSCIF3_1), FM(SEL_HSCIF3_2), FM(SEL_HSCIF3_3), FM(SEL_HSCIF3_4), F_(0, 0), F_(0, 0), F_(0, 0)) +#define MOD_SEL1_21_20_19 REV8(FM(SEL_HSCIF4_0), FM(SEL_HSCIF4_1), FM(SEL_HSCIF4_2), FM(SEL_HSCIF4_3), FM(SEL_HSCIF4_4), F_(0, 0), F_(0, 0), F_(0, 0))#define MOD_SEL1_18 FM(SEL_I2C6_0) FM(SEL_I2C6_1)#define MOD_SEL1_17 FM(SEL_I2C7_0) FM(SEL_I2C7_1)#define MOD_SEL1_16 FM(SEL_MSIOF2_0) FM(SEL_MSIOF2_1)#define MOD_SEL1_15 FM(SEL_MSIOF3_0) FM(SEL_MSIOF3_1) -#define MOD_SEL1_14_13 FM(SEL_SCIF3_0) FM(SEL_SCIF3_1) FM(SEL_SCIF3_2) F_(0, 0) -#define MOD_SEL1_12_11 FM(SEL_SCIF4_0) FM(SEL_SCIF4_1) FM(SEL_SCIF4_2) F_(0, 0) -#define MOD_SEL1_10_9 FM(SEL_SCIF5_0) FM(SEL_SCIF5_1) FM(SEL_SCIF5_2) F_(0, 0) +#define MOD_SEL1_14_13 REV4(FM(SEL_SCIF3_0), FM(SEL_SCIF3_1), FM(SEL_SCIF3_2), F_(0, 0)) +#define MOD_SEL1_12_11 REV4(FM(SEL_SCIF4_0), FM(SEL_SCIF4_1), FM(SEL_SCIF4_2), F_(0, 0)) +#define MOD_SEL1_10_9 REV4(FM(SEL_SCIF5_0), FM(SEL_SCIF5_1), FM(SEL_SCIF5_2), F_(0, 0))#define MOD_SEL1_8 FM(SEL_VIN4_0) FM(SEL_VIN4_1)#define MOD_SEL1_7 FM(SEL_VIN5_0) FM(SEL_VIN5_1) -#define MOD_SEL1_6_5 FM(SEL_ADGC_0) FM(SEL_ADGC_1) FM(SEL_ADGC_2) F_(0, 0) +#define MOD_SEL1_6_5 REV4(FM(SEL_ADGC_0), FM(SEL_ADGC_1), FM(SEL_ADGC_2), F_(0, 0))#define MOD_SEL1_4 FM(SEL_SSI9_0) FM(SEL_SSI9_1)#define PINMUX_MOD_SELS \
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 213/246 pinctrl: sh-pfc: r8a77995: Fix MOD_SEL bit numbering
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 5219aa33caec2f7b68eda2b7e4ab8e276f323254 ]
MOD_SEL register bit numbering was different from R-Car D3 SoC and R-Car H3/M3-[WN] SoCs.
MOD_SEL 1-bit H3/M3-[WN] D3 =============== ========== ===== Set Value = H'0 b'0 b'0 Set Value = H'1 b'1 b'1
MOD_SEL 2-bits H3/M3-[WN] D3 =============== ========== ===== Set Value = H'0 b'00 b'00 Set Value = H'1 b'01 b'10 Set Value = H'2 b'10 b'01 Set Value = H'3 b'11 b'11
MOD_SEL 3-bits H3/M3-[WN] D3 =============== ========== ===== Set Value = H'0 b'000 b'000 Set Value = H'1 b'001 b'100 Set Value = H'2 b'010 b'010 Set Value = H'3 b'011 b'110 Set Value = H'4 b'100 b'001 Set Value = H'5 b'101 b'101 Set Value = H'6 b'110 b'011 Set Value = H'7 b'111 b'111
This patch replaces the #define name and value of MOD_SEL.
--- drivers/pinctrl/sh-pfc/pfc-r8a77995.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/pinctrl/sh-pfc/pfc-r8a77995.c +7 -4
@@ -381,6 +381,9 @@ FM(IP12_23_20) IP12_23_20 \ FM(IP12_27_24) IP12_27_24 \ FM(IP12_31_28) IP12_31_28 \ +/* The bit numbering in MOD_SEL fields is reversed */ +#define REV4(f0, f1, f2, f3) f0 f2 f1 f3 + /* MOD_SEL0 */ /* 0 */ /* 1 */ /* 2 */ /* 3 */ #define MOD_SEL0_30 FM(SEL_MSIOF2_0) FM(SEL_MSIOF2_1) #define MOD_SEL0_29 FM(SEL_I2C3_0) FM(SEL_I2C3_1)
@@ -388,10 +391,10 @@ FM(IP12_31_28) IP12_31_28 \#define MOD_SEL0_27 FM(SEL_MSIOF3_0) FM(SEL_MSIOF3_1)#define MOD_SEL0_26 FM(SEL_HSCIF3_0) FM(SEL_HSCIF3_1)#define MOD_SEL0_25 FM(SEL_SCIF4_0) FM(SEL_SCIF4_1) -#define MOD_SEL0_24_23 FM(SEL_PWM0_0) FM(SEL_PWM0_1) FM(SEL_PWM0_2) F_(0, 0) -#define MOD_SEL0_22_21 FM(SEL_PWM1_0) FM(SEL_PWM1_1) FM(SEL_PWM1_2) F_(0, 0) -#define MOD_SEL0_20_19 FM(SEL_PWM2_0) FM(SEL_PWM2_1) FM(SEL_PWM2_2) F_(0, 0) -#define MOD_SEL0_18_17 FM(SEL_PWM3_0) FM(SEL_PWM3_1) FM(SEL_PWM3_2) F_(0, 0) +#define MOD_SEL0_24_23 REV4(FM(SEL_PWM0_0), FM(SEL_PWM0_1), FM(SEL_PWM0_2), F_(0, 0)) +#define MOD_SEL0_22_21 REV4(FM(SEL_PWM1_0), FM(SEL_PWM1_1), FM(SEL_PWM1_2), F_(0, 0)) +#define MOD_SEL0_20_19 REV4(FM(SEL_PWM2_0), FM(SEL_PWM2_1), FM(SEL_PWM2_2), F_(0, 0)) +#define MOD_SEL0_18_17 REV4(FM(SEL_PWM3_0), FM(SEL_PWM3_1), FM(SEL_PWM3_2), F_(0, 0))#define MOD_SEL0_15 FM(SEL_IRQ_0_0) FM(SEL_IRQ_0_1)#define MOD_SEL0_14 FM(SEL_IRQ_1_0) FM(SEL_IRQ_1_1)#define MOD_SEL0_13 FM(SEL_IRQ_2_0) FM(SEL_IRQ_2_1)
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 214/246 cpu/hotplug: Mute hotplug lockdep during init
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit ce48c457b95316b9a01b5aa9d4456ce820df94b4 ]
Since we've had:
commit cb538267ea1e ("jump_label/lockdep: Assert we hold the hotplug lock for _cpuslocked() operations")
we've been getting some lockdep warnings during init, such as on HiKey960:
[ 0.820495] WARNING: CPU: 4 PID: 0 at kernel/cpu.c:316 lockdep_assert_cpus_held+0x3c/0x48 [ 0.820498] Modules linked in: [ 0.820509] CPU: 4 PID: 0 Comm: swapper/4 Tainted: G S 4.20.0-rc5-00051-g4cae42a #34 [ 0.820511] Hardware name: HiKey960 (DT) [ 0.820516] pstate: 600001c5 (nZCv dAIF -PAN -UAO) [ 0.820520] pc : lockdep_assert_cpus_held+0x3c/0x48 [ 0.820523] lr : lockdep_assert_cpus_held+0x38/0x48 [ 0.820526] sp : ffff00000a9cbe50 [ 0.820528] x29: ffff00000a9cbe50 x28: 0000000000000000 [ 0.820533] x27: 00008000b69e5000 x26: ffff8000bff4cfe0 [ 0.820537] x25: ffff000008ba69e0 x24: 0000000000000001 [ 0.820541] x23: ffff000008fce000 x22: ffff000008ba70c8 [ 0.820545] x21: 0000000000000001 x20: 0000000000000003 [ 0.820548] x19: ffff00000a35d628 x18: ffffffffffffffff [ 0.820552] x17: 0000000000000000 x16: 0000000000000000 [ 0.820556] x15: ffff00000958f848 x14: 455f3052464d4d34 [ 0.820559] x13: 00000000769dde98 x12: ffff8000bf3f65a8 [ 0.820564] x11: 0000000000000000 x10: ffff00000958f848 [ 0.820567] x9 : ffff000009592000 x8 : ffff00000958f848 [ 0.820571] x7 : ffff00000818ffa0 x6 : 0000000000000000 [ 0.820574] x5 : 0000000000000000 x4 : 0000000000000001 [ 0.820578] x3 : 0000000000000000 x2 : 0000000000000001 [ 0.820582] x1 : 00000000ffffffff x0 : 0000000000000000 [ 0.820587] Call trace: [ 0.820591] lockdep_assert_cpus_held+0x3c/0x48 [ 0.820598] static_key_enable_cpuslocked+0x28/0xd0 [ 0.820606] arch_timer_check_ool_workaround+0xe8/0x228 [ 0.820610] arch_timer_starting_cpu+0xe4/0x2d8 [ 0.820615] cpuhp_invoke_callback+0xe8/0xd08 [ 0.820619] notify_cpu_starting+0x80/0xb8 [ 0.820625] secondary_start_kernel+0x118/0x1d0
We've also had a similar warning in sched_init_smp() for every asymmetric system that would enable the sched_asym_cpucapacity static key, although that was singled out in:
commit 40fa3780bac2 ("sched/core: Take the hotplug lock in sched_init_smp()")
Those warnings are actually harmless, since we cannot have hotplug operations at the time they appear. Instead of starting to sprinkle useless hotplug lock operations in the init codepaths, mute the warnings until they start warning about real problems.
--- kernel/cpu.c | 9 +++++++++ 1 file changed, 9 insertions(+)
kernel/cpu.c +9 -0
@@ -313,6 +313,15 @@ void cpus_write_unlock(void)void lockdep_assert_cpus_held (void ) { +/* +* We can't have hotplug operations before userspace starts running, +* and some init codepaths will knowingly not take the hotplug lock. +* This is all valid, so mute lockdep until it makes sense to report +* unheld locks. +*/ +if (system_state <SYSTEM_RUNNING ) +return ; +percpu_rwsem_assert_held (&cpu_hotplug_lock); }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 215/246 dmaengine: imx-dma: fix warning comparison of distinct pointer types
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 9227ab5643cb8350449502dd9e3168a873ab0e3b ]
The warning got introduced by commit 930507c18304 ("arm64: add basic Kconfig symbols for i.MX8"). Since it got enabled for arm64. The warning haven't been seen before since size_t was 'unsigned int' when built on arm32.
../drivers/dma/imx-dma.c: In function ‘imxdma_sg_next’:../include/linux/kernel.h:846:29: warning: comparison of distinct pointer types lacks a cast
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
^~
../include/linux/kernel.h:860:4: note: in expansion of macro ‘__typecheck’
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~
../include/linux/kernel.h:870:24: note: in expansion of macro ‘__safe_cmp’
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~
../include/linux/kernel.h:879:19: note: in expansion of macro ‘__careful_cmp’
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~
../drivers/dma/imx-dma.c:288:8: note: in expansion of macro ‘min’
now = min(d->len, sg_dma_len(sg));
^~~Rework so that we use min_t and pass in the size_t that returns the minimum of two values, using the specified type.
--- drivers/dma/imx-dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/imx-dma.c +1 -1
@@ -285,7 +285,7 @@ static inline int imxdma_sg_next(struct imxdma_desc *d)struct scatterlist *sg = d->sg;unsigned long now; - now =min (d->len,sg_dma_len (sg)); + now =min_t (size_t, d->len,sg_dma_len (sg));if (d->len !=IMX_DMA_LENGTH_LOOP ) d->len -= now;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 216/246 dmaengine: qcom_hidma: assign channel cookie correctly
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 546c0547555efca8ba8c120716c325435e29df1b ]
When dma_cookie_complete() is called in hidma_process_completed(), dma_cookie_status() will return DMA_COMPLETE in hidma_tx_status(). Then, hidma_txn_is_success() will be called to use channel cookie mchan->last_success to do additional DMA status check. Current code assigns mchan->last_success after dma_cookie_complete(). This causes a race condition of dma_cookie_status() returns DMA_COMPLETE before mchan->last_success is assigned correctly. The race will cause hidma_tx_status() return DMA_ERROR but the transaction is actually a success. Moreover, in async_tx case, it will cause a timeout panic in async_tx_quiesce().
Kernel panic - not syncing: async_tx_quiesce: DMA error waiting for transaction ... Call trace: [<ffff000008089994>] dump_backtrace+0x0/0x1f4 [<ffff000008089bac>] show_stack+0x24/0x2c [<ffff00000891e198>] dump_stack+0x84/0xa8 [<ffff0000080da544>] panic+0x12c/0x29c [<ffff0000045d0334>] async_tx_quiesce+0xa4/0xc8 [async_tx] [<ffff0000045d03c8>] async_trigger_callback+0x70/0x1c0 [async_tx] [<ffff0000048b7d74>] raid_run_ops+0x86c/0x1540 [raid456] [<ffff0000048bd084>] handle_stripe+0x5e8/0x1c7c [raid456] [<ffff0000048be9ec>] handle_active_stripes.isra.45+0x2d4/0x550 [raid456] [<ffff0000048beff4>] raid5d+0x38c/0x5d0 [raid456] [<ffff000008736538>] md_thread+0x108/0x168 [<ffff0000080fb1cc>] kthread+0x10c/0x138 [<ffff000008084d34>] ret_from_fork+0x10/0x18
--- drivers/dma/qcom/hidma.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/dma/qcom/hidma.c +9 -8
@@ -138,24 +138,25 @@ static void hidma_process_completed(struct hidma_chan *mchan) desc = &mdesc->desc; last_cookie = desc->cookie; + llstat =hidma_ll_status (mdma->lldev, mdesc->tre_ch); +spin_lock_irqsave (&mchan->lock, irqflags); +if (llstat ==DMA_COMPLETE ) { + mchan->last_success = last_cookie; + result.result =DMA_TRANS_NOERROR ; + }else { + result.result =DMA_TRANS_ABORTED ; + } +dma_cookie_complete (desc);spin_unlock_irqrestore (&mchan->lock, irqflags); - llstat =hidma_ll_status (mdma->lldev, mdesc->tre_ch);dmaengine_desc_get_callback (desc, &cb);dma_run_dependencies (desc);spin_lock_irqsave (&mchan->lock, irqflags);list_move (&mdesc->node, &mchan->free); - -if (llstat ==DMA_COMPLETE ) { - mchan->last_success = last_cookie; - result.result =DMA_TRANS_NOERROR ; - }else - result.result =DMA_TRANS_ABORTED ; -spin_unlock_irqrestore (&mchan->lock, irqflags);dmaengine_desc_callback_invoke (&cb, &result);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 217/246 dmaengine: qcom_hidma: initialize tx flags in hidma_prep_dma_*
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 875aac8a46424e5b73a9ff7f40b83311b609e407 ]
In async_tx_test_ack(), it uses flags in struct dma_async_tx_descriptor to check the ACK status. As hidma reuses the descriptor in a free list when hidma_prep_dma_*(memcpy/memset) is called, the flag will keep ACKed if the descriptor has been used before. This will cause a BUG_ON in async_tx_quiesce().
kernel BUG at crypto/async_tx/async_tx.c:282!
Internal error: Oops - BUG: 0 1 SMP ... task: ffff8017dd3ec000 task.stack: ffff8017dd3e8000 PC is at async_tx_quiesce+0x54/0x78 [async_tx] LR is at async_trigger_callback+0x98/0x110 [async_tx]
This patch initializes flags in dma_async_tx_descriptor by the flags passed from the caller when hidma_prep_dma_*(memcpy/memset) is called.
--- drivers/dma/qcom/hidma.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/dma/qcom/hidma.c +2 -0
@@ -416,6 +416,7 @@ hidma_prep_dma_memcpy(struct dma_chan *dmach, dma_addr_t dest, dma_addr_t src,if (!mdesc)return NULL ; + mdesc->desc.flags = flags;hidma_ll_set_transfer_params (mdma->lldev, mdesc->tre_ch, src, dest, len, flags,HIDMA_TRE_MEMCPY );
@@ -448,6 +449,7 @@ hidma_prep_dma_memset(struct dma_chan *dmach, dma_addr_t dest, int value,if (!mdesc)return NULL ; + mdesc->desc.flags = flags;hidma_ll_set_transfer_params (mdma->lldev, mdesc->tre_ch, value, dest, len, flags,HIDMA_TRE_MEMSET );
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 218/246 netfilter: physdev: relax br_netfilter dependency
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 8e2f311a68494a6677c1724bdcb10bada21af37c ]
Following command:
iptables -D FORWARD -m physdev ...
causes connectivity loss in some setups.
Reason is that iptables userspace will probe kernel for the module revision of the physdev patch, and physdev has an artificial dependency on br_netfilter (xt_physdev use makes no sense unless a br_netfilter module is loaded).
This causes the "phydev" module to be loaded, which in turn enables the "call-iptables" infrastructure.
bridged packets might then get dropped by the iptables ruleset.
The better fix would be to change the "call-iptables" defaults to 0 and enforce explicit setting to 1, but that breaks backwards compatibility.
This does the next best thing: add a request_module call to checkentry. This was a stray '-D ... -m physdev' won't activate br_netfilter anymore.
--- include/net/netfilter/br_netfilter.h | 1 - net/bridge/br_netfilter_hooks.c | 5 ----- net/netfilter/xt_physdev.c | 9 +++++++-- 3 files changed, 7 insertions(+), 8 deletions(-)
include/net/netfilter/br_netfilter.h +0 -1
@@ -43,7 +43,6 @@ static inline struct rtable *bridge_parent_rtable(const struct net_device *dev) }struct net_device *setup_pre_routing (struct sk_buff *skb); -void br_netfilter_enable (void );#if IS_ENABLED (CONFIG_IPV6 )int br_validate_ipv6 (struct net *net,struct sk_buff *skb);
net/bridge/br_netfilter_hooks.c +0 -5
@@ -881,11 +881,6 @@ static const struct nf_br_ops br_ops = { .br_dev_xmit_hook = br_nf_dev_xmit, }; -void br_netfilter_enable (void ) -{ -} -EXPORT_SYMBOL_GPL (br_netfilter_enable); -/* For br_nf_post_routing, we need (prio = NF_BR_PRI_LAST), because * br_dev_queue_push_xmit is called afterwards */ static const struct nf_hook_ops br_nf_ops[] = {
net/netfilter/xt_physdev.c +7 -2
@@ -96,8 +96,7 @@ match_outdev:static int physdev_mt_check (const struct xt_mtchk_param *par) {const struct xt_physdev_info *info = par->matchinfo; - -br_netfilter_enable (); +static bool brnf_probed__read_mostly ;if (!(info->bitmask &XT_PHYSDEV_OP_MASK ) || info->bitmask & ~XT_PHYSDEV_OP_MASK )
@@ -111,6 +110,12 @@ static int physdev_mt_check(const struct xt_mtchk_param *par)if (par->hook_mask & (1 <<NF_INET_LOCAL_OUT ))return -EINVAL ; } + +if (!brnf_probed) { + brnf_probed = true; +request_module ("br_netfilter" ); + } +return 0 ; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 219/246 media: rcar-vin: Allow independent VIN link enablement
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit c5ff0edb8e2270a75935c73217fb0de1abd2d910 ]
There is a block of code in rvin_group_link_notify() that prevents enabling a link to a VIN node if any entity in the media graph is in use. This prevents enabling a VIN link even if there is an in-use entity somewhere in the graph that is independent of the link's pipeline.
For example, the code block will prevent enabling a link from the first rcar-csi2 receiver to a VIN node even if there is an enabled link somewhere far upstream on the second independent rcar-csi2 receiver pipeline.
If this code block is meant to prevent modifying a link if any entity in the graph is actively involved in streaming (because modifying the CHSEL register fields can disrupt any/all running streams), then the entities stream counts should be checked rather than the use counts.
(There is already such a check in __media_entity_setup_link() that verifies the stream_count of the link's source and sink entities are both zero, but that is insufficient, since there should be no running streams in the entire graph).
Modify the code block to check the entity stream_count instead of the use_count (and elaborate on the comment). VIN node links can now be enabled even if there are other independent in-use entities that are not streaming.
--- drivers/media/platform/rcar-vin/rcar-core.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/media/platform/rcar-vin/rcar-core.c +6 -2
@@ -131,9 +131,13 @@ static int rvin_group_link_notify(struct media_link *link, u32 flags, !is_media_entity_v4l2_video_device(link->sink->entity))return 0 ; -/* If any entity is in use don't allow link changes. */ +/* +* Don't allow link changes if any entity in the graph is +* streaming, modifying the CHSEL register fields can disrupt +* running streams. +*/ media_device_for_each_entity (entity, &group->mdev) -if (entity->use_count) +if (entity->stream_count)return -EBUSY ;mutex_lock (&group->lock);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 220/246 media: s5p-jpeg: Check for fmt_ver_flag when doing fmt enumeration
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 49710c32cd9d6626a77c9f5f978a5f58cb536b35 ]
Previously when doing format enumeration, it was returning all
formats supported by driver, even if they're not supported by hw.
Add missing check for fmt_ver_flag, so it'll be fixed and only those
supported by hw will be returned. Similar thing is already done in s5p_jpeg_find_format.
It was found by using v4l2-compliance tool and checking result
of VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS test
and using v4l2-ctl to get list of all supported formats.
Tested on s5pv210-galaxys (Samsung i9000 phone).
--- drivers/media/platform/s5p-jpeg/jpeg-core.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/media/platform/s5p-jpeg/jpeg-core.c +11 -8
@@ -1293,13 +1293,16 @@ static int s5p_jpeg_querycap(struct file *file, void *priv,return 0 ; } -static int enum_fmt (struct s5p_jpeg_fmt *sjpeg_formats,int n, +static int enum_fmt (struct s5p_jpeg_ctx *ctx, +struct s5p_jpeg_fmt *sjpeg_formats,int n,struct v4l2_fmtdesc *f,u32 type) {int i, num =0 ; +unsigned int fmt_ver_flag = ctx->jpeg->variant->fmt_ver_flag;for (i =0 ; i < n; ++i) { -if (sjpeg_formats[i].flags & type) { +if (sjpeg_formats[i].flags & type && + sjpeg_formats[i].flags & fmt_ver_flag) {/* index-th format of type type found ? */ if (num == f->index)break ;
@@ -1326,11 +1329,11 @@ static int s5p_jpeg_enum_fmt_vid_cap(struct file *file, void *priv,struct s5p_jpeg_ctx *ctx =fh_to_ctx (priv);if (ctx->mode ==S5P_JPEG_ENCODE ) -return enum_fmt (sjpeg_formats,SJPEG_NUM_FORMATS , f, +return enum_fmt (ctx, sjpeg_formats,SJPEG_NUM_FORMATS , f,SJPEG_FMT_FLAG_ENC_CAPTURE ); -return enum_fmt (sjpeg_formats,SJPEG_NUM_FORMATS , f, -SJPEG_FMT_FLAG_DEC_CAPTURE ); +return enum_fmt (ctx, sjpeg_formats,SJPEG_NUM_FORMATS , f, +SJPEG_FMT_FLAG_DEC_CAPTURE ); } static int s5p_jpeg_enum_fmt_vid_out(struct file *file, void *priv,
@@ -1339,11 +1342,11 @@ static int s5p_jpeg_enum_fmt_vid_out(struct file *file, void *priv,struct s5p_jpeg_ctx *ctx =fh_to_ctx (priv);if (ctx->mode ==S5P_JPEG_ENCODE ) -return enum_fmt (sjpeg_formats,SJPEG_NUM_FORMATS , f, +return enum_fmt (ctx, sjpeg_formats,SJPEG_NUM_FORMATS , f,SJPEG_FMT_FLAG_ENC_OUTPUT ); -return enum_fmt (sjpeg_formats,SJPEG_NUM_FORMATS , f, -SJPEG_FMT_FLAG_DEC_OUTPUT ); +return enum_fmt (ctx, sjpeg_formats,SJPEG_NUM_FORMATS , f, +SJPEG_FMT_FLAG_DEC_OUTPUT ); } static struct s5p_jpeg_q_data *get_q_data(struct s5p_jpeg_ctx *ctx,
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 221/246 PCI: pciehp: Assign ctrl->slot_ctrl before writing it to hardware
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 25bd879ec16ad3b83a5b1c3f16faa55e696bfccb ]
Shameerali reported that running v4.20-rc1 as QEMU guest, the PCIe hotplug port times out during boot:
pciehp 0000:00:01.0:pcie004: Timeout on hotplug command 0x03f1 (issued 1016 msec ago) pciehp 0000:00:01.0:pcie004: Timeout on hotplug command 0x03f1 (issued 1024 msec ago) pciehp 0000:00:01.0:pcie004: Failed to check link status
pciehp 0000:00:01.0:pcie004: Timeout on hotplug command 0x02f1 (issued 2520 msec ago)
The issue was bisected down to commit 720d6a671a6e ("PCI: pciehp: Do not handle events if interrupts are masked") and was further analyzed by the reporter to be caused by the fact that pciehp first updates the hardware and only then cache the ctrl->slot_ctrl in pcie_do_write_cmd(). If the interrupt happens before we cache the value, pciehp_isr() reads value 0 and decides that the interrupt was not meant for it causing the above timeout to trigger.
Fix by moving ctrl->slot_ctrl assignment to happen before it is written to the hardware.
--- drivers/pci/hotplug/pciehp_hpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/hotplug/pciehp_hpc.c +1 -1
@@ -156,9 +156,9 @@ static void pcie_do_write_cmd(struct controller *ctrl, u16 cmd, slot_ctrl |= (cmd & mask); ctrl->cmd_busy =1 ;smp_mb (); + ctrl->slot_ctrl = slot_ctrl;pcie_capability_write_word (pdev,PCI_EXP_SLTCTL , slot_ctrl); ctrl->cmd_started = jiffies; - ctrl->slot_ctrl = slot_ctrl;/* * Controllers with the Intel CF118 and similar errata advertise
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 222/246 audit: hand taken context to audit_kill_trees for syscall logging
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 9e36a5d49c3a6fc4a2e0ba2dc11b27c4a8ae6303 ]
Since the context is derived from the task parameter handed to __audit_free(), hand the context to audit_kill_trees() so it can be used to associate with a syscall record. This requires adding the context parameter to kill_rules() rather than using the current audit_context.
The callers of trim_marked() and evict_chunk() still have their context.
The EOE record was being issued prior to the pruning of the killed_tree list.
Move the kill_trees call before the audit_log_exit call in __audit_free() and __audit_syscall_exit() so that any pruned trees CONFIG_CHANGE records are included with the associated syscall event by the user library due to the EOE record flagging the end of the event.
See: https://github.com/linux-audit/audit-kernel/issues/50
See: https://github.com/linux-audit/audit-kernel/issues/59
--- kernel/audit.h | 4 ++-- kernel/audit_tree.c | 19 +++++++++++-------- kernel/auditsc.c | 12 ++++++------ 3 files changed, 19 insertions(+), 16 deletions(-)
kernel/audit.h +2 -2
@@ -314,7 +314,7 @@ extern void audit_trim_trees(void);extern int audit_tag_tree (char *old,char *new);extern const char *audit_tree_path (struct audit_tree *tree);extern void audit_put_tree (struct audit_tree *tree); -extern void audit_kill_trees (struct list_head *list); +extern void audit_kill_trees (struct audit_context *context);#else #define audit_remove_tree_rule (rule) BUG()#define audit_add_tree_rule (rule) -EINVAL
@@ -323,7 +323,7 @@ extern void audit_kill_trees(struct list_head *list);#define audit_put_tree (tree) (void)0#define audit_tag_tree (old, new) -EINVAL#define audit_tree_path (rule) ""/* never called */ -#define audit_kill_trees (list) BUG() +#define audit_kill_trees (context) BUG()#endif extern char *audit_unpack_string (void **bufp,size_t *remain,size_t len);
kernel/audit_tree.c +11 -8
@@ -524,13 +524,14 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)return 0 ; } -static void audit_tree_log_remove_rule (struct audit_krule *rule) +static void audit_tree_log_remove_rule (struct audit_context *context, +struct audit_krule *rule) {struct audit_buffer *ab;if (!audit_enabled)return ; - ab =audit_log_start (NULL ,GFP_KERNEL ,AUDIT_CONFIG_CHANGE ); + ab =audit_log_start (context,GFP_KERNEL ,AUDIT_CONFIG_CHANGE );if (unlikely (!ab))return ;audit_log_format (ab,"op=remove_rule dir=" );
@@ -540,7 +541,7 @@ static void audit_tree_log_remove_rule(struct audit_krule *rule)audit_log_end (ab); } -static void kill_rules (struct audit_tree *tree) +static void kill_rules (struct audit_context *context,struct audit_tree *tree) {struct audit_krule *rule, *next;struct audit_entry *entry;
@@ -551,7 +552,7 @@ static void kill_rules(struct audit_tree *tree)list_del_init (&rule->rlist);if (rule->tree) {/* not a half-baked one */ -audit_tree_log_remove_rule (rule); +audit_tree_log_remove_rule (context, rule);if (entry->rule.exe)audit_remove_mark (entry->rule.exe); rule->tree =NULL ;
@@ -633,7 +634,7 @@ static void trim_marked(struct audit_tree *tree) tree->goner =1 ;spin_unlock (&hash_lock);mutex_lock (&audit_filter_mutex); -kill_rules (tree); +kill_rules (audit_context (), tree);list_del_init (&tree->list);mutex_unlock (&audit_filter_mutex);prune_one (tree);
@@ -973,8 +974,10 @@ static void audit_schedule_prune(void)* ... and that one is done if evict_chunk() decides to delay until the end * of syscall. Runs synchronously. */ -void audit_kill_trees (struct list_head *list) +void audit_kill_trees (struct audit_context *context) { +struct list_head *list = &context->killed_trees; +audit_ctl_lock ();mutex_lock (&audit_filter_mutex);
@@ -982,7 +985,7 @@ void audit_kill_trees(struct list_head *list)struct audit_tree *victim; victim = list_entry(list->next, struct audit_tree, list); -kill_rules (victim); +kill_rules (context, victim);list_del_init (&victim->list);mutex_unlock (&audit_filter_mutex);
@@ -1017,7 +1020,7 @@ static void evict_chunk(struct audit_chunk *chunk)list_del_init (&owner->same_root);spin_unlock (&hash_lock);if (!postponed) { -kill_rules (owner); +kill_rules (audit_context (), owner);list_move (&owner->list, &prune_list); need_prune =1 ; }else {
kernel/auditsc.c +6 -6
@@ -1444,6 +1444,9 @@ void __audit_free(struct task_struct *tsk)if (!context)return ; +if (!list_empty (&context->killed_trees)) +audit_kill_trees (context); +/* We are called either by do_exit() or the fork() error handling code; * in the former case tsk == current and in the latter tsk is a * random task_struct that doesn't doesn't have any meaningful data we
@@ -1460,9 +1463,6 @@ void __audit_free(struct task_struct *tsk)audit_log_exit (); } -if (!list_empty (&context->killed_trees)) -audit_kill_trees (&context->killed_trees); -audit_set_context (tsk,NULL );audit_free_context (context); }
@@ -1537,6 +1537,9 @@ void __audit_syscall_exit(int success, long return_code)if (!context)return ; +if (!list_empty (&context->killed_trees)) +audit_kill_trees (context); +if (!context->dummy && context->in_syscall) {if (success) context->return_valid =AUDITSC_SUCCESS ;
@@ -1571,9 +1574,6 @@ void __audit_syscall_exit(int success, long return_code) context->in_syscall =0 ; context->prio = context->state ==AUDIT_RECORD_CONTEXT ? ~0ULL :0 ; -if (!list_empty (&context->killed_trees)) -audit_kill_trees (&context->killed_trees); -audit_free_names (context);unroll_tree_refs (context,NULL ,0 );audit_free_aux (context);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 223/246 regulator: act8865: Fix act8600_sudcdc_voltage_ranges setting
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit f01a7beb6791f1c419424c1a6958b7d0a289c974 ]
The act8600_sudcdc_voltage_ranges setting does not match the datasheet.
The problems in below entry:
REGULATOR_LINEAR_RANGE(19000000, 191, 255, 400000),
1. The off-by-one min_sel causes wrong volatage calculation. The min_sel should be 192.
2. According to the datasheet[1] Table 7. (on page 43):
The selector 248 (0b11111000) ~ 255 (0b11111111) are 41.400V.
Also fix off-by-one for ACT8600_SUDCDC_VOLTAGE_NUM.
[1] https://active-semi.com/wp-content/uploads/ACT8600_Datasheet.pdf
--- drivers/regulator/act8865-regulator.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/regulator/act8865-regulator.c +3 -2
@@ -131,7 +131,7 @@* ACT8865 voltage number */ #define ACT8865_VOLTAGE_NUM 64 -#define ACT8600_SUDCDC_VOLTAGE_NUM 255 +#define ACT8600_SUDCDC_VOLTAGE_NUM 256struct act8865 {struct regmap *regmap;
@@ -222,7 +222,8 @@ static const struct regulator_linear_range act8600_sudcdc_voltage_ranges[] = {REGULATOR_LINEAR_RANGE (3000000 ,0 ,63 ,0 ),REGULATOR_LINEAR_RANGE (3000000 ,64 ,159 ,100000 ),REGULATOR_LINEAR_RANGE (12600000 ,160 ,191 ,200000 ), - REGULATOR_LINEAR_RANGE(19000000, 191, 255, 400000), +REGULATOR_LINEAR_RANGE (19000000 ,192 ,247 ,400000 ), + REGULATOR_LINEAR_RANGE(41400000, 248, 255, 0), }; static struct regulator_ops act8865_ops = {
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 224/246 pinctrl: meson: meson8b: add the eth_rxd2 and eth_rxd3 pins
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 6daae00243e622dd3feec7965bfe421ad6dd317e ]
Gigabit Ethernet requires the Ethernet TXD0..3 and RXD0..3 data lines. Add the missing eth_rxd2 and eth_rxd3 definitions so we don't have to rely on the bootloader to set them up correctly.
The vendor u-boot sources for Odroid-C1 use the following Ethernet pinmux configuration:
SET_CBUS_REG_MASK(PERIPHS_PIN_MUX_6, 0x3f4f); SET_CBUS_REG_MASK(PERIPHS_PIN_MUX_7, 0xf00000);
This translates to the following pin groups in the mainline kernel:
- register 6 bit 0: eth_rxd1 (DIF_0_P) - register 6 bit 1: eth_rxd0 (DIF_0_N) - register 6 bit 2: eth_rx_dv (DIF_1_P) - register 6 bit 3: eth_rx_clk (DIF_1_N) - register 6 bit 6: eth_tx_en (DIF_3_P) - register 6 bit 8: eth_ref_clk (DIF_3_N) - register 6 bit 9: eth_mdc (DIF_4_P)
- register 6 bit 10: eth_mdio_en (DIF_4_N)
- register 6 bit 11: eth_tx_clk (GPIOH_9)
- register 6 bit 12: eth_txd2 (GPIOH_8)
- register 6 bit 13: eth_txd3 (GPIOH_7)
- register 7 bit 20: eth_txd0_0 (GPIOH_6)
- register 7 bit 21: eth_txd1_0 (GPIOH_5)
- register 7 bit 22: eth_rxd3 (DIF_2_P)
- register 7 bit 23: eth_rxd2 (DIF_2_N)
All functions except eth_rxd2 and eth_rxd3 are already supported by the pinctrl-meson8b driver.
--- drivers/pinctrl/meson/pinctrl-meson8b.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/pinctrl/meson/pinctrl-meson8b.c +5 -1
@@ -346,6 +346,8 @@ static const unsigned int eth_rx_dv_pins[] = { DIF_1_P };static const unsigned int eth_rx_clk_pins[] = {DIF_1_N };static const unsigned int eth_txd0_1_pins[] = {DIF_2_P };static const unsigned int eth_txd1_1_pins[] = {DIF_2_N }; +static const unsigned int eth_rxd3_pins[] = {DIF_2_P }; +static const unsigned int eth_rxd2_pins[] = {DIF_2_N };static const unsigned int eth_tx_en_pins[] = {DIF_3_P };static const unsigned int eth_ref_clk_pins[] = {DIF_3_N };static const unsigned int eth_mdc_pins[] = {DIF_4_P };
@@ -599,6 +601,8 @@ static struct meson_pmx_group meson8b_cbus_groups[] = {GROUP (eth_ref_clk,6 ,8 ),GROUP (eth_mdc,6 ,9 ),GROUP (eth_mdio_en,6 ,10 ), +GROUP (eth_rxd3,7 ,22 ), + GROUP(eth_rxd2, 7, 23), }; static struct meson_pmx_group meson8b_aobus_groups[] = {
@@ -748,7 +752,7 @@ static const char * const ethernet_groups[] = {"eth_tx_clk" ,"eth_tx_en" ,"eth_txd1_0" ,"eth_txd1_1" ,"eth_txd0_0" ,"eth_txd0_1" ,"eth_rx_clk" ,"eth_rx_dv" ,"eth_rxd1" ,"eth_rxd0" ,"eth_mdio_en" ,"eth_mdc" ,"eth_ref_clk" , -"eth_txd2" ,"eth_txd3" +"eth_txd2" ,"eth_txd3" ,"eth_rxd3" ,"eth_rxd2" }; static const char * const i2c_a_groups[] = {
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 225/246 drm: Auto-set allow_fb_modifiers when given modifiers at plane init
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 890880ddfdbe256083170866e49c87618b706ac7 ]
When drivers pass non-empty lists of modifiers for initializing their planes, we can infer that they allow framebuffer modifiers and set the driver's allow_fb_modifiers mode config element.
In case the allow_fb_modifiers element was not set (some drivers tend to set them after registering planes), the modifiers will still be registered but won't be available to userspace unless the flag is set later. However in that case, the IN_FORMATS blob won't be created.
In order to avoid this case and generally reduce the trouble associated with the flag, always set allow_fb_modifiers when a non-empty list of format modifiers is passed at plane init.
--- drivers/gpu/drm/drm_plane.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_plane.c +3 -0
@@ -220,6 +220,9 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, format_modifier_count++; } +if (format_modifier_count) + config->allow_fb_modifiers = true; + plane->modifier_count = format_modifier_count; plane->modifiers = kmalloc_array(format_modifier_count, sizeof(format_modifiers[0]),
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 226/246 drm/nouveau: Stop using drm_crtc_force_disable
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 934c5b32a5e43d8de2ab4f1566f91d7c3bf8cb64 ]
The correct way for legacy drivers to update properties that need to do a full modeset, is to do a full modeset.
Note that we don't need to call the drm_mode_config_internal helper because we're not changing any of the refcounted paramters.
v2: Fixup error handling (Ville). Since the old code didn't bother I decided to just delete it instead of adding even more code for just error handling.
--- drivers/gpu/drm/nouveau/dispnv04/tvnv17.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/dispnv04/tvnv17.c +3 -1
@@ -750,7 +750,9 @@ static int nv17_tv_set_property(struct drm_encoder *encoder,/* Disable the crtc to ensure a full modeset is * performed whenever it's turned on again. */ if (crtc) -drm_crtc_force_disable (crtc); +drm_crtc_helper_set_mode (crtc, &crtc->mode, + crtc->x, crtc->y, + crtc->primary->fb); }return 0 ;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 227/246 x86/build: Specify elf_i386 linker emulation explicitly for i386 objects
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 927185c124d62a9a4d35878d7f6d432a166b74e3 ]
The kernel uses the OUTPUT_FORMAT linker script command in it's linker scripts. Most of the time, the -m option is passed to the linker with correct architecture, but sometimes (at least for x86_64) the -m option contradicts the OUTPUT_FORMAT directive.
Specifically, arch/x86/boot and arch/x86/realmode/rm produce i386 object files, but are linked with the -m elf_x86_64 linker flag when building for x86_64.
The GNU linker manpage doesn't explicitly state any tie-breakers between -m and OUTPUT_FORMAT. But with BFD and Gold linkers, OUTPUT_FORMAT overrides the emulation value specified with the -m option.
LLVM lld has a different behavior, however. When supplied with contradicting -m and OUTPUT_FORMAT values it fails with the following error message:
ld.lld: error: arch/x86/realmode/rm/header.o is incompatible with elf_x86_64
Therefore, just add the correct -m after the incorrect one (it overrides it), so the linker invocation looks like this:
ld -m elf_x86_64 -z max-page-size=0x200000 -m elf_i386 --emit-relocs -T \
realmode.lds header.o trampoline_64.o stack.o reboot.o -o realmode.elfThis is not a functional change for GNU ld, because (although not explicitly documented) OUTPUT_FORMAT overrides -m EMULATION.
Tested by building x86_64 kernel with GNU gcc/ld toolchain and booting it in QEMU.
[ bp: massage and clarify text. ]
--- arch/x86/boot/Makefile | 2 +- arch/x86/realmode/rm/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/boot/Makefile +1 -1
@@ -100,7 +100,7 @@ $(obj)/zoffset.h: $(obj)/compressed/vmlinux FORCE AFLAGS_header.o += -I$(objtree)/$(obj) $(obj)/header.o: $(obj)/zoffset.h -LDFLAGS_setup.elf := -T +LDFLAGS_setup.elf := -m elf_i386 -T $(obj)/setup.elf: $(src)/setup.ld $(SETUP_OBJS) FORCE $(call if_changed,ld)
arch/x86/realmode/rm/Makefile +1 -1
@@ -47,7 +47,7 @@ $(obj)/pasyms.h: $(REALMODE_OBJS) FORCE targets += realmode.lds $(obj)/realmode.lds: $(obj)/pasyms.h -LDFLAGS_realmode.elf := --emit-relocs -T +LDFLAGS_realmode.elf := -m elf_i386 --emit-relocs -T CPPFLAGS_realmode.lds += -P -C -I$(objtree)/$(obj) targets += realmode.elf
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 228/246 selinux: do not override context on context mounts
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 53e0c2aa9a59a48e3798ef193d573ade85aa80f5 ]
Ignore all selinux_inode_notifysecctx() calls on mounts with SBLABEL_MNT flag unset. This is achived by returning -EOPNOTSUPP for this case in selinux_inode_setsecurtity() (because that function should not be called in such case anyway) and translating this error to 0 in selinux_inode_notifysecctx().
This fixes behavior of kernfs-based filesystems when mounted with the 'context=' option. Before this patch, if a node's context had been explicitly set to a non-default value and later the filesystem has been remounted with the 'context=' option, then this node would show up as having the manually-set context and not the mount-specified one.
Steps to reproduce:
# mount -t cgroup2 cgroup2 /sys/fs/cgroup/unified
# chcon unconfined_u:object_r:user_home_t:s0 /sys/fs/cgroup/unified/cgroup.stat
# ls -lZ /sys/fs/cgroup/unified
total 0
-r--r--r--. 1 root root system_u:object_r:cgroup_t:s0 0 Dec 13 10:41 cgroup.controllers
-rw-r--r--. 1 root root system_u:object_r:cgroup_t:s0 0 Dec 13 10:41 cgroup.max.depth
-rw-r--r--. 1 root root system_u:object_r:cgroup_t:s0 0 Dec 13 10:41 cgroup.max.descendants
-rw-r--r--. 1 root root system_u:object_r:cgroup_t:s0 0 Dec 13 10:41 cgroup.procs
-r--r--r--. 1 root root unconfined_u:object_r:user_home_t:s0 0 Dec 13 10:41 cgroup.stat
-rw-r--r--. 1 root root system_u:object_r:cgroup_t:s0 0 Dec 13 10:41 cgroup.subtree_control
-rw-r--r--. 1 root root system_u:object_r:cgroup_t:s0 0 Dec 13 10:41 cgroup.threads
# umount /sys/fs/cgroup/unified
# mount -o context=system_u:object_r:tmpfs_t:s0 -t cgroup2 cgroup2 /sys/fs/cgroup/unifiedResult before:
# ls -lZ /sys/fs/cgroup/unified
total 0
-r--r--r--. 1 root root system_u:object_r:tmpfs_t:s0 0 Dec 13 10:41 cgroup.controllers
-rw-r--r--. 1 root root system_u:object_r:tmpfs_t:s0 0 Dec 13 10:41 cgroup.max.depth
-rw-r--r--. 1 root root system_u:object_r:tmpfs_t:s0 0 Dec 13 10:41 cgroup.max.descendants
-rw-r--r--. 1 root root system_u:object_r:tmpfs_t:s0 0 Dec 13 10:41 cgroup.procs
-r--r--r--. 1 root root unconfined_u:object_r:user_home_t:s0 0 Dec 13 10:41 cgroup.stat
-rw-r--r--. 1 root root system_u:object_r:tmpfs_t:s0 0 Dec 13 10:41 cgroup.subtree_control
-rw-r--r--. 1 root root system_u:object_r:tmpfs_t:s0 0 Dec 13 10:41 cgroup.threadsResult after:
# ls -lZ /sys/fs/cgroup/unified
total 0
-r--r--r--. 1 root root system_u:object_r:tmpfs_t:s0 0 Dec 13 10:41 cgroup.controllers
-rw-r--r--. 1 root root system_u:object_r:tmpfs_t:s0 0 Dec 13 10:41 cgroup.max.depth
-rw-r--r--. 1 root root system_u:object_r:tmpfs_t:s0 0 Dec 13 10:41 cgroup.max.descendants
-rw-r--r--. 1 root root system_u:object_r:tmpfs_t:s0 0 Dec 13 10:41 cgroup.procs
-r--r--r--. 1 root root system_u:object_r:tmpfs_t:s0 0 Dec 13 10:41 cgroup.stat
-rw-r--r--. 1 root root system_u:object_r:tmpfs_t:s0 0 Dec 13 10:41 cgroup.subtree_control
-rw-r--r--. 1 root root system_u:object_r:tmpfs_t:s0 0 Dec 13 10:41 cgroup.threads--- security/selinux/hooks.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
security/selinux/hooks.c +8 -1
@@ -3244,12 +3244,16 @@ static int selinux_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags) { struct inode_security_struct *isec = inode_security_novalidate(inode); +struct superblock_security_struct *sbsec = inode->i_sb->s_security;u32 newsid;int rc;if (strcmp (name,XATTR_SELINUX_SUFFIX ))return -EOPNOTSUPP ; +if (!(sbsec->flags &SBLABEL_MNT )) +return -EOPNOTSUPP ; +if (!value || !size)return -EACCES ;
@@ -6398,7 +6402,10 @@ static void selinux_inode_invalidate_secctx(struct inode *inode)*/ static int selinux_inode_notifysecctx (struct inode *inode,void *ctx,u32 ctxlen) { -return selinux_inode_setsecurity (inode,XATTR_SELINUX_SUFFIX , ctx, ctxlen,0 ); +int rc =selinux_inode_setsecurity (inode,XATTR_SELINUX_SUFFIX , + ctx, ctxlen,0 ); +/* Do not return error when suppressing label (SBLABEL_MNT not set). */ +return rc == -EOPNOTSUPP ?0 : rc; }/*
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 229/246 brcmfmac: Use firmware_request_nowarn for the clm_blob
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 4ad0be160544ffbdafb7cec39bb8e6dd0a97317a ]
The linux-firmware brcmfmac firmware files contain an embedded table with per country allowed channels and strength info.
For recent hardware these versions of the firmware are specially build for linux-firmware, the firmware files directly available from Cypress rely on a separate clm_blob file for this info.
For some unknown reason Cypress refuses to provide the standard firmware files + clm_blob files it uses elsewhere for inclusion into linux-firmware, instead relying on these special builds with the clm_blob info embedded. This means that the linux-firmware firmware versions often lag behind, but I digress.
The brcmfmac driver does support the separate clm_blob file and always tries to load this. Currently we use request_firmware for this. This means that on any standard install, using the standard combo of linux-kernel + linux-firmware, we will get a warning:
"Direct firmware load for ... failed with error -2"
On top of this, brcmfmac itself prints: "no clm_blob available (err=-2), device may have limited channels available".
This commit switches to firmware_request_nowarn, fixing almost any brcmfmac device logging the warning (it leaves the brcmfmac info message in place).
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +1 -1
@@ -149,7 +149,7 @@ static int brcmf_c_process_clm_blob(struct brcmf_if *ifp)return err; } - err =request_firmware (&clm, clm_name, bus->dev); + err =firmware_request_nowarn (&clm, clm_name, bus->dev);if (err) {brcmf_info ("no clm_blob available (err=%d), device may have limited channels available\n" , err);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 230/246 wlcore: Fix memory leak in case wl12xx_fetch_firmware failure
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit ba2ffc96321c8433606ceeb85c9e722b8113e5a7 ]
Release fw_status, raw_fw_status, and tx_res_if when wl12xx_fetch_firmware failed instead of meaningless goto out to avoid the following memory leak reports(Only the last one listed):
unreferenced object 0xc28a9a00 (size 512):
comm "kworker/0:4", pid 31298, jiffies 2783204 (age 203.290s) hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<6624adab>] kmemleak_alloc+0x40/0x74
[<500ddb31>] kmem_cache_alloc_trace+0x1ac/0x270
[<db4d731d>] wl12xx_chip_wakeup+0xc4/0x1fc [wlcore]
[<76c5db53>] wl1271_op_add_interface+0x4a4/0x8f4 [wlcore]
[<cbf30777>] drv_add_interface+0xa4/0x1a0 [mac80211]
[<65bac325>] ieee80211_reconfig+0x9c0/0x1644 [mac80211]
[<2817c80e>] ieee80211_restart_work+0x90/0xc8 [mac80211]
[<7e1d425a>] process_one_work+0x284/0x42c
[<55f9432e>] worker_thread+0x2fc/0x48c
[<abb582c6>] kthread+0x148/0x160
[<63144b13>] ret_from_fork+0x14/0x2c
[< (null)>] (null)
[<1f6e7715>] 0xffffffff--- drivers/net/wireless/ti/wlcore/main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/wireless/ti/wlcore/main.c +5 -2
@@ -1085,8 +1085,11 @@ static int wl12xx_chip_wakeup(struct wl1271 *wl, bool plt) goto out; ret =wl12xx_fetch_firmware (wl, plt); -if (ret <0 ) - goto out; +if (ret <0 ) { +kfree (wl->fw_status); +kfree (wl->raw_fw_status); +kfree (wl->tx_res_if); + } out:return ret;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 231/246 x86/build: Mark per-CPU symbols as absolute explicitly for LLD
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit d071ae09a4a1414c1433d5ae9908959a7325b0ad ]
Accessing per-CPU variables is done by finding the offset of the variable in the per-CPU block and adding it to the address of the respective CPU's block.
Section 3.10.8 of ld.bfd's documentation states:
For expressions involving numbers, relative addresses and absolute addresses, ld follows these rules to evaluate terms:
Other binary operations, that is, between two relative addresses not in the same section, or between a relative address and an absolute address, first convert any non-absolute term to an absolute address before applying the operator."
Note that LLVM's linker does not adhere to the GNU ld's implementation and as such requires implicitly-absolute terms to be explicitly marked as absolute in the linker script. If not, it fails currently with:
ld.lld: error: ./arch/x86/kernel/vmlinux.lds:153: at least one side of the expression must be absolute ld.lld: error: ./arch/x86/kernel/vmlinux.lds:154: at least one side of the expression must be absolute Makefile:1040: recipe for target 'vmlinux' failed
This is not a functional change for ld.bfd which converts the term to an absolute symbol anyways as specified above.
Based on a previous submission by Tri Vo <[email protected]>.
--- arch/x86/kernel/vmlinux.lds.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/vmlinux.lds.S +1 -1
@@ -401,7 +401,7 @@ SECTIONS * Per-cpu symbols which need to be offset from __per_cpu_load * for the boot processor. */ -#define INIT_PER_CPU(x) init_per_cpu__##x = x + __per_cpu_load +#define INIT_PER_CPU(x) init_per_cpu__##x = ABSOLUTE(x) + __per_cpu_load INIT_PER_CPU(gdt_page); INIT_PER_CPU(irq_stack_union);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 232/246 drm/fb-helper: fix leaks in error path of drm_fb_helper_fbdev_setup
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 00eb5b0da8d27b3c944bfc959c3344d665caae26 ]
After drm_fb_helper_fbdev_setup calls drm_fb_helper_init, "dev->fb_helper" will be initialized (and thus drm_fb_helper_fini will have some effect). After that, drm_fb_helper_initial_config is called which may call the "fb_probe" driver callback.
This driver callback may call drm_fb_helper_defio_init (as is done by drm_fb_helper_generic_probe) or set a framebuffer (as is done by bochs) as documented. These are normally cleaned up on exit by drm_fb_helper_fbdev_teardown which also calls drm_fb_helper_fini.
If an error occurs after "fb_probe", but before setup is complete, then calling just drm_fb_helper_fini will leak resources. This was triggered by df2052cc922 ("bochs: convert to drm_fb_helper_fbdev_setup/teardown"):
[ 50.008030] bochsdrmfb: enable CONFIG_FB_LITTLE_ENDIAN to support this framebuffer
[ 50.009436] bochs-drm 0000:00:02.0: [drm:drm_fb_helper_fbdev_setup] *ERROR* fbdev: Failed to set configuration (ret=-38)
[ 50.011456] [drm] Initialized bochs-drm 1.0.0 20130925 for 0000:00:02.0 on minor 2
[ 50.013604] WARNING: CPU: 1 PID: 1 at drivers/gpu/drm/drm_mode_config.c:477 drm_mode_config_cleanup+0x280/0x2a0
[ 50.016175] CPU: 1 PID: 1 Comm: swapper/0 Tainted: G T 4.20.0-rc7 #1
[ 50.017732] EIP: drm_mode_config_cleanup+0x280/0x2a0
...
[ 50.023155] Call Trace:
[ 50.023155] ? bochs_kms_fini+0x1e/0x30
[ 50.023155] ? bochs_unload+0x18/0x40This can be reproduced with QEMU and CONFIG_FB_LITTLE_ENDIAN=n.
--- drivers/gpu/drm/drm_fb_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_fb_helper.c +1 -1
@@ -2891,7 +2891,7 @@ int drm_fb_helper_fbdev_setup(struct drm_device *dev,return 0 ; err_drm_fb_helper_fini: -drm_fb_helper_fini (fb_helper); +drm_fb_helper_fbdev_teardown (dev);return ret; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 233/246 clk: meson: clean-up clock registration
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 8d9981efbcab066d17af4d3c85c169200f6f78df ]
Order, ids and size between the table of regmap clocks and the onecell data table could be different.
Set regmap pointer in all the regmap clocks before starting the registration using the onecell data, to make sure we don't get into an incoherent situation.
--- drivers/clk/meson/meson-aoclk.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/clk/meson/meson-aoclk.c +10 -5
@@ -65,15 +65,20 @@ int meson_aoclkc_probe(struct platform_device *pdev)return ret; } -/* -* Populate regmap and register all clks -*/ -for (clkid =0 ; clkid < data->num_clks; clkid++) { +/* Populate regmap */ +for (clkid =0 ; clkid < data->num_clks; clkid++) data->clks[clkid]->map = regmap; +/* Register all clks */ +for (clkid =0 ; clkid < data->hw_data->num; clkid++) { +if (!data->hw_data->hws[clkid]) +continue ; + ret =devm_clk_hw_register (dev, data->hw_data->hws[clkid]); -if (ret) +if (ret) { +dev_err (dev,"Clock registration failed\n" );return ret; + } } return devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get,
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 234/246 ARM: shmobile: Fix R-Car Gen2 regulator quirk
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 5347a0203709d5039a74d7c94e23519eee478094 ]
The quirk code currently detects all compatible I2C chips with a shared IRQ line on all I2C busses, adds them into a list, and registers a bus notifier. For every chip for which the bus notifier triggers, the quirk code performs I2C transfer on that I2C bus for all addresses in the list. The problem is that this may generate transfers to non-existing chips on systems with multiple I2C busses.
This patch adds a check to verify that the I2C bus to which the chip with shared IRQ is attached to matches the I2C bus of the chip which triggered the bus notifier and only starts the I2C transfer if they match.
--- arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c +5 -0
@@ -40,6 +40,7 @@struct regulator_quirk {struct list_head list;const struct of_device_id *id; +struct device_node *np;struct of_phandle_args irq_args;struct i2c_msg i2c_msg;bool shared;/* IRQ line is shared */
@@ -101,6 +102,9 @@ static int regulator_quirk_notify(struct notifier_block *nb,if (!pos->shared)continue ; +if (pos->np->parent != client->dev.parent->of_node) +continue ; +dev_info (&client->dev,"clearing %s@0x%02x interrupts\n" , pos->id->compatible, pos->i2c_msg.addr);
@@ -165,6 +169,7 @@ static int __init rcar_gen2_regulator_quirk(void)memcpy (&quirk->i2c_msg, id->data,sizeof (quirk->i2c_msg)); quirk->id = id; + quirk->np = np; quirk->i2c_msg.addr = addr; ret =of_irq_parse_one (np,0 , argsa);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 235/246 clk: rockchip: fix frac settings of GPLL clock for rk3328
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit a0e447b0c50240a90ab84b7126b3c06b0bab4adc ]
This patch fixes settings of GPLL frequency in fractional mode for rk3328. In this mode, FOUTVCO is calcurated by following formula:
FOUTVCO = FREF * FBDIV / REFDIV + ((FREF * FRAC / REFDIV) >> 24)
The problem is in FREF * FRAC >> 24 term. This result always lacks one from target value is specified by rate member. For example first itme of rk3328_pll_frac_rate originally has
- rate : 1016064000
- refdiv: 3
- fbdiv : 127
- frac : 134217
- FREF * FBDIV / REFDIV = 1016000000
- (FREF * FRAC / REFDIV) >> 24 = 63999
Thus calculated rate is 1016063999. It seems wrong.
If frac has 134218 (it is increased 1 from original value), second term is 64000. All other items have same situation. So this patch adds 1 to frac member in all items of rk3328_pll_frac_rate.
--- drivers/clk/rockchip/clk-rk3328.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/clk/rockchip/clk-rk3328.c +6 -6
@@ -78,17 +78,17 @@ static struct rockchip_pll_rate_table rk3328_pll_rates[] = {static struct rockchip_pll_rate_table rk3328_pll_frac_rates[] = {/* _mhz, _refdiv, _fbdiv, _postdiv1, _postdiv2, _dsmpd, _frac */ -RK3036_PLL_RATE (1016064000 ,3 ,127 ,1 ,1 ,0 ,134217 ), +RK3036_PLL_RATE (1016064000 ,3 ,127 ,1 ,1 ,0 ,134218 ),/* vco = 1016064000 */ -RK3036_PLL_RATE (983040000 ,24 ,983 ,1 ,1 ,0 ,671088 ), +RK3036_PLL_RATE (983040000 ,24 ,983 ,1 ,1 ,0 ,671089 ),/* vco = 983040000 */ -RK3036_PLL_RATE (491520000 ,24 ,983 ,2 ,1 ,0 ,671088 ), +RK3036_PLL_RATE (491520000 ,24 ,983 ,2 ,1 ,0 ,671089 ),/* vco = 983040000 */ -RK3036_PLL_RATE (61440000 ,6 ,215 ,7 ,2 ,0 ,671088 ), +RK3036_PLL_RATE (61440000 ,6 ,215 ,7 ,2 ,0 ,671089 ),/* vco = 860156000 */ -RK3036_PLL_RATE (56448000 ,12 ,451 ,4 ,4 ,0 ,9797894 ), +RK3036_PLL_RATE (56448000 ,12 ,451 ,4 ,4 ,0 ,9797895 ),/* vco = 903168000 */ -RK3036_PLL_RATE (40960000 ,12 ,409 ,4 ,5 ,0 ,10066329 ), +RK3036_PLL_RATE (40960000 ,12 ,409 ,4 ,5 ,0 ,10066330 ),/* vco = 819200000 */ {/* sentinel */ }, };
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 236/246 dmaengine: tegra: avoid overflow of byte tracking
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit e486df39305864604b7e25f2a95d51039517ac57 ]
The dma_desc->bytes_transferred counter tracks the number of bytes moved by the DMA channel. This is then used to calculate the information passed back in the in the tegra_dma_tx_status callback, which is usually fine.
When the DMA channel is configured as continous, then the bytes_transferred counter will increase over time and eventually overflow to become negative so the residue count will become invalid and the ALSA sound-dma code will report invalid hardware pointer values to the application. This results in some users becoming confused about the playout position and putting audio data in the wrong place.
To fix this issue, always ensure the bytes_transferred field is modulo the size of the request. We only do this for the case of the cyclic transfer done ISR as anyone attempting to move 2GiB of DMA data in one transfer is unlikely.
Note, we don't fix the issue that we should /never/ transfer a negative number of bytes so we could make those fields unsigned.
--- drivers/dma/tegra20-apb-dma.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/dma/tegra20-apb-dma.c +4 -1
@@ -636,7 +636,10 @@ static void handle_cont_sngl_cycle_dma_done(struct tegra_dma_channel *tdc, sgreq =list_first_entry (&tdc->pending_sg_req,typeof (*sgreq), node); dma_desc = sgreq->dma_desc; - dma_desc->bytes_transferred += sgreq->req_len; +/* if we dma for long enough the transfer count will wrap */ + dma_desc->bytes_transferred = + (dma_desc->bytes_transferred + sgreq->req_len) % + dma_desc->bytes_requested;/* Callback need to be call */ if (!dma_desc->cb_count)
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 237/246 staging: iio: adt7316: fix dac_bits assignment
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit e9de475723de5bf207a5b7b88bdca863393e42c8 ]
The value of dac_bits is used in adt7316_show_DAC() and adt7316_store_DAC(), and it should be either 8, 10, or 12 bits depending on the device in use. The driver currently only assigns a value to dac_bits in adt7316_store_da_high_resolution(). The purpose of the dac high resolution option is not to change dac resolution for normal operation. Instead, it is specific to an optional feature where one or two of the four dacs can be set to output voltage proportional to temperature. If the user chooses to set dac a and/or dac b to output voltage proportional to temperature, the da_high_resolution attribute can optionally be enabled to use 10 bit resolution rather than the default 8 bits. This is only available on the 10 and 12 bit dac devices. If the user attempts to read or write dacs a or b under these settings, the driver's current behaviour is to return an error. Dacs c and d continue to operate normally under these conditions. With the above in mind, remove the dac_bits assignments from this function since the value of dac_bits as used in the driver is not dependent on this dac high resolution option.
Since the dac_bits assignments discussed above are currently the only ones in this driver, the default value of dac_bits is 0. This results in incorrect calculations when the dacs are read or written in adt7316_show_DAC() and adt7316_store_DAC(). To correct this, assign a value to dac_bits in adt7316_probe() to ensure correct operation as soon as the device is registered and available to userspace.
--- drivers/staging/iio/addac/adt7316.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/staging/iio/addac/adt7316.c +9 -9
@@ -651,17 +651,10 @@ static ssize_t adt7316_store_da_high_resolution(struct device *dev,u8 config3;int ret; - chip->dac_bits =8 ; - -if (buf[0 ] =='1' ) { +if (buf[0 ] =='1' ) config3 = chip->config3 |ADT7316_DA_HIGH_RESOLUTION ; -if (chip->id ==ID_ADT7316 || chip->id ==ID_ADT7516 ) - chip->dac_bits =12 ; -else if (chip->id ==ID_ADT7317 || chip->id ==ID_ADT7517 ) - chip->dac_bits =10 ; - }else { +else config3 = chip->config3 & (~ADT7316_DA_HIGH_RESOLUTION ); - } ret = chip->bus.write (chip->bus.client,ADT7316_CONFIG3 , config3);if (ret)
@@ -2123,6 +2116,13 @@ int adt7316_probe(struct device *dev, struct adt7316_bus *bus,else return -ENODEV ; +if (chip->id ==ID_ADT7316 || chip->id ==ID_ADT7516 ) + chip->dac_bits =12 ; +else if (chip->id ==ID_ADT7317 || chip->id ==ID_ADT7517 ) + chip->dac_bits =10 ; +else + chip->dac_bits =8 ; + chip->ldac_pin =devm_gpiod_get_optional (dev,"adi,ldac" ,GPIOD_OUT_LOW );if (IS_ERR (chip->ldac_pin)) { ret =PTR_ERR (chip->ldac_pin);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 238/246 Input: soc_button_array - fix mapping of the 5th GPIO in a PNP0C40 device
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit e9eb788f9442d1b5d93efdb30c3be071ce8a22b1 ]
The Microsoft documenation for the PNP0C40 device aka the "Windows-compatible button array" describes the 5th GpioInt listed in the resources as: '5. Interrupt corresponding to the "Rotation Lock" button, if supported'.
Notice this describes the 5th entry as a button while we sofar have been mapping it to EV_SW, SW_ROTATE_LOCK. On my Point of View TAB P1006W-232 which actually comes with a rotation-lock button, the button indeed is a button and not a slider/switch. An image search for other Windows tablets has found 2 more models with a rotation-lock button and on both of those it too is a push-button and not a slider/switch.
Further evidence can be found in the HUT extension HUTRR52 from Microsoft which adds rotation lock support to the HUT, which describes 2 different
usages: "0xC9 System Display Rotation Lock Button" and
"0xCA System Display Rotation Lock Slider Switch" note that switch is seen as a separate thing here and the non switch wording is an exact match for the "Windows-compatible button array" spec wording.
TL;DR: our current mapping of the 5th GPIO to SW_ROTATE_LOCK is wrong because the 5th GPIO is for a push-button not a switch.
This commit fixes this by maping the 5th GPIO to KEY_ROTATE_LOCK_TOGGLE.
--- drivers/input/misc/soc_button_array.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/misc/soc_button_array.c +1 -1
@@ -373,7 +373,7 @@ static struct soc_button_info soc_button_PNP0C40[] = { { "home", 1, EV_KEY, KEY_LEFTMETA, false, true }, { "volume_up", 2, EV_KEY, KEY_VOLUMEUP, true, false }, { "volume_down", 3, EV_KEY, KEY_VOLUMEDOWN, true, false }, - { "rotation_lock", 4, EV_SW, SW_ROTATE_LOCK, false, false }, + { "rotation_lock", 4, EV_KEY, KEY_ROTATE_LOCK_TOGGLE, false, false }, { } };
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 239/246 ASoC: simple-card-utils: check "reg" property on asoc_simple_card_get_dai_id()
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit a0c426fe143328760c9fd565cd203a37a7b4fde8 ]
We will get DAI ID from "reg" property if it has on DT, otherwise get it by counting port/endpoint.
But in below case, we need to get DAI ID = 0 via port reg = <0>, but current implementation returns ID = 1, because it can't judge ID = 0 was from "non reg" or "reg = <0>".
Thus, it will count port/endpoint number as "non reg" case.
of_graph_parse_endpoint() implementation itself is not a problem, but because asoc_simple_card_get_dai_id() need to count port/endpoint number when "non reg" case, it need to know ID = 0 was from "non reg" or "reg = <0>".
This patch fix this issue.
port {
reg = <0>;
xxxx: endpoint@0 {
};
=> xxxx: endpoint@1 {
};
};--- sound/soc/generic/simple-card-utils.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
sound/soc/generic/simple-card-utils.c +11 -3
@@ -283,12 +283,20 @@ static int asoc_simple_card_get_dai_id(struct device_node *ep)/* use endpoint/port reg if exist */ ret =of_graph_parse_endpoint (ep, &info);if (ret ==0 ) { -if (info.id) +/* +* Because it will count port/endpoint if it doesn't have "reg". +* But, we can't judge whether it has "no reg", or "reg = <0>" +* only of_graph_parse_endpoint(). +* We need to check "reg" property +*/ +if (of_get_property (ep,"reg" ,NULL ))return info.id; -if (info.port) + + node =of_get_parent (ep); +of_node_put (node); +if (of_get_property (node,"reg" ,NULL ))return info.port; } - node =of_graph_get_port_parent (ep);/*
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 240/246 drm: Reorder set_property_atomic to avoid returning with an active ww_ctx
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 227ad6d957898a88b1746e30234ece64d305f066 ]
Delay the drm_modeset_acquire_init() until after we check for an allocation failure so that we can return immediately upon error without having to unwind.
WARNING: lock held when returning to user space!
4.20.0+ #174 Not tainted
------------------------------------------------
syz-executor556/8153 is leaving the kernel with locks still held! 1 lock held by syz-executor556/8153:
#0: 000000005100c85c (crtc_ww_class_acquire){+.+.}, at:set_property_atomic+0xb3/0x330 drivers/gpu/drm/drm_mode_object.c:462
--- drivers/gpu/drm/drm_mode_object.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/drm_mode_object.c +1 -0
@@ -465,6 +465,7 @@ static int set_property_atomic(struct drm_mode_object *obj,drm_modeset_acquire_init (&ctx,0 ); state->acquire_ctx = &ctx; + retry:if (prop == state->dev->mode_config.dpms_property) {if (obj->type !=DRM_MODE_OBJECT_CONNECTOR ) {
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 241/246 drm/dp/mst: Configure no_stop_bit correctly for remote i2c xfers
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit c978ae9bde582e82a04c63a4071701691dd8b35c ]
We aren't supposed to force a stop+start between every i2c msg when performing multi message transfers. This should eg. cause the DDC segment address to be reset back to 0 between writing the segment address and reading the actual EDID extension block.
To quote the E-DDC spec:
"... this standard requires that the segment pointer be
reset to 00h when a NO ACK or a STOP condition is received."
Since we're going to touch this might as well consult the I2C_M_STOP flag to determine whether we want to force the stop or not.
Cc: Brian Vincent <[email protected]>
References: https://bugs.freedesktop.org/show_bug.cgi?id=108081
--- drivers/gpu/drm/drm_dp_mst_topology.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/drm_dp_mst_topology.c +1 -0
@@ -3286,6 +3286,7 @@ static int drm_dp_mst_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs msg.u.i2c_read.transactions[i].i2c_dev_id = msgs[i].addr; msg.u.i2c_read.transactions[i].num_bytes = msgs[i].len; msg.u.i2c_read.transactions[i].bytes = msgs[i].buf; + msg.u.i2c_read.transactions[i].no_stop_bit = !(msgs[i].flags &I2C_M_STOP ); } msg.u.i2c_read.read_i2c_device_id = msgs[num -1 ].addr; msg.u.i2c_read.num_bytes_read = msgs[num -1 ].len;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 242/246 net: stmmac: Avoid one more sometimes uninitialized Clang warning
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 1f5d861f7fefa971b2c6e766f77932c86419a319 ]
When building with -Wsometimes-uninitialized, Clang warns:
drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c:111:2: error: variable 'ns' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c:111:2: error: variable 'ns' is used uninitialized whenever '&&' condition is false [-Werror,-Wsometimes-uninitialized]
Clang is concerned with the use of stmmac_do_void_callback (which stmmac_get_systime wraps), as it may fail to initialize these values if the if condition was ever false (meaning the callback doesn't exist). It's not wrong because the callback is what initializes ns. While it's unlikely that the callback is going to disappear at some point and make that condition false, we can easily avoid this warning by zero initializing the variable.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c +1 -1
@@ -105,7 +105,7 @@ static int stmmac_get_time(struct ptp_clock_info *ptp, struct timespec64 *ts)struct stmmac_priv *priv = container_of(ptp, struct stmmac_priv, ptp_clock_ops);unsigned long flags; -u64 ns; +u64 ns =0 ;spin_lock_irqsave (&priv->ptp_lock, flags);stmmac_get_systime (priv, priv->ptpaddr, &ns);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 243/246 appletalk: Fix compile regression
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 27da0d2ef998e222a876c0cec72aa7829a626266 ]
A bugfix just broke compilation of appletalk when CONFIG_SYSCTL is disabled:
In file included from net/appletalk/ddp.c:65:net/appletalk/ddp.c: In function 'atalk_init':include/linux/atalk.h:164:34: error: expected expression before 'do'
#define atalk_register_sysctl() do { } while(0)
^~net/appletalk/ddp.c:1934:7: note: in expansion of macro 'atalk_register_sysctl'
rc = atalk_register_sysctl();
This is easier to avoid by using conventional inline functions as stubs rather than macros. The header already has inline functions for other purposes, so I'm changing over all the macros for consistency.
--- include/linux/atalk.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
include/linux/atalk.h +14 -4
@@ -161,16 +161,26 @@ extern int sysctl_aarp_resolve_time;extern void atalk_register_sysctl (void );extern void atalk_unregister_sysctl (void );#else -#define atalk_register_sysctl () do { } while(0) -#define atalk_unregister_sysctl () do { } while(0) +static inline int atalk_register_sysctl (void ) +{ +return 0 ; +} +static inline void atalk_unregister_sysctl (void ) +{ +}#endif #ifdef CONFIG_PROC_FS extern int atalk_proc_init (void );extern void atalk_proc_exit (void );#else -#define atalk_proc_init () ({ 0; }) -#define atalk_proc_exit () do { } while(0) +static inline int atalk_proc_init (void ) +{ +return 0 ; +} +static inline void atalk_proc_exit (void ) +{ +}#endif /* CONFIG_PROC_FS */ #endif /* __LINUX_ATALK_H__ */
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 244/246 gpio: of: Restrict enable-gpio quirk to regulator-gpio
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 692ef26e72fcce0c1e73c41683fd3512f3719d55 ]
Commit 0e7d6f940164 ("gpio: of: Apply regulator-gpio quirk only to enable-gpios") breaks the device tree ABI specified in the device tree bindings for fixed regulators (compatible "regulator-fixed"). According to these bindings the polarity of the GPIO is exclusively controlled by the presence or absence of the enable-active-high property. As such the polarity quirk implemented in of_gpio_flags_quirks() must be applied to the GPIO specified for fixed regulators.
However, commit 0e7d6f940164 ("gpio: of: Apply regulator-gpio quirk only to enable-gpios") restricted the quirk to the enable-gpios property for fixed regulators as well, whereas according to the commit message itself it should only apply to "regulator-gpio" compatible device tree nodes.
Fix this by actually implementing what the offending commit intended, which is to ensure that the quirk is applied to the GPIO specified by the "enable-gpio" property for the "regulator-gpio" bindings only.
This fixes a regression on Jetson TX1 where the fixed regulator for the HDMI +5V pin relies on the flags quirk for the proper polarity.
--- drivers/gpio/gpiolib-of.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpiolib-of.c +2 -2
@@ -84,10 +84,10 @@ static void of_gpio_flags_quirks(struct device_node *np,* Note that active low is the default. */ if (IS_ENABLED (CONFIG_REGULATOR ) && - !strcmp (propname,"enable-gpio" ) && (of_device_is_compatible (np,"regulator-fixed" ) ||of_device_is_compatible (np,"reg-fixed-voltage" ) || -of_device_is_compatible (np,"regulator-gpio" ))) { + (of_device_is_compatible (np,"regulator-gpio" ) && +strcmp (propname,"enable-gpio" ) ==0 ))) {/* * The regulator GPIO handles are specified such that the * presence or absence of "enable-active-high" solely controls
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 245/246 ACPI / video: Extend chassis-type detection with a "Lunch Box" check
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit d693c008e3ca04db5916ff72e68ce661888a913b ]
Commit 53fa1f6e8a59 ("ACPI / video: Only default only_lcd to true on Win8-ready _desktops_") introduced chassis type detection, limiting the lcd_only check for the backlight to devices where the chassis-type indicates their is no builtin LCD panel.
The purpose of the lcd_only check is to avoid advertising a backlight interface on desktops, since skylake and newer machines seem to always have a backlight interface even if there is no LCD panel. The limiting of this check to desktops only was done to avoid breaking backlight support on some laptops which do not have the lcd flag set.
The Fujitsu ESPRIMO Q910 which is a compact (NUC like) desktop machine has a chassis type of 0x10 aka "Lunch Box". Without the lcd_only check we end up falsely advertising backlight/brightness control on this device. This commit extend the dmi_is_desktop check to return true for type 0x10 to fix this.
--- drivers/acpi/acpi_video.c | 1 + 1 file changed, 1 insertion(+)
drivers/acpi/acpi_video.c +1 -0
@@ -2143,6 +2143,7 @@ static bool dmi_is_desktop(void)case 0x05 :/* Pizza Box */ case 0x06 :/* Mini Tower */ case 0x07 :/* Tower */ +case 0x10 :/* Lunch Box */ case 0x11 :/* Main Server Chassis */ return true; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 246/246 bcache: fix potential div-zero error of writeback_rate_p_term_inverse
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 5b5fd3c94eef69dcfaa8648198e54c92e5687d6d ]
Current code already uses d_strtoul_nonzero() to convert input string to an unsigned integer, to make sure writeback_rate_p_term_inverse won't be zero value. But overflow may happen when converting input string to an unsigned integer value by d_strtoul_nonzero(), then dc->writeback_rate_p_term_inverse can still be set to 0 even if the sysfs file input value is not zero, e.g. 4294967296 (a.k.a UINT_MAX+1).
If dc->writeback_rate_p_term_inverse is set to 0, it might cause a dev-zero error in following code from __update_writeback_rate(),
int64_t proportional_scaled = div_s64(error, dc->writeback_rate_p_term_inverse);
This patch replaces d_strtoul_nonzero() by sysfs_strtoul_clamp() and limit the value range in [1, UINT_MAX]. Then the unsigned integer overflow and dev-zero error can be avoided.
--- drivers/md/bcache/sysfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/md/bcache/sysfs.c +3 -1
@@ -290,7 +290,9 @@ STORE(__cached_dev)sysfs_strtoul_clamp (writeback_rate_i_term_inverse, dc->writeback_rate_i_term_inverse,1 ,UINT_MAX ); -d_strtoul_nonzero (writeback_rate_p_term_inverse); +sysfs_strtoul_clamp (writeback_rate_p_term_inverse, + dc->writeback_rate_p_term_inverse, +1 ,UINT_MAX );d_strtoul_nonzero (writeback_rate_minimum);sysfs_strtoul_clamp (io_error_limit, dc->error_limit,0 ,INT_MAX );
Signature · 1 line
2.19.1
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.0.7 release. There are 246 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 Sat Apr 6 08:44:36 UTC 2019. 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.0.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.0.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
Summary
------------------------------------------------------------------------
kernel: 5.0.7-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-5.0.y
git commit: c3237e4b7d6eb01257dc3fb88eca7e17e526aab5
git describe: v5.0.6-248-gc3237e4b7d6e
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-5.0-oe/build/v5.0.6-248-gc3237e4b7d6e
No regressions (compared to build v5.0.5-394-gcfe061443e1b)
No fixes (compared to build v5.0.5-394-gcfe061443e1b)
Ran 23618 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
-----------
* boot
* install-android-platform-tools-r2600
* kselftest
* libhugetlbfs
* 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_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-timers-tests
* perf
* spectre-meltdown-checker-test
* v4l2-compliance
* ltp-fs-tests
* ltp-open-posix-tests
* kselftest-vsyscall-mode-native
* kselftest-vsyscall-mode-none
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org
Greg Kroah-Hartman
maintainerQuoted 17 lines · Naresh Kamboju
Quoted 15 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.0.7 release. There are 246 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 Sat Apr 6 08:44:36 UTC 2019. 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.0.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.0.y
and the diffstat can be found below.
Quoted 7 lines
Quoted 4 lines
thanks,
greg k-h
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.
greg k-h
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.0.7 release. There are 246 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 Sat Apr 6 08:44:36 UTC 2019. 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.0.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.0.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.0.7 release. There are 246 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 Sat Apr 6 08:44:36 UTC 2019. 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.0.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.0.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 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.0.7 release. There are 246 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 Sat Apr 6 08:44:36 UTC 2019. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.0.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.0.y
and the diffstat can be found below.thanks,
greg k-h
All tests are passing for Tegra ...
Test results for stable-v5.0:
11 builds: 11 pass, 0 fail
22 boots: 22 pass, 0 fail
30 tests: 30 pass, 0 failLinux version: 5.0.7-rc1-gcfe0614
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 23 lines · Jon Hunter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.0.7 release. There are 246 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 Sat Apr 6 08:44:36 UTC 2019. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.0.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.0.y
and the diffstat can be found below.thanks,
greg k-h
All tests are passing for Tegra ...
Test results for stable-v5.0:
Quoted 8 lines
11 builds: 11 pass, 0 fail 22 boots: 22 pass, 0 fail 30 tests: 30 pass, 0 failLinux version: 5.0.7-rc1-gcfe0614
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 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.0.7 release. There are 246 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 Sat Apr 6 08:44:36 UTC 2019. Anything received after that time might be too late.
For v5.0.6-248-gc3237e4b7d6e:
Build results:
total: 159 pass: 159 fail: 0 Qemu test results: total: 345 pass: 345 fail: 0
Guenter
Greg Kroah-Hartman
maintainerQuoted 10 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.0.7 release. There are 246 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 Sat Apr 6 08:44:36 UTC 2019. Anything received after that time might be too late.
Quoted 6 lines
For v5.0.6-248-gc3237e4b7d6e:
Build results:
total: 159 pass: 159 fail: 0 Qemu test results: total: 345 pass: 345 fail: 0
Thanks for testing all of these and letting me know.
greg k-h