Commit Graph

1066133 Commits

Author SHA1 Message Date
Charan Teja Kalla
826d2d5fb3 UPSTREAM: mm/page_exit: fix kernel doc warning in page_ext_put()
Fix the below compiler warnings reported with 'make W=1 mm/'.
mm/page_ext.c:178: warning: Function parameter or member 'page_ext' not
described in 'page_ext_put'.

Bug: 254441685
[quic_pkondeti@quicinc.com: better patch title]
Link: https://lkml.kernel.org/r/1667884582-2465-1-git-send-email-quic_charante@quicinc.com
Fixes: b1d5488a25 ("mm: fix use-after free of page_ext after race with memory-offline")
Signed-off-by: Charan Teja Kalla <quic_charante@quicinc.com>
Reported-by: Vlastimil Babka <vbabka@suse.cz>
Tested-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Pavan Kondeti <quic_pkondeti@quicinc.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit ed86b74874)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I1bb50ab9b95a01462a3e6622e43cfd969fcaabaf
2023-03-08 12:48:28 +00:00
Sebastian Andrzej Siewior
093fc8a857 BACKPORT: mm: multi-gen LRU: move lru_gen_add_mm() out of IRQ-off region
lru_gen_add_mm() has been added within an IRQ-off region in the commit
mentioned below.  The other invocations of lru_gen_add_mm() are not within
an IRQ-off region.

The invocation within IRQ-off region is problematic on PREEMPT_RT because
the function is using a spin_lock_t which must not be used within
IRQ-disabled regions.

The other invocations of lru_gen_add_mm() occur while
task_struct::alloc_lock is acquired.  Move lru_gen_add_mm() after
interrupts are enabled and before task_unlock().

Bug: 254441685
Link: https://lkml.kernel.org/r/20221026134830.711887-1-bigeasy@linutronix.de
Fixes: bd74fdaea1 ("mm: multi-gen LRU: support page table walks")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Yu Zhao <yuzhao@google.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: "Eric W . Biederman" <ebiederm@xmission.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit dda1c41a07)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: If85c9bf03c4ffa47cd0e79db2f75fdb0ff92ce0a
2023-03-08 10:56:49 +00:00
Johannes Berg
cd1848bb97 UPSTREAM: wifi: fix multi-link element subelement iteration
The subelements obviously start after the common data, including
the common multi-link element structure definition itself. This
bug was possibly just hidden by the higher bits of the control
being set to 0, so the iteration just found one bogus element
and most of the code could continue anyway.

Bug: 254441685
Fixes: 0f48b8b88a ("wifi: ieee80211: add definitions for multi-link element")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
(cherry picked from commit 1177aaa7fe)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I068a4a16eaad463ada5ba976fc065d0ddb058195
2023-03-08 10:55:10 +00:00
Ilkka Koskinen
d886fe15e5 UPSTREAM: perf/arm-cmn: Add more bits to child node address offset field
CMN-600 uses bits [27:0] for child node address offset while bits [30:28]
are required to be zero.

For CMN-650, the child node address offset field has been increased
to include bits [29:0] while leaving only bit 30 set to zero.

Let's include the missing two bits and assume older implementations
comply with the spec and set bits [29:28] to 0.

Bug: 254441685
Signed-off-by: Ilkka Koskinen <ilkka@os.amperecomputing.com>
Fixes: 60d1504070 ("perf/arm-cmn: Support new IP features")
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Link: https://lore.kernel.org/r/20220808195455.79277-1-ilkka@os.amperecomputing.com
Signed-off-by: Will Deacon <will@kernel.org>
(cherry picked from commit 05d6f6d346)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I8d4048e6bca6498c04b10f31bc188bebdf3f716b
2023-03-08 10:55:00 +00:00
Vincent Whitchurch
375c07024f UPSTREAM: um: Prevent KASAN splats in dump_stack()
Use READ_ONCE_NOCHECK() when reading the stack to prevent KASAN splats
when dump_stack() is used.

Bug: 254441685
Fixes: 5b301409e8 ("UML: add support for KASAN under x86_64")
Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
(cherry picked from commit 2975e4a282)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I592c51099761e9eef0b24a40ea427d5d2ab0bacf
2023-03-08 10:54:50 +00:00
Johannes Berg
189eab64d6 UPSTREAM: wifi: mac80211: set STA deflink addresses
We should set the STA deflink addresses in case no
link is really added.

Bug: 254441685
Fixes: 046d2e7c50 ("mac80211: prepare sta handling for MLO support")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
(cherry picked from commit 630c7e4621)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I709a549c3394926c67e003ed4b923dfafd18b4df
2023-03-08 10:52:56 +00:00
Robin Murphy
04256d656a UPSTREAM: perf/arm-cmn: Update watchpoint format
From CMN-650 onwards, some of the fields in the watchpoint config
registers moved subtly enough to easily overlook. Watchpoint events are
still only partially supported on newer IPs - which in itself deserves
noting - but were not intended to become any *less* functional than on
CMN-600.

Bug: 254441685
Fixes: 60d1504070 ("perf/arm-cmn: Support new IP features")
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Link: https://lore.kernel.org/r/e1ce4c2f1e4f73ab1c60c3a85e4037cd62dd6352.1645727871.git.robin.murphy@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
(cherry picked from commit 31fac56577)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I09f3740c63f90e49d84bc2d0ddd6176cd5869db3
2023-03-08 10:52:40 +00:00
Robin Murphy
3d91136e5f UPSTREAM: perf/arm-cmn: Hide XP PUB events for CMN-600
CMN-600 doesn't have XP events for the PUB channel, but we missed
the appropriate check to avoid exposing them.

Bug: 254441685
Fixes: 60d1504070 ("perf/arm-cmn: Support new IP features")
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Link: https://lore.kernel.org/r/4c108d39a0513def63acccf09ab52b328f242aeb.1645727871.git.robin.murphy@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
(cherry picked from commit 205295c7e1)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: Ib1c3b70521e400c598da9795a619bf89906b00f1
2023-03-08 10:52:22 +00:00
Kalesh Singh
d55097f6e1 ANDROID: GKI: Enable MGLRU by default
MGLRU has been tested and edge cases addressed on Android workloads;
after which the MGLRU showed good results across various performance
metrics. Enable the MGLRU as default memory reclaim in algorithm.

Bug: 261619133
Change-Id: I7ed7fbfd6ef9ce10053347528125dd98c39e50bf
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2023-03-07 14:07:37 -08:00
Ziyi Cui
d1997061bf ANDROID: Update the ABI representation
2 function symbol(s) added
  'int __traceiter_android_vh_early_resume_begin(void *, void *)'
  'int __traceiter_android_vh_resume_end(void *, void *)'

