This is the start of the stable review cycle for the 4.14.146 release.
There are 59 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 21 Sep 2019 09:44:25 PM UTC.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.146-r…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.14.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 4.14.146-rc1
Sean Young <sean(a)mess.org>
media: technisat-usb2: break out of loop at end of buffer
Christoph Paasch <cpaasch(a)apple.com>
tcp: Don't dequeue SYN/FIN-segments from write-queue
Christoph Paasch <cpaasch(a)apple.com>
tcp: Reset send_head when removing skb from write-queue
Kees Cook <keescook(a)chromium.org>
binfmt_elf: move brk out of mmap when doing direct loader exec
Jann Horn <jannh(a)google.com>
floppy: fix usercopy direction
Nathan Chancellor <natechancellor(a)gmail.com>
PCI: kirin: Fix section mismatch warning
Joerg Roedel <jroedel(a)suse.de>
iommu/amd: Fix race in increase_address_space()
Stuart Hayes <stuart.w.hayes(a)gmail.com>
iommu/amd: Flush old domains in kdump kernel
Hillf Danton <hdanton(a)sina.com>
keys: Fix missing null pointer check in request_key_auth_describe()
Tianyu Lan <Tianyu.Lan(a)microsoft.com>
x86/hyper-v: Fix overflow bug in fill_gva_list()
Peter Zijlstra <peterz(a)infradead.org>
x86/uaccess: Don't leak the AC flags into __get_user() argument evaluation
Wenwen Wang <wenwen(a)cs.uga.edu>
dmaengine: ti: omap-dma: Add cleanup in omap_dma_probe()
Wenwen Wang <wenwen(a)cs.uga.edu>
dmaengine: ti: dma-crossbar: Fix a memory leak bug
Christophe JAILLET <christophe.jaillet(a)wanadoo.fr>
net: seeq: Fix the function used to release some memory in an error handling path
Naoya Horiguchi <n-horiguchi(a)ah.jp.nec.com>
tools/power turbostat: fix buffer overrun
Zephaniah E. Loss-Cutler-Hull <zephaniah(a)gmail.com>
tools/power x86_energy_perf_policy: Fix argument parsing
Ben Hutchings <ben(a)decadent.org.uk>
tools/power x86_energy_perf_policy: Fix "uninitialized variable" warnings at -O2
YueHaibing <yuehaibing(a)huawei.com>
amd-xgbe: Fix error path in xgbe_mod_init()
Kim Phillips <kim.phillips(a)amd.com>
perf/x86/amd/ibs: Fix sample bias for dispatched micro-ops
Josh Hunt <johunt(a)akamai.com>
perf/x86/intel: Restrict period on Nehalem
Jarkko Nikula <jarkko.nikula(a)linux.intel.com>
i2c: designware: Synchronize IRQs when unregistering slave client
Takashi Iwai <tiwai(a)suse.de>
sky2: Disable MSI on yet another ASUS boards (P6Xxxx)
zhaoyang <huangzhaoyang(a)gmail.com>
ARM: 8901/1: add a criteria for pfn_valid of arm
Dan Carpenter <dan.carpenter(a)oracle.com>
cifs: Use kzfree() to zero out the password
Ronnie Sahlberg <lsahlber(a)redhat.com>
cifs: set domainName when a domain-key is used in multiuser
Marc Zyngier <maz(a)kernel.org>
kallsyms: Don't let kallsyms_lookup_size_offset() fail on retrieving the first symbol
Trond Myklebust <trond.myklebust(a)hammerspace.com>
NFSv2: Fix write regression
Trond Myklebust <trond.myklebust(a)hammerspace.com>
NFSv2: Fix eof handling
Thomas Jarosch <thomas.jarosch(a)intra2net.com>
netfilter: nf_conntrack_ftp: Fix debug output
Thomas Gleixner <tglx(a)linutronix.de>
x86/apic: Fix arch_dynirq_lower_bound() bug for DT enabled machines
Prashant Malani <pmalani(a)chromium.org>
r8152: Set memory to all 0xFFs on failed reg reads
Sven Eckelmann <sven(a)narfation.org>
batman-adv: Only read OGM2 tvlv_len after buffer len check
Doug Berger <opendmb(a)gmail.com>
ARM: 8874/1: mm: only adjust sections of valid mm structures
Wenwen Wang <wenwen(a)cs.uga.edu>
qed: Add cleanup in qed_slowpath_start()
Christophe JAILLET <christophe.jaillet(a)wanadoo.fr>
Kconfig: Fix the reference to the IDT77105 Phy driver in the description of ATM_NICSTAR_USE_IDT77105
Trond Myklebust <trond.myklebust(a)hammerspace.com>
NFS: Fix initialisation of I/O result struct in nfs_pgio_rpcsetup
Trond Myklebust <trond.myklebust(a)hammerspace.com>
NFSv4: Fix return value in nfs_finish_open()
Trond Myklebust <trond.myklebust(a)hammerspace.com>
NFSv4: Fix return values for nfs4_file_open()
Juliana Rodrigueiro <juliana.rodrigueiro(a)intra2net.com>
netfilter: xt_nfacct: Fix alignment mismatch in xt_nfacct_match_info
Phil Reid <preid(a)electromag.com.au>
fpga: altera-ps-spi: Fix getting of optional confd gpio
Ilya Leoshkevich <iii(a)linux.ibm.com>
s390/bpf: use 32-bit index for tail calls
Faiz Abbas <faiz_abbas(a)ti.com>
ARM: dts: dra74x: Fix iodelay configuration for mmc3
Tony Lindgren <tony(a)atomide.com>
ARM: OMAP2+: Fix omap4 errata warning on other SoCs
Ilya Leoshkevich <iii(a)linux.ibm.com>
s390/bpf: fix lcgr instruction encoding
Tony Lindgren <tony(a)atomide.com>
ARM: OMAP2+: Fix missing SYSC_HAS_RESET_STATUS for dra7 epwmss
Masashi Honma <masashi.honma(a)gmail.com>
nl80211: Fix possible Spectre-v1 for CQM RSSI thresholds
Wen Huang <huangwenabc(a)gmail.com>
mwifiex: Fix three heap overflow at parsing element in cfg80211_ap_settings
Razvan Stefanescu <razvan.stefanescu(a)microchip.com>
tty/serial: atmel: reschedule TX after RX was started
Chunyan Zhang <chunyan.zhang(a)unisoc.com>
serial: sprd: correct the wrong sequence of arguments
Hung-Te Lin <hungte(a)chromium.org>
firmware: google: check if size is valid when decoding VPD data
Matt Delco <delco(a)chromium.org>
KVM: coalesced_mmio: add bounds checking
Cong Wang <xiyou.wangcong(a)gmail.com>
net_sched: let qdisc_put() accept NULL pointer
Dongli Zhang <dongli.zhang(a)oracle.com>
xen-netfront: do not assume sk_buff_head list is empty in error handling
Sean Young <sean(a)mess.org>
media: tm6000: double free if usb disconnect while streaming
Yoshihiro Shimoda <yoshihiro.shimoda.uh(a)renesas.com>
phy: renesas: rcar-gen3-usb2: Disable clearing VBUS in over-current
Alan Stern <stern(a)rowland.harvard.edu>
USB: usbcore: Fix slab-out-of-bounds bug during device reset
Aneesh Kumar K.V <aneesh.kumar(a)linux.ibm.com>
powerpc/mm/radix: Use the right page size for vmemmap mapping
Benjamin Tissoires <benjamin.tissoires(a)redhat.com>
Input: elan_i2c - remove Lenovo Legion Y7000 PnpID
Aaron Armstrong Skomra <skomra(a)gmail.com>
HID: wacom: generic: read HID_DG_CONTACTMAX from any feature report
-------------
Diffstat:
Makefile | 4 +-
arch/arm/boot/dts/dra74x-mmc-iodelay.dtsi | 50 ++++++++++----------
arch/arm/mach-omap2/omap4-common.c | 3 ++
arch/arm/mach-omap2/omap_hwmod_7xx_data.c | 3 +-
arch/arm/mm/init.c | 8 +++-
arch/powerpc/mm/pgtable-radix.c | 16 +++----
arch/s390/net/bpf_jit_comp.c | 12 +++--
arch/x86/events/amd/ibs.c | 13 +++--
arch/x86/events/intel/core.c | 6 +++
arch/x86/hyperv/mmu.c | 8 ++--
arch/x86/include/asm/perf_event.h | 12 +++--
arch/x86/include/asm/uaccess.h | 4 +-
arch/x86/kernel/apic/io_apic.c | 8 +++-
drivers/atm/Kconfig | 2 +-
drivers/block/floppy.c | 4 +-
drivers/dma/omap-dma.c | 4 +-
drivers/dma/ti-dma-crossbar.c | 4 +-
drivers/firmware/google/vpd.c | 4 +-
drivers/firmware/google/vpd_decode.c | 55 +++++++++++++---------
drivers/firmware/google/vpd_decode.h | 6 +--
drivers/fpga/altera-ps-spi.c | 11 +++--
drivers/hid/wacom_sys.c | 10 ++--
drivers/hid/wacom_wac.c | 4 ++
drivers/i2c/busses/i2c-designware-slave.c | 1 +
drivers/input/mouse/elan_i2c_core.c | 2 +-
drivers/iommu/amd_iommu.c | 40 ++++++++++++++--
drivers/media/usb/dvb-usb/technisat-usb2.c | 22 ++++-----
drivers/media/usb/tm6000/tm6000-dvb.c | 3 ++
drivers/net/ethernet/amd/xgbe/xgbe-main.c | 10 +++-
drivers/net/ethernet/marvell/sky2.c | 7 +++
drivers/net/ethernet/qlogic/qed/qed_main.c | 4 +-
drivers/net/ethernet/seeq/sgiseeq.c | 7 +--
drivers/net/usb/r8152.c | 5 +-
drivers/net/wireless/marvell/mwifiex/ie.c | 3 ++
drivers/net/wireless/marvell/mwifiex/uap_cmd.c | 9 +++-
drivers/net/xen-netfront.c | 2 +-
drivers/pci/dwc/pcie-kirin.c | 4 +-
drivers/phy/renesas/phy-rcar-gen3-usb2.c | 2 +
drivers/tty/serial/atmel_serial.c | 1 -
drivers/tty/serial/sprd_serial.c | 2 +-
drivers/usb/core/config.c | 12 +++--
fs/binfmt_elf.c | 11 +++++
fs/cifs/connect.c | 22 +++++++++
fs/nfs/dir.c | 2 +-
fs/nfs/nfs4file.c | 12 ++---
fs/nfs/pagelist.c | 2 +-
fs/nfs/proc.c | 7 ++-
include/uapi/linux/netfilter/xt_nfacct.h | 5 ++
kernel/kallsyms.c | 6 ++-
net/batman-adv/bat_v_ogm.c | 18 ++++---
net/ipv4/tcp.c | 6 +--
net/netfilter/nf_conntrack_ftp.c | 2 +-
net/netfilter/xt_nfacct.c | 36 +++++++++-----
net/sched/sch_generic.c | 3 ++
net/wireless/nl80211.c | 4 +-
security/keys/request_key_auth.c | 6 +++
tools/power/x86/turbostat/turbostat.c | 2 +-
.../x86_energy_perf_policy.c | 28 ++++++-----
virt/kvm/coalesced_mmio.c | 17 ++++---
59 files changed, 391 insertions(+), 185 deletions(-)
The following commit has been merged into the perf/urgent branch of tip:
Commit-ID: b63fd11cced17fcb8e133def29001b0f6aaa5e06
Gitweb: https://git.kernel.org/tip/b63fd11cced17fcb8e133def29001b0f6aaa5e06
Author: Srikar Dronamraju <srikar(a)linux.vnet.ibm.com>
AuthorDate: Wed, 04 Sep 2019 15:17:37 +05:30
Committer: Arnaldo Carvalho de Melo <acme(a)redhat.com>
CommitterDate: Fri, 20 Sep 2019 10:28:26 -03:00
perf stat: Reset previous counts on repeat with interval
When using 'perf stat' with repeat and interval option, it shows wrong
values for events.
The wrong values will be shown for the first interval on the second and
subsequent repetitions.
Without the fix:
# perf stat -r 3 -I 2000 -e faults -e sched:sched_switch -a sleep 5
2.000282489 53 faults
2.000282489 513 sched:sched_switch
4.005478208 3,721 faults
4.005478208 2,666 sched:sched_switch
5.025470933 395 faults
5.025470933 1,307 sched:sched_switch
2.009602825 1,84,46,74,40,73,70,95,47,520 faults <------
2.009602825 1,84,46,74,40,73,70,95,49,568 sched:sched_switch <------
4.019612206 4,730 faults
4.019612206 2,746 sched:sched_switch
5.039615484 3,953 faults
5.039615484 1,496 sched:sched_switch
2.000274620 1,84,46,74,40,73,70,95,47,520 faults <------
2.000274620 1,84,46,74,40,73,70,95,47,520 sched:sched_switch <------
4.000480342 4,282 faults
4.000480342 2,303 sched:sched_switch
5.000916811 1,322 faults
5.000916811 1,064 sched:sched_switch
#
prev_raw_counts is allocated when using intervals. This is used when
calculating the difference in the counts of events when using interval.
The current counts are stored in prev_raw_counts to calculate the
differences in the next iteration.
On the first interval of the second and subsequent repetitions,
prev_raw_counts would be the values stored in the last interval of the
previous repetitions, while the current counts will only be for the
first interval of the current repetition.
Hence there is a possibility of events showing up as big number.
Fix this by resetting prev_raw_counts whenever perf stat repeats the
command.
With the fix:
# perf stat -r 3 -I 2000 -e faults -e sched:sched_switch -a sleep 5
2.019349347 2,597 faults
2.019349347 2,753 sched:sched_switch
4.019577372 3,098 faults
4.019577372 2,532 sched:sched_switch
5.019415481 1,879 faults
5.019415481 1,356 sched:sched_switch
2.000178813 8,468 faults
2.000178813 2,254 sched:sched_switch
4.000404621 7,440 faults
4.000404621 1,266 sched:sched_switch
5.040196079 2,458 faults
5.040196079 556 sched:sched_switch
2.000191939 6,870 faults
2.000191939 1,170 sched:sched_switch
4.000414103 541 faults
4.000414103 902 sched:sched_switch
5.000809863 450 faults
5.000809863 364 sched:sched_switch
#
Committer notes:
This was broken since the cset introducing the --interval feature, i.e.
--repeat + --interval wasn't tested at that point, add the Fixes tag so
that automatic scripts can pick this up.
Fixes: 13370a9b5bb8 ("perf stat: Add interval printing")
Signed-off-by: Srikar Dronamraju <srikar(a)linux.vnet.ibm.com>
Acked-by: Jiri Olsa <jolsa(a)kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme(a)redhat.com>
Tested-by: Ravi Bangoria <ravi.bangoria(a)linux.ibm.com>
Cc: Namhyung Kim <namhyung(a)kernel.org>
Cc: Naveen N. Rao <naveen.n.rao(a)linux.vnet.ibm.com>
Cc: Stephane Eranian <eranian(a)google.com>
Cc: stable(a)vger.kernel.org # v3.9+
Link: http://lore.kernel.org/lkml/20190904094738.9558-2-srikar@linux.vnet.ibm.com
[ Fixed up conflicts with libperf, i.e. some perf_{evsel,evlist} lost the 'perf' prefix ]
Signed-off-by: Arnaldo Carvalho de Melo <acme(a)redhat.com>
---
tools/perf/builtin-stat.c | 3 +++
tools/perf/util/stat.c | 17 +++++++++++++++++
tools/perf/util/stat.h | 1 +
3 files changed, 21 insertions(+)
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index eece3d1..fa4b148 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -1952,6 +1952,9 @@ int cmd_stat(int argc, const char **argv)
fprintf(output, "[ perf stat: executing run #%d ... ]\n",
run_idx + 1);
+ if (run_idx != 0)
+ perf_evlist__reset_prev_raw_counts(evsel_list);
+
status = run_perf_stat(argc, argv, run_idx);
if (forever && status != -1) {
print_counters(NULL, argc, argv);
diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
index 0657120..fcd5434 100644
--- a/tools/perf/util/stat.c
+++ b/tools/perf/util/stat.c
@@ -162,6 +162,15 @@ static void perf_evsel__free_prev_raw_counts(struct evsel *evsel)
evsel->prev_raw_counts = NULL;
}
+static void perf_evsel__reset_prev_raw_counts(struct evsel *evsel)
+{
+ if (evsel->prev_raw_counts) {
+ evsel->prev_raw_counts->aggr.val = 0;
+ evsel->prev_raw_counts->aggr.ena = 0;
+ evsel->prev_raw_counts->aggr.run = 0;
+ }
+}
+
static int perf_evsel__alloc_stats(struct evsel *evsel, bool alloc_raw)
{
int ncpus = perf_evsel__nr_cpus(evsel);
@@ -212,6 +221,14 @@ void perf_evlist__reset_stats(struct evlist *evlist)
}
}
+void perf_evlist__reset_prev_raw_counts(struct evlist *evlist)
+{
+ struct evsel *evsel;
+
+ evlist__for_each_entry(evlist, evsel)
+ perf_evsel__reset_prev_raw_counts(evsel);
+}
+
static void zero_per_pkg(struct evsel *counter)
{
if (counter->per_pkg_mask)
diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h
index 0f9c9f6..edbeb2f 100644
--- a/tools/perf/util/stat.h
+++ b/tools/perf/util/stat.h
@@ -193,6 +193,7 @@ void perf_stat__collect_metric_expr(struct evlist *);
int perf_evlist__alloc_stats(struct evlist *evlist, bool alloc_raw);
void perf_evlist__free_stats(struct evlist *evlist);
void perf_evlist__reset_stats(struct evlist *evlist);
+void perf_evlist__reset_prev_raw_counts(struct evlist *evlist);
int perf_stat_process_counter(struct perf_stat_config *config,
struct evsel *counter);
The following commit has been merged into the perf/urgent branch of tip:
Commit-ID: 443f2d5ba13d65ccfd879460f77941875159d154
Gitweb: https://git.kernel.org/tip/443f2d5ba13d65ccfd879460f77941875159d154
Author: Srikar Dronamraju <srikar(a)linux.vnet.ibm.com>
AuthorDate: Wed, 04 Sep 2019 15:17:38 +05:30
Committer: Arnaldo Carvalho de Melo <acme(a)redhat.com>
CommitterDate: Fri, 20 Sep 2019 10:28:26 -03:00
perf stat: Fix a segmentation fault when using repeat forever
Observe a segmentation fault when 'perf stat' is asked to repeat forever
with the interval option.
Without fix:
# perf stat -r 0 -I 5000 -e cycles -a sleep 10
# time counts unit events
5.000211692 3,13,89,82,34,157 cycles
10.000380119 1,53,98,52,22,294 cycles
10.040467280 17,16,79,265 cycles
Segmentation fault
This problem was only observed when we use forever option aka -r 0 and
works with limited repeats. Calling print_counter with ts being set to
NULL, is not a correct option when interval is set. Hence avoid
print_counter(NULL,..) if interval is set.
With fix:
# perf stat -r 0 -I 5000 -e cycles -a sleep 10
# time counts unit events
5.019866622 3,15,14,43,08,697 cycles
10.039865756 3,15,16,31,95,261 cycles
10.059950628 1,26,05,47,158 cycles
5.009902655 3,14,52,62,33,932 cycles
10.019880228 3,14,52,22,89,154 cycles
10.030543876 66,90,18,333 cycles
5.009848281 3,14,51,98,25,437 cycles
10.029854402 3,15,14,93,04,918 cycles
5.009834177 3,14,51,95,92,316 cycles
Committer notes:
Did the 'git bisect' to find the cset introducing the problem to add the
Fixes tag below, and at that time the problem reproduced as:
(gdb) run stat -r0 -I500 sleep 1
<SNIP>
Program received signal SIGSEGV, Segmentation fault.
print_interval (prefix=prefix@entry=0x7fffffffc8d0 "", ts=ts@entry=0x0) at builtin-stat.c:866
866 sprintf(prefix, "%6lu.%09lu%s", ts->tv_sec, ts->tv_nsec, csv_sep);
(gdb) bt
#0 print_interval (prefix=prefix@entry=0x7fffffffc8d0 "", ts=ts@entry=0x0) at builtin-stat.c:866
#1 0x000000000041860a in print_counters (ts=ts@entry=0x0, argc=argc@entry=2, argv=argv@entry=0x7fffffffd640) at builtin-stat.c:938
#2 0x0000000000419a7f in cmd_stat (argc=2, argv=0x7fffffffd640, prefix=<optimized out>) at builtin-stat.c:1411
#3 0x000000000045c65a in run_builtin (p=p@entry=0x6291b8 <commands+216>, argc=argc@entry=5, argv=argv@entry=0x7fffffffd640) at perf.c:370
#4 0x000000000045c893 in handle_internal_command (argc=5, argv=0x7fffffffd640) at perf.c:429
#5 0x000000000045c8f1 in run_argv (argcp=argcp@entry=0x7fffffffd4ac, argv=argv@entry=0x7fffffffd4a0) at perf.c:473
#6 0x000000000045cac9 in main (argc=<optimized out>, argv=<optimized out>) at perf.c:588
(gdb)
Mostly the same as just before this patch:
Program received signal SIGSEGV, Segmentation fault.
0x00000000005874a7 in print_interval (config=0xa1f2a0 <stat_config>, evlist=0xbc9b90, prefix=0x7fffffffd1c0 "`", ts=0x0) at util/stat-display.c:964
964 sprintf(prefix, "%6lu.%09lu%s", ts->tv_sec, ts->tv_nsec, config->csv_sep);
(gdb) bt
#0 0x00000000005874a7 in print_interval (config=0xa1f2a0 <stat_config>, evlist=0xbc9b90, prefix=0x7fffffffd1c0 "`", ts=0x0) at util/stat-display.c:964
#1 0x0000000000588047 in perf_evlist__print_counters (evlist=0xbc9b90, config=0xa1f2a0 <stat_config>, _target=0xa1f0c0 <target>, ts=0x0, argc=2, argv=0x7fffffffd670)
at util/stat-display.c:1172
#2 0x000000000045390f in print_counters (ts=0x0, argc=2, argv=0x7fffffffd670) at builtin-stat.c:656
#3 0x0000000000456bb5 in cmd_stat (argc=2, argv=0x7fffffffd670) at builtin-stat.c:1960
#4 0x00000000004dd2e0 in run_builtin (p=0xa30e00 <commands+288>, argc=5, argv=0x7fffffffd670) at perf.c:310
#5 0x00000000004dd54d in handle_internal_command (argc=5, argv=0x7fffffffd670) at perf.c:362
#6 0x00000000004dd694 in run_argv (argcp=0x7fffffffd4cc, argv=0x7fffffffd4c0) at perf.c:406
#7 0x00000000004dda11 in main (argc=5, argv=0x7fffffffd670) at perf.c:531
(gdb)
Fixes: d4f63a4741a8 ("perf stat: Introduce print_counters function")
Signed-off-by: Srikar Dronamraju <srikar(a)linux.vnet.ibm.com>
Acked-by: Jiri Olsa <jolsa(a)kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme(a)redhat.com>
Tested-by: Ravi Bangoria <ravi.bangoria(a)linux.ibm.com>
Cc: Namhyung Kim <namhyung(a)kernel.org>
Cc: Naveen N. Rao <naveen.n.rao(a)linux.vnet.ibm.com>
Cc: stable(a)vger.kernel.org # v4.2+
Link: http://lore.kernel.org/lkml/20190904094738.9558-3-srikar@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme(a)redhat.com>
---
tools/perf/builtin-stat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index fa4b148..60cdd38 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -1956,7 +1956,7 @@ int cmd_stat(int argc, const char **argv)
perf_evlist__reset_prev_raw_counts(evsel_list);
status = run_perf_stat(argc, argv, run_idx);
- if (forever && status != -1) {
+ if (forever && status != -1 && !interval) {
print_counters(NULL, argc, argv);
perf_stat__reset_stats();
}
From: Alexander Sverdlin <alexander.sverdlin(a)nokia.com>
irq_create_fwspec_mapping() can race with itself during IRQ trigger type
configuration. Possible scenarios include:
- Mapping exists, two irq_create_fwspec_mapping() running in parallel do
not detect type mismatch, IRQ remains configured with one of the
different trigger types randomly
- Second call to irq_create_fwspec_mapping() sees existing mapping just
created by first call, but earlier irqd_set_trigger_type() call races
with later irqd_set_trigger_type() => totally undetected, IRQ type
is being set randomly to either one or another type
Introduce helper function to detect parallel changes to IRQ type.
Cc: stable(a)vger.kernel.org
Signed-off-by: Alexander Sverdlin <alexander.sverdlin(a)nokia.com>
---
kernel/irq/irqdomain.c | 66 +++++++++++++++++++++++++++++---------------------
1 file changed, 38 insertions(+), 28 deletions(-)
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 176f2cc..af4d30c 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -764,10 +764,45 @@ static void of_phandle_args_to_fwspec(struct device_node *np, const u32 *args,
fwspec->param[i] = args[i];
}
+/* Detect races during IRQ type setting */
+static int irq_set_trigger_type_locked(unsigned int virq, unsigned int type,
+ irq_hw_number_t hwirq,
+ const struct irq_fwspec *fwspec)
+{
+ struct irq_data *irq_data;
+ int ret = 0;
+
+ mutex_lock(&irq_domain_mutex);
+ /*
+ * If the trigger type is not specified or matches the current trigger
+ * type then we are done.
+ */
+ if (type == IRQ_TYPE_NONE || type == irq_get_trigger_type(virq))
+ goto unlock;
+
+ /* If the trigger type has not been set yet, then set it now */
+ if (irq_get_trigger_type(virq) != IRQ_TYPE_NONE) {
+ pr_warn("type mismatch, failed to map hwirq-%lu for %s!\n",
+ hwirq, of_node_full_name(to_of_node(fwspec->fwnode)));
+ ret = -EINVAL;
+ goto unlock;
+ }
+
+ irq_data = irq_get_irq_data(virq);
+ if (!irq_data) {
+ ret = -ENOENT;
+ goto unlock;
+ }
+ irqd_set_trigger_type(irq_data, type);
+
+unlock:
+ mutex_unlock(&irq_domain_mutex);
+ return ret;
+}
+
unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec)
{
struct irq_domain *domain;
- struct irq_data *irq_data;
irq_hw_number_t hwirq;
unsigned int type = IRQ_TYPE_NONE;
int virq;
@@ -802,29 +837,8 @@ unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec)
*/
virq = irq_find_mapping(domain, hwirq);
if (virq) {
- /*
- * If the trigger type is not specified or matches the
- * current trigger type then we are done so return the
- * interrupt number.
- */
- if (type == IRQ_TYPE_NONE || type == irq_get_trigger_type(virq))
- return virq;
-
- /*
- * If the trigger type has not been set yet, then set
- * it now and return the interrupt number.
- */
- if (irq_get_trigger_type(virq) == IRQ_TYPE_NONE) {
- irq_data = irq_get_irq_data(virq);
- if (!irq_data)
- return 0;
-
- irqd_set_trigger_type(irq_data, type);
+ if (!irq_set_trigger_type_locked(virq, type, hwirq, fwspec))
return virq;
- }
-
- pr_warn("type mismatch, failed to map hwirq-%lu for %s!\n",
- hwirq, of_node_full_name(to_of_node(fwspec->fwnode)));
return 0;
}
@@ -839,8 +853,7 @@ unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec)
return virq;
}
- irq_data = irq_get_irq_data(virq);
- if (!irq_data) {
+ if (irq_set_trigger_type_locked(virq, type, hwirq, fwspec)) {
if (irq_domain_is_hierarchy(domain))
irq_domain_free_irqs(virq, 1);
else
@@ -848,9 +861,6 @@ unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec)
return 0;
}
- /* Store trigger type */
- irqd_set_trigger_type(irq_data, type);
-
return virq;
}
EXPORT_SYMBOL_GPL(irq_create_fwspec_mapping);
--
2.4.6
commit 6953c57ab172 "gpio: of: Handle SPI chipselect legacy bindings"
did introduce logic to centrally handle the legacy spi-cs-high property
in combination with cs-gpios. This assumes that the polarity
of the CS has to be inverted if spi-cs-high is missing, even
and especially if non-legacy GPIO_ACTIVE_HIGH is specified.
The DTS for the GTA04 was orginally introduced under the assumption
that there is no need for spi-cs-high if the gpio is defined with
proper polarity GPIO_ACTIVE_HIGH.
This was not a problem until gpiolib changed the interpretation of
GPIO_ACTIVE_HIGH and missing spi-cs-high.
The effect is that the missing spi-cs-high is now interpreted as CS being
low (despite GPIO_ACTIVE_HIGH) which turns off the SPI interface when the
panel is to be programmed by the panel driver.
Therefore, we have to add the redundant and legacy spi-cs-high property
to properly pass through the legacy handler.
Since this is nowhere documented in the bindings, we add some words of
WARNING.
Cc: stable(a)vger.kernel.org
Signed-off-by: H. Nikolaus Schaller <hns(a)goldelico.com>
---
Documentation/devicetree/bindings/spi/spi-bus.txt | 6 ++++++
arch/arm/boot/dts/omap3-gta04.dtsi | 1 +
2 files changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/spi/spi-bus.txt b/Documentation/devicetree/bindings/spi/spi-bus.txt
index 1f6e86f787ef..982aa590058b 100644
--- a/Documentation/devicetree/bindings/spi/spi-bus.txt
+++ b/Documentation/devicetree/bindings/spi/spi-bus.txt
@@ -47,6 +47,10 @@ cs1 : native
cs2 : &gpio1 1 0
cs3 : &gpio1 2 0
+WARNING: the polarity of cs-gpios may be inverted in some cases compared
+to what is specified in the third parameter. In that case the spi-cs-high
+property must be defined for slave nodes.
+
SPI slave nodes must be children of the SPI controller node.
@@ -69,6 +73,8 @@ All slave nodes can contain the following optional properties:
phase (CPHA) mode.
- spi-cs-high - Empty property indicating device requires chip select
active high.
+ WARNING: this is especially required even if the cs-gpios
+ define the gpio as GPIO_ACTIVE_HIGH
- spi-3wire - Empty property indicating device requires 3-wire mode.
- spi-lsb-first - Empty property indicating device requires LSB first mode.
- spi-tx-bus-width - The bus width (number of data wires) that is used for MOSI.
diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi b/arch/arm/boot/dts/omap3-gta04.dtsi
index 9a9a29fe88ec..47bab8e1040e 100644
--- a/arch/arm/boot/dts/omap3-gta04.dtsi
+++ b/arch/arm/boot/dts/omap3-gta04.dtsi
@@ -124,6 +124,7 @@
spi-max-frequency = <100000>;
spi-cpol;
spi-cpha;
+ spi-cs-high;
backlight= <&backlight>;
label = "lcd";
--
2.19.1
From: Alexander Sverdlin <alexander.sverdlin(a)nokia.com>
irq_domain_associate() is the only place where irq_find_mapping() can be
used reliably (under irq_domain_mutex) to make a decision if the mapping
shall be created or not. Other calls to irq_find_mapping() (not under
any lock) cannot be used for this purpose and lead to race conditions in
particular inside irq_create_mapping().
Give the callers of irq_domain_associate() an ability to detect existing
domain reliably by examining the return value.
Cc: stable(a)vger.kernel.org
Signed-off-by: Alexander Sverdlin <alexander.sverdlin(a)nokia.com>
---
kernel/irq/irqdomain.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 3078d0e..7bc07b6 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -532,6 +532,7 @@ int irq_domain_associate(struct irq_domain *domain, unsigned int virq,
irq_hw_number_t hwirq)
{
struct irq_data *irq_data = irq_get_irq_data(virq);
+ unsigned int eirq;
int ret;
if (WARN(hwirq >= domain->hwirq_max,
@@ -543,6 +544,16 @@ int irq_domain_associate(struct irq_domain *domain, unsigned int virq,
return -EINVAL;
mutex_lock(&irq_domain_mutex);
+
+ /* Check if mapping already exists */
+ eirq = irq_find_mapping(domain, hwirq);
+ if (eirq) {
+ mutex_unlock(&irq_domain_mutex);
+ pr_debug("%s: conflicting mapping for hwirq 0x%x\n",
+ domain->name, (int)hwirq);
+ return -EBUSY;
+ }
+
irq_data->hwirq = hwirq;
irq_data->domain = domain;
if (domain->ops->map) {
--
2.4.6