2 variable symbol(s) added
  'struct tracepoint __tracepoint_android_vh_early_resume_begin'
  'struct tracepoint __tracepoint_android_vh_resume_end'

Bug: 241946090
Change-Id: I121a773db4985b0fdd813ee19501b15f7341a4db
Signed-off-by: Ziyi Cui <ziyic@google.com>
2023-03-06 22:45:57 +00:00
Ziyi Cui
e37120d7e9 ANDROID: Update the ABI representation
4 function symbol(s) added
  'int __traceiter_irq_handler_entry(void *, int, struct irqaction *)'
  'int __traceiter_irq_handler_exit(void *, int, struct irqaction *, int)'
  'int __traceiter_softirq_entry(void *, unsigned int)'
  'int __traceiter_softirq_exit(void *, unsigned int)'

4 variable symbol(s) added
  'struct tracepoint __tracepoint_irq_handler_entry'
  'struct tracepoint __tracepoint_irq_handler_exit'
  'struct tracepoint __tracepoint_softirq_entry'
  'struct tracepoint __tracepoint_softirq_exit'

Bug: 227809911
Change-Id: I6819c85eba6ba363a8e80885475369569b680c96
Signed-off-by: Ziyi Cui <ziyic@google.com>
2023-03-06 22:14:37 +00:00
Sandeep Dhavale
076e5e1c4b ANDROID: Enable percpu high priority kthreads for erofs
This change enables 2 configs
CONFIG_EROFS_FS_PCPU_KTHREAD
CONFIG_EROFS_FS_PCPU_KTHREAD_HIPRI

With these changes scheduling latency is reduced by ~80%
Bug: 271635890
Tests: launch_cvd
Change-Id: I91076edd3c7dcbb3497ca0accf98af28c43f4ffb
Signed-off-by: Sandeep Dhavale <dhavale@google.com>
(cherry picked from commit f8e756a6f7)
2023-03-06 21:31:40 +00:00
Dan Carpenter
bd738f0379 UPSTREAM: erofs: fix an error code in z_erofs_init_zip_subsystem()
Return -ENOMEM if alloc_workqueue() fails.  Don't return success.

Fixes: d8a650adf429 ("erofs: add per-cpu threads for decompression as an option")
Bug: 271635890
Tests: launch_cvd
Change-Id: I49dcf8094655db47ac71ae8967b5402373fc7adc
Signed-off-by: Dan Carpenter <error27@gmail.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/Y+4d0FRsUq8jPoOu@kili
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
(cherry picked from commit 8d1b80a794)
Signed-off-by: Sandeep Dhavale <dhavale@google.com>
(cherry picked from commit 5004cc6557)
2023-03-06 21:31:40 +00:00
Sandeep Dhavale
230af20212 BACKPORT: erofs: add per-cpu threads for decompression as an option
Using per-cpu thread pool we can reduce the scheduling latency compared
to workqueue implementation. With this patch scheduling latency and
variation is reduced as per-cpu threads are high priority kthread_workers.

The results were evaluated on arm64 Android devices running 5.10 kernel.

The table below shows resulting improvements of total scheduling latency
for the same app launch benchmark runs with 50 iterations. Scheduling
latency is the latency between when the task (workqueue kworker vs
kthread_worker) became eligible to run to when it actually started
running.
+-------------------------+-----------+----------------+---------+
|                         | workqueue | kthread_worker |  diff   |
+-------------------------+-----------+----------------+---------+
| Average (us)            |     15253 |           2914 | -80.89% |
| Median (us)             |     14001 |           2912 | -79.20% |
| Minimum (us)            |      3117 |           1027 | -67.05% |
| Maximum (us)            |     30170 |           3805 | -87.39% |
| Standard deviation (us) |      7166 |            359 |         |
+-------------------------+-----------+----------------+---------+

Background: Boot times and cold app launch benchmarks are very
important to the Android ecosystem as they directly translate to
responsiveness from user point of view. While EROFS provides
a lot of important features like space savings, we saw some
performance penalty in cold app launch benchmarks in few scenarios.
Analysis showed that the significant variance was coming from the
scheduling cost while decompression cost was more or less the same.

Having per-cpu thread pool we can see from the above table that this
variation is reduced by ~80% on average. This problem was discussed
at LPC 2022. Link to LPC 2022 slides and talk at [1]

[1] https://lpc.events/event/16/contributions/1338/

[ Gao Xiang: At least, we have to add this until WQ_UNBOUND workqueue
             issue [2] on many arm64 devices is resolved. ]
[2] https://lore.kernel.org/r/CAJkfWY490-m6wNubkxiTPsW59sfsQs37Wey279LmiRxKt7aQYg@mail.gmail.com

Bug: 271635890
Test: launch_cvd
Change-Id: I9dce2bfd6f40ec6a210161b80cee7c0417b4edb3
Signed-off-by: Sandeep Dhavale <dhavale@google.com>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20230208093322.75816-1-hsiangkao@linux.alibaba.com
(cherry picked from commit 3fffb589b9)
[dhavale: Fixed minor conflict as upstream now has zdata.h folded in
zdata.c]
Signed-off-by: Sandeep Dhavale <dhavale@google.com>
(cherry picked from commit 566a7f6c6b)
[dhavale: Fixed minor conflicts in Kconfig and zdata.c]
2023-03-06 21:31:40 +00:00
Kuen-Han Tsai
443a4864f9 ANDROID: usb: gadget: f_accessory: update to usb_gstrings_attach
For AOA re-connection, since the string ID of accessory has been changed
into a non-zero value, the f_accessory failes to call `usb_string_id` to
increment `next_string_id`. This makes the ADB interface display a wrong
name.

Bug: 270044830
Test: CTS Verifier: USB Accessory Test
Test: manual test
Signed-off-by: Kuen-Han Tsai <khtsai@google.com>
Change-Id: I807164588e80b28065e8715591a100392b04d3de
2023-03-04 02:25:34 +00:00
Greg Kroah-Hartman
b07c76f009 Merge 5.15.98 into android14-5.15
Changes in 5.15.98
	io_uring: ensure that io_init_req() passes in the right issue_flags
	Linux 5.15.98

Change-Id: I3d843bbf562cf5da5fc71adef802990dd2841add
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2023-03-03 14:56:56 +00:00
Greg Kroah-Hartman
d9b4a0c83a Linux 5.15.98
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-03 15:14:09 +01:00
Jens Axboe
937c15e27a io_uring: ensure that io_init_req() passes in the right issue_flags
We can't use 0 here, as io_init_req() is always invoked with the
ctx uring_lock held. Newer kernels have IO_URING_F_UNLOCKED for this,
but previously we used IO_URING_F_NONBLOCK to indicate this as well.

Fixes: cf7f9cd500 ("io_uring: add missing lock in io_get_file_fixed")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-03 15:14:08 +01:00
Greg Kroah-Hartman
b1675a31be Merge 5.15.97 into android14-5.15
Changes in 5.15.97
	ionic: refactor use of ionic_rx_fill()
	Fix XFRM-I support for nested ESP tunnels
	arm64: dts: rockchip: drop unused LED mode property from rk3328-roc-cc
	ARM: dts: rockchip: add power-domains property to dp node on rk3288
	HID: elecom: add support for TrackBall 056E:011C
	ACPI: NFIT: fix a potential deadlock during NFIT teardown
	btrfs: send: limit number of clones and allocated memory size
	ASoC: rt715-sdca: fix clock stop prepare timeout issue
	IB/hfi1: Assign npages earlier
	neigh: make sure used and confirmed times are valid
	HID: core: Fix deadloop in hid_apply_multiplier.
	x86/cpu: Add Lunar Lake M
	staging: mt7621-dts: change palmbus address to lower case
	bpf: bpf_fib_lookup should not return neigh in NUD_FAILED state
	net: Remove WARN_ON_ONCE(sk->sk_forward_alloc) from sk_stream_kill_queues().
	vc_screen: don't clobber return value in vcs_read
	scripts/tags.sh: Invoke 'realpath' via 'xargs'
	scripts/tags.sh: fix incompatibility with PCRE2
	usb: dwc3: pci: add support for the Intel Meteor Lake-M
	USB: serial: option: add support for VW/Skoda "Carstick LTE"
	usb: gadget: u_serial: Add null pointer check in gserial_resume
	USB: core: Don't hold device lock while reading the "descriptors" sysfs file
	io_uring: add missing lock in io_get_file_fixed
	Linux 5.15.97

Change-Id: I7e043d6a6dce3cdedde819bebe654689b644de3c
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2023-03-03 12:15:22 +00:00
Greg Kroah-Hartman
bf7123dd26 Linux 5.15.97
Link: https://lore.kernel.org/r/20230301180652.658125575@linuxfoundation.org
Tested-by: Slade Watkins <srw@sladewatkins.net>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Shuah Khan <skhan@linuxfoundation.org>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Bagas Sanjaya <bagasdotme@gmail.com>
Tested-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Ron Economos <re@w6rz.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-03 11:45:54 +01:00
Bing-Jhong Billy Jheng
cf7f9cd500 io_uring: add missing lock in io_get_file_fixed
io_get_file_fixed will access io_uring's context. Lock it if it is
invoked unlocked (eg via io-wq) to avoid a race condition with fixed
files getting unregistered.

No single upstream patch exists for this issue, it was fixed as part
of the file assignment changes that went into the 5.18 cycle.

Signed-off-by: Jheng, Bing-Jhong Billy <billy@starlabs.sg>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-03 11:45:54 +01:00
Alan Stern
7735809333 USB: core: Don't hold device lock while reading the "descriptors" sysfs file
commit 45bf39f8df upstream.

Ever since commit 83e83ecb79 ("usb: core: get config and string
descriptors for unauthorized devices") was merged in 2013, there has
been no mechanism for reallocating the rawdescriptors buffers in
struct usb_device after the initial enumeration.  Before that commit,
the buffers would be deallocated when a device was deauthorized and
reallocated when it was authorized and enumerated.

This means that the locking in the read_descriptors() routine is not
needed, since the buffers it reads will never be reallocated while the
routine is running.  This locking can interfere with user programs
trying to read a hub's descriptors via sysfs while new child devices
of the hub are being initialized, since the hub is locked during this
procedure.

Since the locking in read_descriptors() hasn't been needed for over
nine years, we can remove it.

Reported-and-tested-by: Troels Liebe Bentsen <troels@connectedcars.dk>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: stable@vger.kernel.org
Link: https://lore.kernel.org/r/Y9l+wDTRbuZABzsE@rowland.harvard.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-03 11:45:54 +01:00
Prashanth K
3b24c980dc usb: gadget: u_serial: Add null pointer check in gserial_resume
commit 5ec63fdbca upstream.

Consider a case where gserial_disconnect has already cleared
gser->ioport. And if a wakeup interrupt triggers afterwards,
gserial_resume gets called, which will lead to accessing of
gser->ioport and thus causing null pointer dereference.Add
a null pointer check to prevent this.

Added a static spinlock to prevent gser->ioport from becoming
null after the newly added check.

Fixes: aba3a8d01d ("usb: gadget: u_serial: add suspend resume callbacks")
Cc: stable <stable@kernel.org>
Signed-off-by: Prashanth K <quic_prashk@quicinc.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/1676309438-14922-1-git-send-email-quic_prashk@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-03 11:45:54 +01:00
Florian Zumbiehl
2d72795ccd USB: serial: option: add support for VW/Skoda "Carstick LTE"
commit 617c331d91 upstream.

Add support for VW/Skoda "Carstick LTE"

D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1c9e ProdID=7605 Rev=02.00
S:  Manufacturer=USB Modem
S:  Product=USB Modem
C:  #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA
I:  If#=0x0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
I:  If#=0x1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
I:  If#=0x3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)

The stick has AT command interfaces on interfaces 1, 2, and 3, and does PPP
on interface 3.

Signed-off-by: Florian Zumbiehl <florz@florz.de>
Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-03 11:45:54 +01:00
Heikki Krogerus
02190d23b7 usb: dwc3: pci: add support for the Intel Meteor Lake-M
commit 8e5248c3a8 upstream.

This patch adds the necessary PCI IDs for Intel Meteor Lake-M
devices.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20230215132711.35668-1-heikki.krogerus@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-03 11:45:54 +01:00
Carlos Llamas
cc09a7d5a6 scripts/tags.sh: fix incompatibility with PCRE2
commit 6ec363fc61 upstream.

Starting with release 10.38 PCRE2 drops default support for using \K in
lookaround patterns as described in [1]. Unfortunately, scripts/tags.sh
relies on such functionality to collect all_compiled_soures() leading to
the following error:

  $ make COMPILED_SOURCE=1 tags
    GEN     tags
  grep: \K is not allowed in lookarounds (but see PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK)

The usage of \K for this pattern was introduced in commit 4f491bb6ea
("scripts/tags.sh: collect compiled source precisely") which speeds up
the generation of tags significantly.

In order to fix this issue without compromising the performance we can
switch over to an equivalent sed expression. The same matching pattern
is preserved here except \K is replaced with a backreference \1.

[1] https://www.pcre.org/current/doc/html/pcre2syntax.html#SEC11

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Jialu Xu <xujialu@vimux.org>
Cc: Vipin Sharma <vipinsh@google.com>
Cc: stable@vger.kernel.org
Fixes: 4f491bb6ea ("scripts/tags.sh: collect compiled source precisely")
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Link: https://lore.kernel.org/r/20230215183850.3353198-1-cmllamas@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-03 11:45:53 +01:00
Cristian Ciocaltea
1aee4ab2c1 scripts/tags.sh: Invoke 'realpath' via 'xargs'
commit 7394d2ebb6 upstream.

When COMPILED_SOURCE is set, running

  make ARCH=x86_64 COMPILED_SOURCE=1 cscope tags

could throw the following errors:

scripts/tags.sh: line 98: /usr/bin/realpath: Argument list too long
cscope: no source files found
scripts/tags.sh: line 98: /usr/bin/realpath: Argument list too long
ctags: No files specified. Try "ctags --help".

This is most likely to happen when the kernel is configured to build a
large number of modules, which has the consequence of passing too many
arguments when calling 'realpath' in 'all_compiled_sources()'.

Let's improve this by invoking 'realpath' through 'xargs', which takes
care of properly limiting the argument list.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Link: https://lore.kernel.org/r/20220516234646.531208-1-cristian.ciocaltea@collabora.com
Cc: Carlos Llamas <cmllamas@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-03 11:45:53 +01:00
Thomas Weißschuh
06740b433d vc_screen: don't clobber return value in vcs_read
commit ae3419fbac upstream.

Commit 226fae124b ("vc_screen: move load of struct vc_data pointer in
vcs_read() to avoid UAF") moved the call to vcs_vc() into the loop.

While doing this it also moved the unconditional assignment of

	ret = -ENXIO;

This unconditional assignment was valid outside the loop but within it
it clobbers the actual value of ret.

To avoid this only assign "ret = -ENXIO" when actually needed.

[ Also, the 'goto unlock_out" needs to be just a "break", so that it
  does the right thing when it exits on later iterations when partial
  success has happened - Linus ]

Reported-by: Storm Dragon <stormdragon2976@gmail.com>
Link: https://lore.kernel.org/lkml/Y%2FKS6vdql2pIsCiI@hotmail.com/
Fixes: 226fae124b ("vc_screen: move load of struct vc_data pointer in vcs_read() to avoid UAF")
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/lkml/64981d94-d00c-4b31-9063-43ad0a384bde@t-8ch.de/
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-03 11:45:53 +01:00
Kuniyuki Iwashima
e7f4606963 net: Remove WARN_ON_ONCE(sk->sk_forward_alloc) from sk_stream_kill_queues().
commit 62ec33b44e upstream.

Christoph Paasch reported that commit b5fc29233d ("inet6: Remove
inet6_destroy_sock() in sk->sk_prot->destroy().") started triggering
WARN_ON_ONCE(sk->sk_forward_alloc) in sk_stream_kill_queues().  [0 - 2]
Also, we can reproduce it by a program in [3].

In the commit, we delay freeing ipv6_pinfo.pktoptions from sk->destroy()
to sk->sk_destruct(), so sk->sk_forward_alloc is no longer zero in
inet_csk_destroy_sock().

The same check has been in inet_sock_destruct() from at least v2.6,
we can just remove the WARN_ON_ONCE().  However, among the users of
sk_stream_kill_queues(), only CAIF is not calling inet_sock_destruct().
Thus, we add the same WARN_ON_ONCE() to caif_sock_destructor().

[0]: https://lore.kernel.org/netdev/39725AB4-88F1-41B3-B07F-949C5CAEFF4F@icloud.com/
[1]: https://github.com/multipath-tcp/mptcp_net-next/issues/341
[2]:
WARNING: CPU: 0 PID: 3232 at net/core/stream.c:212 sk_stream_kill_queues+0x2f9/0x3e0
Modules linked in:
CPU: 0 PID: 3232 Comm: syz-executor.0 Not tainted 6.2.0-rc5ab24eb4698afbe147b424149c529e2a43ec24eb5 #2
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
RIP: 0010:sk_stream_kill_queues+0x2f9/0x3e0
Code: 03 0f b6 04 02 84 c0 74 08 3c 03 0f 8e ec 00 00 00 8b ab 08 01 00 00 e9 60 ff ff ff e8 d0 5f b6 fe 0f 0b eb 97 e8 c7 5f b6 fe <0f> 0b eb a0 e8 be 5f b6 fe 0f 0b e9 6a fe ff ff e8 02 07 e3 fe e9
RSP: 0018:ffff88810570fc68 EFLAGS: 00010293
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: ffff888101f38f40 RSI: ffffffff8285e529 RDI: 0000000000000005
RBP: 0000000000000ce0 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000ce0 R11: 0000000000000001 R12: ffff8881009e9488
R13: ffffffff84af2cc0 R14: 0000000000000000 R15: ffff8881009e9458
FS:  00007f7fdfbd5800(0000) GS:ffff88811b600000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b32923000 CR3: 00000001062fc006 CR4: 0000000000170ef0
Call Trace:
 <TASK>
 inet_csk_destroy_sock+0x1a1/0x320
 __tcp_close+0xab6/0xe90
 tcp_close+0x30/0xc0
 inet_release+0xe9/0x1f0
 inet6_release+0x4c/0x70
 __sock_release+0xd2/0x280
 sock_close+0x15/0x20
 __fput+0x252/0xa20
 task_work_run+0x169/0x250
 exit_to_user_mode_prepare+0x113/0x120
 syscall_exit_to_user_mode+0x1d/0x40
 do_syscall_64+0x48/0x90
 entry_SYSCALL_64_after_hwframe+0x72/0xdc
RIP: 0033:0x7f7fdf7ae28d
Code: c1 20 00 00 75 10 b8 03 00 00 00 0f 05 48 3d 01 f0 ff ff 73 31 c3 48 83 ec 08 e8 ee fb ff ff 48 89 04 24 b8 03 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 37 fc ff ff 48 89 d0 48 83 c4 08 48 3d 01
RSP: 002b:00000000007dfbb0 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000004 RCX: 00007f7fdf7ae28d
RDX: 0000000000000000 RSI: ffffffffffffffff RDI: 0000000000000003
RBP: 0000000000000000 R08: 000000007f338e0f R09: 0000000000000e0f
R10: 000000007f338e13 R11: 0000000000000293 R12: 00007f7fdefff000
R13: 00007f7fdefffcd8 R14: 00007f7fdefffce0 R15: 00007f7fdefffcd8
 </TASK>

[3]: https://lore.kernel.org/netdev/20230208004245.83497-1-kuniyu@amazon.com/

Fixes: b5fc29233d ("inet6: Remove inet6_destroy_sock() in sk->sk_prot->destroy().")
Reported-by: syzbot <syzkaller@googlegroups.com>
Reported-by: Christoph Paasch <christophpaasch@icloud.com>
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-03 11:45:53 +01:00
Martin KaFai Lau
16d319ec18 bpf: bpf_fib_lookup should not return neigh in NUD_FAILED state
commit 1fe4850b34 upstream.

The bpf_fib_lookup() helper does not only look up the fib (ie. route)
but it also looks up the neigh. Before returning the neigh, the helper
does not check for NUD_VALID. When a neigh state (neigh->nud_state)
is in NUD_FAILED, its dmac (neigh->ha) could be all zeros. The helper
still returns SUCCESS instead of NO_NEIGH in this case. Because of the
SUCCESS return value, the bpf prog directly uses the returned dmac
and ends up filling all zero in the eth header.

This patch checks for NUD_VALID and returns NO_NEIGH if the neigh is
not valid.

Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20230217004150.2980689-3-martin.lau@linux.dev
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-03 11:45:53 +01:00
Sergio Paracuellos
6dd1de27d7 staging: mt7621-dts: change palmbus address to lower case
commit efbc7bd90f upstream.

Hexadecimal addresses in device tree must be defined using lower case.
Change missing one in 'gbpc1.dts' file.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Link: https://lore.kernel.org/r/20211019102915.15409-1-sergio.paracuellos@gmail.com
Cc: Arınç ÜNAL <arinc.unal@arinc9.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-03 11:45:53 +01:00
Kan Liang
07f0c6f9c3 x86/cpu: Add Lunar Lake M
[ Upstream commit f545e8831e ]

Intel confirmed the existence of this CPU in Q4'2022
earnings presentation.

Add the CPU model number.

[ dhansen: Merging these as soon as possible makes it easier
	   on all the folks developing model-specific features. ]

Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Link: https://lore.kernel.org/all/20230208172340.158548-1-tony.luck%40intel.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-03-03 11:45:53 +01:00
Xin Zhao
e1b09162f2 HID: core: Fix deadloop in hid_apply_multiplier.
[ Upstream commit ea427a222d ]

The initial value of hid->collection[].parent_idx if 0. When
Report descriptor doesn't contain "HID Collection", the value
remains as 0.

In the meanwhile, when the Report descriptor fullfill
all following conditions, it will trigger hid_apply_multiplier
function call.
1. Usage page is Generic Desktop Ctrls (0x01)
2. Usage is RESOLUTION_MULTIPLIER (0x48)
3. Contain any FEATURE items

The while loop in hid_apply_multiplier will search the top-most
collection by searching parent_idx == -1. Because all parent_idx
is 0. The loop will run forever.

There is a Report Descriptor triggerring the deadloop
0x05, 0x01,        // Usage Page (Generic Desktop Ctrls)
0x09, 0x48,        // Usage (0x48)
0x95, 0x01,        // Report Count (1)
0x75, 0x08,        // Report Size (8)
0xB1, 0x01,        // Feature

Signed-off-by: Xin Zhao <xnzhao@google.com>
Link: https://lore.kernel.org/r/20230130212947.1315941-1-xnzhao@google.com
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-03-03 11:45:52 +01:00
Julian Anastasov
f1ee470030 neigh: make sure used and confirmed times are valid
[ Upstream commit c1d2ecdf5e ]

Entries can linger in cache without timer for days, thanks to
the gc_thresh1 limit. As result, without traffic, the confirmed
time can be outdated and to appear to be in the future. Later,
on traffic, NUD_STALE entries can switch to NUD_DELAY and start
the timer which can see the invalid confirmed time and wrongly
switch to NUD_REACHABLE state instead of NUD_PROBE. As result,
timer is set many days in the future. This is more visible on
32-bit platforms, with higher HZ value.

Why this is a problem? While we expect unused entries to expire,
such entries stay in REACHABLE state for too long, locked in
cache. They are not expired normally, only when cache is full.

Problem and the wrong state change reported by Zhang Changzhong:

172.16.1.18 dev bond0 lladdr 0a:0e:0f:01:12:01 ref 1 used 350521/15994171/350520 probes 4 REACHABLE

350520 seconds have elapsed since this entry was last updated, but it is
still in the REACHABLE state (base_reachable_time_ms is 30000),
preventing lladdr from being updated through probe.

Fix it by ensuring timer is started with valid used/confirmed
times. Considering the valid time range is LONG_MAX jiffies,
we try not to go too much in the past while we are in
DELAY/PROBE state. There are also places that need
used/updated times to be validated while timer is not running.

Reported-by: Zhang Changzhong <zhangchangzhong@huawei.com>
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Tested-by: Zhang Changzhong <zhangchangzhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-03-03 11:45:52 +01:00
Dean Luick
2590058fb0 IB/hfi1: Assign npages earlier
[ Upstream commit f9c47b2caa ]

Improve code clarity and enable earlier use of
tidbuf->npages by moving its assignment to
structure creation time.

Signed-off-by: Dean Luick <dean.luick@cornelisnetworks.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
Link: https://lore.kernel.org/r/167329104884.1472990.4639750192433251493.stgit@awfm-02.cornelisnetworks.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-03-03 11:45:52 +01:00
Jack Yu
4534ea429e ASoC: rt715-sdca: fix clock stop prepare timeout issue
[ Upstream commit 2036890282 ]

Modify clock_stop_timeout value for rt715-sdca according to
the requirement of internal clock trimming.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/574b6586267a458cac78c5ac4d5b10bd@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-03-03 11:45:52 +01:00
David Sterba
e430f058d9 btrfs: send: limit number of clones and allocated memory size
[ Upstream commit 33e17b3f5a ]

The arg->clone_sources_count is u64 and can trigger a warning when a
huge value is passed from user space and a huge array is allocated.
Limit the allocated memory to 8MiB (can be increased if needed), which
in turn limits the number of clone sources to 8M / sizeof(struct
clone_root) = 8M / 40 = 209715.  Real world number of clones is from
tens to hundreds, so this is future proof.

Reported-by: syzbot+4376a9a073770c173269@syzkaller.appspotmail.com
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-03-03 11:45:52 +01:00
Vishal Verma
d454a7212e ACPI: NFIT: fix a potential deadlock during NFIT teardown
[ Upstream commit fb6df4366f ]

Lockdep reports that acpi_nfit_shutdown() may deadlock against an
opportune acpi_nfit_scrub(). acpi_nfit_scrub () is run from inside a
'work' and therefore has already acquired workqueue-internal locks. It
also acquiires acpi_desc->init_mutex. acpi_nfit_shutdown() first
acquires init_mutex, and was subsequently attempting to cancel any
pending workqueue items. This reversed locking order causes a potential
deadlock:

    ======================================================
    WARNING: possible circular locking dependency detected
    6.2.0-rc3 #116 Tainted: G           O     N
    ------------------------------------------------------
    libndctl/1958 is trying to acquire lock:
    ffff888129b461c0 ((work_completion)(&(&acpi_desc->dwork)->work)){+.+.}-{0:0}, at: __flush_work+0x43/0x450

    but task is already holding lock:
    ffff888129b460e8 (&acpi_desc->init_mutex){+.+.}-{3:3}, at: acpi_nfit_shutdown+0x87/0xd0 [nfit]

    which lock already depends on the new lock.

    ...

    Possible unsafe locking scenario:

          CPU0                    CPU1
          ----                    ----
     lock(&acpi_desc->init_mutex);
                                  lock((work_completion)(&(&acpi_desc->dwork)->work));
                                  lock(&acpi_desc->init_mutex);
     lock((work_completion)(&(&acpi_desc->dwork)->work));

    *** DEADLOCK ***

Since the workqueue manipulation is protected by its own internal locking,
the cancellation of pending work doesn't need to be done under
acpi_desc->init_mutex. Move cancel_delayed_work_sync() outside the
init_mutex to fix the deadlock. Any work that starts after
acpi_nfit_shutdown() drops the lock will see ARS_CANCEL, and the
cancel_delayed_work_sync() will safely flush it out.

Reported-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
Link: https://lore.kernel.org/r/20230112-acpi_nfit_lockdep-v1-1-660be4dd10be@intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-03-03 11:45:52 +01:00
Takahiro Fujii
435e8fabd1 HID: elecom: add support for TrackBall 056E:011C
[ Upstream commit 29f316a1d7 ]

Make function buttons on ELECOM M-HT1DRBK trackball mouse work. This model
has two devices with different device IDs (010D and 011C). Both of
them misreports the number of buttons as 5 in the report descriptor, even
though they have 8 buttons. hid-elecom overwrites the report to fix them,
but supports only on 010D and does not work on 011C. This patch fixes
011C in the similar way but with specialized position parameters.
In fact, it is sufficient to rewrite only 17th byte (05 -> 08). However I
followed the existing way.

Signed-off-by: Takahiro Fujii <fujii@xaxxi.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-03-03 11:45:52 +01:00
Johan Jonker
6bd2f17543 ARM: dts: rockchip: add power-domains property to dp node on rk3288
[ Upstream commit 80422339a7 ]

The clocks in the Rockchip rk3288 DisplayPort node are
included in the power-domain@RK3288_PD_VIO logic, but the
power-domains property in the dp node is missing, so fix it.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Link: https://lore.kernel.org/r/dab85bfb-9f55-86a1-5cd5-7388c43e0ec5@gmail.com
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-03-03 11:45:51 +01:00
Krzysztof Kozlowski
839a9c0047 arm64: dts: rockchip: drop unused LED mode property from rk3328-roc-cc
[ Upstream commit 1692bffec6 ]

GPIO LEDs do not have a 'mode' property:

  rockchip/rk3328-roc-pc.dtb: leds: led-0: Unevaluated properties are not allowed ('mode' was unexpected)

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20221125144135.477144-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-03-03 11:45:51 +01:00
Benedict Wong
503e3d93cf Fix XFRM-I support for nested ESP tunnels
[ Upstream commit b0355dbbf1 ]

This change adds support for nested IPsec tunnels by ensuring that
XFRM-I verifies existing policies before decapsulating a subsequent
policies. Addtionally, this clears the secpath entries after policies
are verified, ensuring that previous tunnels with no-longer-valid
do not pollute subsequent policy checks.

This is necessary especially for nested tunnels, as the IP addresses,
protocol and ports may all change, thus not matching the previous
policies. In order to ensure that packets match the relevant inbound
templates, the xfrm_policy_check should be done before handing off to
the inner XFRM protocol to decrypt and decapsulate.

Notably, raw ESP/AH packets did not perform policy checks inherently,
whereas all other encapsulated packets (UDP, TCP encapsulated) do policy
checks after calling xfrm_input handling in the respective encapsulation
layer.

Test: Verified with additional Android Kernel Unit tests
Signed-off-by: Benedict Wong <benedictwong@google.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-03-03 11:45:51 +01:00
Neel Patel
765b3a0e0a ionic: refactor use of ionic_rx_fill()
[ Upstream commit e55f0f5bef ]

The same pre-work code is used before each call to
ionic_rx_fill(), so bring it in and make it a part of
the routine.

Signed-off-by: Neel Patel <neel@pensando.io>
Signed-off-by: Shannon Nelson <snelson@pensando.io>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-03-03 11:45:51 +01:00
Nathan Huckleberry
0b8c60f037 UPSTREAM: dm verity: stop using WQ_UNBOUND for verify_wq
Setting WQ_UNBOUND increases scheduler latency on ARM64.  This is
likely due to the asymmetric architecture of ARM64 processors.

I've been unable to reproduce the results that claim WQ_UNBOUND gives
a performance boost on x86-64.

This flag is causing performance issues for multiple subsystems within
Android.  Notably, the same slowdown exists for decompression with
EROFS.

| open-prebuilt-camera  | WQ_UNBOUND | ~WQ_UNBOUND   |
|-----------------------|------------|---------------|
| verity wait time (us) | 11746      | 119 (-98%)    |
| erofs wait time (us)  | 357805     | 174205 (-51%) |

| sha256 ramdisk random read | WQ_UNBOUND    | ~WQ_UNBOUND |
|----------------------------|-----------=---|-------------|
| arm64 (accelerated)        | bw=42.4MiB/s  | bw=212MiB/s |
| arm64 (generic)            | bw=16.5MiB/s  | bw=48MiB/s  |
| x86_64 (generic)           | bw=233MiB/s   | bw=230MiB/s |

Using a alloc_workqueue() @max_active arg of num_online_cpus() only
made sense with WQ_UNBOUND. Switch the @max_active arg to 0 (aka
default, which is 256 per-cpu).

Also, eliminate 'wq_flags' since it really doesn't serve a purpose.

Cc: Sami Tolvanen <samitolvanen@google.com>
Cc: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Nathan Huckleberry <nhuck@google.com>
Reviewed-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>

Bug: 233247259
Change-Id: Iea437fcfaa978a1389a57ef4d4adcb976d89089c
(cherry picked from commit c25da5b7ba)
Signed-off-by: Nathan Huckleberry <nhuck@google.com>
2023-03-02 18:57:46 +00:00
Nathan Huckleberry
fd4631f856 BACKPORT: dm verity: enable WQ_HIGHPRI on verify_wq
WQ_HIGHPRI increases throughput and decreases disk latency when using
dm-verity. This is important in Android for camera startup speed.

The following tests were run by doing 60 seconds of random reads using
a dm-verity device backed by two ramdisks.

Without WQ_HIGHPRI
lat (usec): min=13, max=3947, avg=69.53, stdev=50.55
READ: bw=51.1MiB/s (53.6MB/s), 51.1MiB/s-51.1MiB/s (53.6MB/s-53.6MB/s)

With WQ_HIGHPRI:
lat (usec): min=13, max=7854, avg=31.15, stdev=30.42
READ: bw=116MiB/s (121MB/s), 116MiB/s-116MiB/s (121MB/s-121MB/s)

Further testing was done by measuring how long it takes to open a
camera on an Android device.

Without WQ_HIGHPRI
Total verity work queue wait times (ms):
880.960, 789.517, 898.852

With WQ_HIGHPRI:
Total verity work queue wait times (ms):
528.824, 439.191, 433.300

The average time to open the camera is reduced by 350ms (or 40-50%).

Signed-off-by: Nathan Huckleberry <nhuck@google.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>

Bug: 233247259
Change-Id: I7d600c924b4a3e793b9a26c2852139683061a831
(cherry picked from commit afd41fff9c)
[nhuck: Resolved minor conflict in drivers/md/dm-verity-target.c ]
Signed-off-by: Nathan Huckleberry <nhuck@google.com>
2023-03-02 18:57:46 +00:00
Mike Snitzer
407f5e1a1d UPSTREAM: dm verity: remove WQ_CPU_INTENSIVE flag since using WQ_UNBOUND
The documentation [1] says that WQ_CPU_INTENSIVE is "meaningless" for
unbound wq. So remove WQ_CPU_INTENSIVE from the verify_wq allocation.

1. https://www.kernel.org/doc/html/latest/core-api/workqueue.html#flags

Suggested-by: Maksym Planeta <mplaneta@os.inf.tu-dresden.de>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>

Bug: 233247259
Change-Id: I13c8916a24274d586a5f462541345d149c602ca3
(cherry picked from commit 43fa47cb11)
Signed-off-by: Nathan Huckleberry <nhuck@google.com>
2023-03-02 18:57:46 +00:00
Ramji Jiyani
8d57344e75 ANDROID: GKI: define protected exports and modules list
Define protected modules and exports list for the aarch64 target.
This enables support to update and/or create protected
exports list at common/android/abi_gki_protected_exports based on
the modules listed in common/android/gki_protected_modules.

Command:

bazel run --config=fast //common:kernel_aarch64_abi_update_protected_exports

Bug: 268679215
Test: bazel run //common:kernel_aarch64_abi_update_protected_exports
Test: TH
Change-Id: I36a18162c2ef253fcf691b016b4da861d9c61e4a
Signed-off-by: Ramji Jiyani <ramjiyani@google.com>
2023-03-01 23:44:40 +00:00
Ramji Jiyani
c50cc6a18b ANDROID: GKI: Update owners for GKI modules lists
Add ramjiyani@ as per-file owner for:

android/abi_gki_protected_exports
android/gki_protected_modules
android/gki_system_dlkm_modules

Bug: 232431151
Test: TH
Change-Id: I5c893785686ab5768fedf903508bf2ac8c3ac976
Signed-off-by: Ramji Jiyani <ramjiyani@google.com>
2023-03-01 22:01:59 +00:00
Todd Kjos
352619da21 ANDROID: GKI: 3/1/2023 KMI update
Set KMI_GENERATION=1 for 3/1 KMI update

Location: "Kernel ABI difference"
Analyzer Description: Report STG ABI changes between builds (stgdiff on .stg).
Owner: gki-eng-team@google.com

ABI for 'kernel_abi_aarch64' on 'aosp_kernel-common-android14-5.15' has changed.
[old=ab/9668063/kernel_abi_aarch64; new=ab/P51085744/kernel_abi_aarch64; file=abi.stg; tool=stgdiff_stg; version=AyeAye - CL 512944641 android-build.ayeaye-python-dispatcher_20230228.05_p0; rc=4]
For more information, please visit go/kernel-abi-monitoring.

function symbol 'int aead_register_instance(struct crypto_template*, struct aead_instance*)' changed
  CRC changed from 0x4842bcc to 0x523040da

function symbol 'int ahash_register_instance(struct crypto_template*, struct ahash_instance*)' changed
  CRC changed from 0xa4ff2220 to 0x1ea3dc79

function symbol 'int crypto_aead_decrypt(struct aead_request*)' changed
  CRC changed from 0xd5621133 to 0x40117c2

... 65 omitted; 68 symbols have only CRC changes

type 'struct aead_instance' changed
  byte size changed from 768 to 576
  member changed from 'union { struct { char head[128]; struct crypto_instance base; } s; struct aead_alg alg; }' to 'union { struct { char head[64]; struct crypto_instance base; } s; struct aead_alg alg; }'
    offset changed from 1024 to 512
    type changed from 'union { struct { char head[128]; struct crypto_instance base; } s; struct aead_alg alg; }' to 'union { struct { char head[64]; struct crypto_instance base; } s; struct aead_alg alg; }'
      byte size changed from 640 to 512
      member changed from 'struct { char head[128]; struct crypto_instance base; } s' to 'struct { char head[64]; struct crypto_instance base; } s'
        type changed from 'struct { char head[128]; struct crypto_instance base; }' to 'struct { char head[64]; struct crypto_instance base; }'
          byte size changed from 640 to 512
          member changed from 'char head[128]' to 'char head[64]'
            type changed from 'char[128]' to 'char[64]'
              number of elements changed from 128 to 64
          member 'struct crypto_instance base' changed
            offset changed by -512

type 'struct ahash_instance' changed
  byte size changed from 896 to 704
  member changed from 'union { struct { char head[256]; struct crypto_instance base; } s; struct ahash_alg alg; }' to 'union { struct { char head[192]; struct crypto_instance base; } s; struct ahash_alg alg; }'
    offset changed from 1024 to 512
    type changed from 'union { struct { char head[256]; struct crypto_instance base; } s; struct ahash_alg alg; }' to 'union { struct { char head[192]; struct crypto_instance base; } s; struct ahash_alg alg; }'
      byte size changed from 768 to 640
      member changed from 'struct { char head[256]; struct crypto_instance base; } s' to 'struct { char head[192]; struct crypto_instance base; } s'
        type changed from 'struct { char head[256]; struct crypto_instance base; }' to 'struct { char head[192]; struct crypto_instance base; }'
          byte size changed from 768 to 640
          member changed from 'char head[256]' to 'char head[192]'
            type changed from 'char[256]' to 'char[192]'
              number of elements changed from 256 to 192
          member 'struct crypto_instance base' changed
            offset changed by -512

type 'struct crypto_aead' changed
  byte size changed from 256 to 128
  member 'struct crypto_tfm base' changed
    offset changed by -512

type 'struct crypto_ahash' changed
  byte size changed from 256 to 192

type 'struct crypto_tfm' changed
  byte size changed from 128 to 64
  member 'void* __crt_ctx[0]' changed
    offset changed by -512

type 'struct crypto_rng' changed
  byte size changed from 128 to 64

type 'struct crypto_shash' changed
  byte size changed from 256 to 128
  member 'struct crypto_tfm base' changed
    offset changed by -512

type 'struct crypto_skcipher' changed
  byte size changed from 256 to 128
  member 'struct crypto_tfm base' changed
    offset changed by -512

type 'struct crypto_sync_skcipher' changed
  byte size changed from 256 to 128

type 'struct crypto_cipher' changed
  byte size changed from 128 to 64

type 'struct crypto_comp' changed
  byte size changed from 128 to 64

type 'struct crypto_instance' changed
  byte size changed from 512 to 448
  member 'void* __ctx[0]' changed
    offset changed by -512

type 'struct aead_alg' changed
  byte size changed from 512 to 448
  member 'struct crypto_alg base' changed
    offset changed by -512

type 'struct ahash_alg' changed
  byte size changed from 640 to 576

type 'struct rng_alg' changed
  byte size changed from 512 to 448
  member 'struct crypto_alg base' changed
    offset changed by -512

type 'struct shash_alg' changed
  byte size changed from 640 to 576
  member 'struct crypto_alg base' changed
    offset changed by -512

type 'struct skcipher_alg' changed
  byte size changed from 512 to 448
  member 'struct crypto_alg base' changed
    offset changed by -512

type 'struct shash_instance' changed
  byte size changed from 896 to 704
  member changed from 'union { struct { char head[256]; struct crypto_instance base; } s; struct shash_alg alg; }' to 'union { struct { char head[192]; struct crypto_instance base; } s; struct shash_alg alg; }'
    offset changed from 1024 to 512
    type changed from 'union { struct { char head[256]; struct crypto_instance base; } s; struct shash_alg alg; }' to 'union { struct { char head[192]; struct crypto_instance base; } s; struct shash_alg alg; }'
      byte size changed from 768 to 640
      member changed from 'struct { char head[256]; struct crypto_instance base; } s' to 'struct { char head[192]; struct crypto_instance base; } s'
        type changed from 'struct { char head[256]; struct crypto_instance base; }' to 'struct { char head[192]; struct crypto_instance base; }'
          byte size changed from 768 to 640
          member changed from 'char head[256]' to 'char head[192]'
            type changed from 'char[256]' to 'char[192]'
              number of elements changed from 256 to 192
          member 'struct crypto_instance base' changed
            offset changed by -512

type 'struct skcipher_instance' changed
  byte size changed from 768 to 576
  member changed from 'union { struct { char head[128]; struct crypto_instance base; } s; struct skcipher_alg alg; }' to 'union { struct { char head[64]; struct crypto_instance base; } s; struct skcipher_alg alg; }'
    offset changed from 1024 to 512
    type changed from 'union { struct { char head[128]; struct crypto_instance base; } s; struct skcipher_alg alg; }' to 'union { struct { char head[64]; struct crypto_instance base; } s; struct skcipher_alg alg; }'
      byte size changed from 640 to 512
      member changed from 'struct { char head[128]; struct crypto_instance base; } s' to 'struct { char head[64]; struct crypto_instance base; } s'
        type changed from 'struct { char head[128]; struct crypto_instance base; }' to 'struct { char head[64]; struct crypto_instance base; }'
          byte size changed from 640 to 512
          member changed from 'char head[128]' to 'char head[64]'
            type changed from 'char[128]' to 'char[64]'
              number of elements changed from 128 to 64
          member 'struct crypto_instance base' changed
            offset changed by -512

type 'struct hash_alg_common' changed
  byte size changed from 512 to 448
  member 'struct crypto_alg base' changed
    offset changed by -512

Bug: 271188187
Change-Id: I0f5a5967bda2df567d26d9bb5acef4c16b31cfc9
Signed-off-by: Todd Kjos <tkjos@google.com>
2023-03-01 17:05:21 +00:00
Isaac J. Manjarres
1f17e2672d ANDROID: arm64: cache: Lower ARCH_DMA_MINALIGN to 64 bytes
Currently, ARCH_DMA_MINALIGN is set to 128 bytes for ARM64, which
means that the minimum size for kmalloc objects is 128 bytes.
ARCH_DMA_MINALIGN is required to be 128 bytes to be able to use a
single kernel image to support non-coherent DMA on systems with
cachelines up to 128 bytes in size.

However, the current value of 128 bytes leads to a large amount of
wasted memory for slab allocations on systems that have 64 byte
cachelines and only need a minimum alignment of 64 bytes for
DMA buffers. If these systems are allowed to use a smaller
ARCH_DMA_MINALIGN value of 64, the memory footprint of slab
allocations can be reduced by redirecting some allocations from
the kmalloc-128 and kmalloc-256 caches to the kmalloc-64 and
kmalloc-192 slab caches.

The following output from the slabinfo tool from a device running
Linux 6.1-rc5 reveals that lowering ARCH_DMA_MINALIGN from 128 bytes
to 64 bytes reduces the memory footprint of slab allocations by
16.6 MB--almost 5%.

ARCH_DMA_MINALIGN == 128:

Name                   Objects Objsize           Space
kmalloc-128             236973     128           33.0M
kmalloc-rcl-128           5541     128          724.9K
kmalloc-cg-128           10367     128            1.5M
kmalloc-256              12986     256            3.5M
kmalloc-rcl-256            256     256           65.5K
kmalloc-cg-256             544     256          139.2K

Total:                  266667                   38.9M

ARCH_DMA_MINALIGN == 64:

Name                   Objects Objsize           Space
kmalloc-64              216525      64           14.9M
kmalloc-rcl-64            3663      64          249.8K
kmalloc-cg-64            10269      64          864.2K
kmalloc-128              22797     128            3.5M
kmalloc-rcl-128           2016     128          258.0K
kmalloc-cg-128             288     128           36.8K
kmalloc-192               5532     192            1.1M
kmalloc-rcl-192            147     192           28.6K
kmalloc-cg-192             462     192           90.1K
kmalloc-256               5110     256            1.3M
kmalloc-rcl-256              0     256              0K
kmalloc-cg-256             224     256           57.3K

Total:                  267033                   22.3M

Thus, given the amount of memory saved by lowering ARCH_DMA_MINALIGN,
and that we are not aware of systems that have 128 byte cachelines
that will launch with newer kernels, lower the value of
ARCH_DMA_MINALIGN to 64 bytes for ARM64.

This is meant to serve as an intermediate solution while the series
in [1] is finalized.

[1] https://lore.kernel.org/linux-iommu/20221106220143.2129263-1-catalin.marinas@arm.com/

Bug: 241844128
Bug: 267786731
Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com>
Change-Id: Idde8d1c682865582382766acc0443dda1a8a4f12
2023-03-01 01:26:28 +00:00