Commit Graph

979642 Commits

Author SHA1 Message Date
Kever Yang
be153f6250 ANDROID: GKI: rockchip: Enable symbol for cw2015_battery
Functions changes summary: 0 Removed, 0 Changed (2328 filtered out), 1 Added functions
Variables changes summary: 0 Removed, 0 Changed (22 filtered out), 0 Added variables

1 Added function:

  [A] 'function int power_supply_am_i_supplied(power_supply*)'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I7b313c10eb3bed84f4b4194c63d8dcfd4b5273c5
2021-10-05 09:06:30 +02:00
Kever Yang
a90c09dd41 ANDROID: GKI: rockchip: Enable symbols for mmc driver
Functions changes summary: 0 Removed, 0 Changed, 5 Added functions
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

5 Added functions:

  [A] 'function int clk_get_phase(clk*)'
  [A] 'function int clk_set_phase(clk*, int)'
  [A] 'function void sdhci_adma_write_desc(sdhci_host*, void**, dma_addr_t, int, unsigned int)'
  [A] 'function unsigned int sdhci_pltfm_clk_get_max_clock(sdhci_host*)'
  [A] 'function void sdhci_set_clock(sdhci_host*, unsigned int)'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I2eaf765788b782d397a9291d2351f033a9e5c05f
2021-10-05 08:22:12 +02:00
Kever Yang
f1e23eee85 ANDROID: GKI: rockchip: Enable symbols for cpufreq governor
Functions changes summary: 0 Removed, 0 Changed (147 filtered out), 8 Added functions
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

8 Added functions:

  [A] 'function void cpufreq_dbs_governor_exit(cpufreq_policy*)'
  [A] 'function int cpufreq_dbs_governor_init(cpufreq_policy*)'
  [A] 'function void cpufreq_dbs_governor_limits(cpufreq_policy*)'
  [A] 'function int cpufreq_dbs_governor_start(cpufreq_policy*)'
  [A] 'function void cpufreq_dbs_governor_stop(cpufreq_policy*)'
  [A] 'function unsigned int dbs_update(cpufreq_policy*)'
  [A] 'function void gov_update_cpu_data(dbs_data*)'
  [A] 'function ssize_t store_sampling_rate(gov_attr_set*, const char*, size_t)'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ia03c3afb864e5b875ac24898e8b818d986d50ec6
2021-10-05 08:21:58 +02:00
Kever Yang
5f020167d0 ANDROID: GKI: rockchip: Enable symbols for scsi ch
Leaf changes summary: 1 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 1 Added functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

1 Added functions:

  [A] 'function int scsi_register_driver(device_driver*)'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I7540204d69feec24f0e7f49b08def874c0c072cf
2021-10-05 08:21:31 +02:00
Kever Yang
64665afcb3 ANDROID: GKI: rockchip: Enable symbols for adc-keys
Leaf changes summary: 2 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 2 Added functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

2 Added functions:

  [A] 'function void input_set_poll_interval(input_dev*, unsigned int)'
  [A] 'function int input_setup_polling(input_dev*, void (input_dev*)*)'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I0e5c2b10ded49faa890aa37d157e7ddf6797e432
2021-10-05 08:21:18 +02:00
Kever Yang
b37b3c9eaa ANDROID: GKI: rockchip: Enable symbol for act8865
Leaf changes summary: 1 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 1 Added functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

1 Added functions:

  [A] 'function int regulator_set_pull_down_regmap(regulator_dev*)'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I7c8668ad05c11b27d92892a1e4075ef7c87155bd
2021-10-05 08:20:57 +02:00
Kever Yang
21034d71fc ANDROID: GKI: rockchip: Enable symbols for pwm_bl
Functions changes summary: 0 Removed, 0 Changed, 1 Added function
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

1 Added function:

  [A] 'function int pwm_adjust_config(pwm_device*)'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ic944cb67431d2da199a12f926f6e9248235a3abf
2021-10-05 08:19:40 +02:00
Kever Yang
576c7a6297 ANDROID: GKI: rockchip: Enable symbols for phy
Functions changes summary: 0 Removed, 0 Changed, 4 Added functions
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

4 Added functions:

  [A] 'function int extcon_set_state(extcon_dev*, unsigned int, bool)'
  [A] 'function int extcon_sync(extcon_dev*, unsigned int)'
  [A] 'function usb_dr_mode of_usb_get_dr_mode_by_phy(device_node*, int)'
  [A] 'function int phy_mipi_dphy_config_validate(phy_configure_opts_mipi_dphy*)'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ifb68fb8726d7d179a212853abd0be6f5460358ef
2021-10-05 08:19:31 +02:00
Kever Yang
fc1e452fa3 ANDROID: GKI: rockchip: Enable symbols for LED hardbeat
Functions changes summary: 0 Removed, 0 Changed, 3 Added functions
Variables changes summary: 0 Removed, 0 Changed, 1 Added variable

3 Added functions:

  [A] 'function void led_set_brightness_nosleep(led_classdev*, led_brightness)'
  [A] 'function int led_trigger_register(led_trigger*)'
  [A] 'function void led_trigger_unregister(led_trigger*)'

1 Added variable:

  [A] 'unsigned long int avenrun[3]'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I078368f6e330581f3bd3233b5086730be3db4033
2021-10-05 08:19:22 +02:00
Adrian Hunter
f4b3d35dfa FROMLIST: scsi: ufs: Fix task management completion
The UFS driver uses blk_mq_tagset_busy_iter() when identifying task
management requests to complete, however blk_mq_tagset_busy_iter()
doesn't work.

blk_mq_tagset_busy_iter() only iterates requests dispatched by the block
layer. That appears as if it might have started since commit 37f4a24c24
("blk-mq: centralise related handling into blk_mq_get_driver_tag") which
removed 'data->hctx->tags->rqs[rq->tag] = rq' from blk_mq_rq_ctx_init()
which gets called:

	blk_get_request
		blk_mq_alloc_request
			__blk_mq_alloc_request
				blk_mq_rq_ctx_init

Since UFS task management requests are not dispatched by the block
layer, hctx->tags->rqs[rq->tag] remains NULL,  and since
blk_mq_tagset_busy_iter() relies on finding requests using
hctx->tags->rqs[rq->tag], UFS task management requests are never found by
blk_mq_tagset_busy_iter().

By using blk_mq_tagset_busy_iter(), the UFS driver was relying on internal
details of the block layer, which was fragile and subsequently got
broken. Fix by removing the use of blk_mq_tagset_busy_iter() and having
the driver keep track of task management requests.

Fixes: 1235fc569e ("scsi: ufs: core: Fix task management request completion timeout")
Fixes: 69a6c269c0 ("scsi: ufs: Use blk_{get,put}_request() to allocate and free TMFs")
Cc: stable@vger.kernel.org
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Bug: 200291871
Link: https://lore.kernel.org/linux-scsi/20210922091059.4040-1-adrian.hunter@intel.com/
Change-Id: I4e11f40c7371fd66b3a6b570d06c956b113df142
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2021-10-04 18:29:27 +00:00
Bart Van Assche
7b6860d2a4 ANDROID: scsi: ufs: Rename struct ufs_hba_with_hpb into ufs_hba_add_info
Before adding more data members in struct ufs_hba_with_hpb, rename this
data structure. This patch does not change any functionality.

Bug: 200291871
Change-Id: I6b0365ebcf8adf6cfa009218d8c4dc96fa629bde
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2021-10-04 18:29:21 +00:00
Konstantin Vyshetsky
5adc3c4124 ANDROID: Update the ABI representation
Leaf changes summary: 2 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 1 Added function
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 1 Added variable

1 Added function:

  [A] 'function int __traceiter_android_rvh_ufs_complete_init(void*, ufs_hba*)'

1 Added variable:

  [A] 'tracepoint __tracepoint_android_rvh_ufs_complete_init'

Bug: 185809932
Signed-off-by: Konstantin Vyshetsky <vkon@google.com>
Change-Id: I48a831d2059901276b1a510d8af186c00ca2f9db
2021-10-04 18:26:10 +00:00
Konstantin Vyshetsky
e774e4eca6 ANDROID: scsi: ufs: add complete init vendor hook
Currently the core UFS driver does not have a vops to notify when the
device is operational. This commit introduces a hook, which serves to
notify device completing initialization and is ready to accept I/O.

This is required by the FIPS140-2 [1] self integrity test of inline
encryption engine, which must run whenever the host controller is reset.
The code requires sleeping while waiting for I/O to complete and allocating
some memory dynamically, which requires the vendor hook to be restricted.

[1] https://csrc.nist.gov/publications/detail/fips/140/2/final

Bug: 185809932
Signed-off-by: Konstantin Vyshetsky <vkon@google.com>
Change-Id: I6f476f9c2e2b50574d2898c3f1ef6b648d92df24
2021-10-04 18:26:03 +00:00
Subash Abhinov Kasiviswanathan
7050ead570 ANDROID: qcom: Add qdisc related symbols
Add register_qdisc and unregister_qdisc which are needed by rmnet
modules.

Leaf changes summary: 2 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 2 Added
functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added
variable

2 Added functions:

  [A] 'function int register_qdisc(Qdisc_ops*)'
  [A] 'function int unregister_qdisc(Qdisc_ops*)'

Bug: 201660525
Change-Id: Ifc6c36ffada9046f8f23d3e87059a5d631b5cf8c
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
2021-10-04 17:59:34 +00:00
Yee Lee
d788d16fed FROMGIT: scs: Release kasan vmalloc poison in scs_free process
Since scs allocation is moved to vmalloc region, the
shadow stack is protected by kasan_posion_vmalloc.
However, the vfree_atomic operation needs to access
its context for scs_free process and causes kasan error
as the dump info below.

This patch Adds kasan_unpoison_vmalloc() before vfree_atomic,
which aligns to the prior flow as using kmem_cache.
The vmalloc region will go back posioned in the following
vumap() operations.

 ==================================================================
 BUG: KASAN: vmalloc-out-of-bounds in llist_add_batch+0x60/0xd4
 Write of size 8 at addr ffff8000100b9000 by task kthreadd/2

 CPU: 0 PID: 2 Comm: kthreadd Not tainted 5.15.0-rc2-11681-g92477dd1faa6-dirty #1
 Hardware name: linux,dummy-virt (DT)
 Call trace:
  dump_backtrace+0x0/0x43c
  show_stack+0x1c/0x2c
  dump_stack_lvl+0x68/0x84
  print_address_description+0x80/0x394
  kasan_report+0x180/0x1dc
  __asan_report_store8_noabort+0x48/0x58
  llist_add_batch+0x60/0xd4
  vfree_atomic+0x60/0xe0
  scs_free+0x1dc/0x1fc
  scs_release+0xa4/0xd4
  free_task+0x30/0xe4
  __put_task_struct+0x1ec/0x2e0
  delayed_put_task_struct+0x5c/0xa0
  rcu_do_batch+0x62c/0x8a0
  rcu_core+0x60c/0xc14
  rcu_core_si+0x14/0x24
  __do_softirq+0x19c/0x68c
  irq_exit+0x118/0x2dc
  handle_domain_irq+0xcc/0x134
  gic_handle_irq+0x7c/0x1bc
  call_on_irq_stack+0x40/0x70
  do_interrupt_handler+0x78/0x9c
  el1_interrupt+0x34/0x60
  el1h_64_irq_handler+0x1c/0x2c
  el1h_64_irq+0x78/0x7c
  _raw_spin_unlock_irqrestore+0x40/0xcc
  sched_fork+0x4f0/0xb00
  copy_process+0xacc/0x3648
  kernel_clone+0x168/0x534
  kernel_thread+0x13c/0x1b0
  kthreadd+0x2bc/0x400
  ret_from_fork+0x10/0x20

 Memory state around the buggy address:
  ffff8000100b8f00: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
  ffff8000100b8f80: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
 >ffff8000100b9000: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
                    ^
  ffff8000100b9080: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
  ffff8000100b9100: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
 ==================================================================

Bug: 201711661
(cherry picked from commit 528a4ab453
https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/ for-next/scs)
Change-Id: I0980e9df3fdff37ebfb9f873174d60f30c00230a
Suggested-by: Kuan-Ying Lee <kuan-ying.lee@mediatek.com>
Acked-by: Will Deacon <will@kernel.org>
Tested-by: Will Deacon <will@kernel.org>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Yee Lee <yee.lee@mediatek.com>
Fixes: a2abe7cbd8 ("scs: switch to vmapped shadow stacks")
Link: https://lore.kernel.org/r/20210930081619.30091-1-yee.lee@mediatek.com
Signed-off-by: Will Deacon <will@kernel.org>
2021-10-04 15:44:53 +00:00
Lecopzer Chen
2659f14d93 UPSTREAM: arm64: Kconfig: select KASAN_VMALLOC if KANSAN_GENERIC is enabled
Before this patch, someone who wants to use VMAP_STACK when
KASAN_GENERIC enabled must explicitly select KASAN_VMALLOC.

>From Will's suggestion [1]:
  > I would _really_ like to move to VMAP stack unconditionally, and
  > that would effectively force KASAN_VMALLOC to be set if KASAN is in use

Because VMAP_STACK now depends on either HW_TAGS or KASAN_VMALLOC if
KASAN enabled, in order to make VMAP_STACK selected unconditionally,
we bind KANSAN_GENERIC and KASAN_VMALLOC together.

Note that SW_TAGS supports neither VMAP_STACK nor KASAN_VMALLOC now,
so this is the first step to make VMAP_STACK selected unconditionally.

Bind KANSAN_GENERIC and KASAN_VMALLOC together is supposed to cost more
memory at runtime, thus the alternative is using SW_TAGS KASAN instead.

[1]: https://lore.kernel.org/lkml/20210204150100.GE20815@willie-the-truck/

Suggested-by: Will Deacon <will@kernel.org>
Signed-off-by: Lecopzer Chen <lecopzer.chen@mediatek.com>
Link: https://lore.kernel.org/r/20210324040522.15548-6-lecopzer.chen@mediatek.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

Bug: 201711661
(cherry picked from commit acc3042d62)
Signed-off-by: Yee Lee <yee.lee@mediatek.com>
Change-Id: Ic7884e3acafa02361c8a250028ceebdb1780a49e
2021-10-04 15:44:41 +00:00
Lecopzer Chen
23232f84c8 UPSTREAM: arm64: kaslr: support randomized module area with KASAN_VMALLOC
After KASAN_VMALLOC works in arm64, we can randomize module region
into vmalloc area now.

Test:
	VMALLOC area ffffffc010000000 fffffffdf0000000

	before the patch:
		module_alloc_base/end ffffffc008b80000 ffffffc010000000
	after the patch:
		module_alloc_base/end ffffffdcf4bed000 ffffffc010000000

	And the function that insmod some modules is fine.

Suggested-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Lecopzer Chen <lecopzer.chen@mediatek.com>
Link: https://lore.kernel.org/r/20210324040522.15548-5-lecopzer.chen@mediatek.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

Bug: 201711661
(cherry picked from commit 31d02e7ab0)
Signed-off-by: Yee Lee <yee.lee@mediatek.com>
Change-Id: I513f205113752b396245e9e8d64b973fcd7ffcb1
2021-10-04 15:44:35 +00:00
Lecopzer Chen
ef61240f62 UPSTREAM: arm64: Kconfig: support CONFIG_KASAN_VMALLOC
We can backed shadow memory in vmalloc area after vmalloc area
isn't populated at kasan_init(), thus make KASAN_VMALLOC selectable.

Signed-off-by: Lecopzer Chen <lecopzer.chen@mediatek.com>
Acked-by: Andrey Konovalov <andreyknvl@gmail.com>
Tested-by: Andrey Konovalov <andreyknvl@gmail.com>
Tested-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20210324040522.15548-4-lecopzer.chen@mediatek.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

Bug: 201711661
(cherry picked from commit 71b613fc0c)
Signed-off-by: Yee Lee <yee.lee@mediatek.com>
Change-Id: I48d473cadd54ec2c8d3f92fa3d88ff456b70afdc
2021-10-04 15:44:28 +00:00
Lecopzer Chen
d0f4b61ae6 UPSTREAM: arm64: kasan: abstract _text and _end to KERNEL_START/END
Arm64 provides defined macro for KERNEL_START and KERNEL_END,
thus replace them by the abstration instead of using _text and _end.

Signed-off-by: Lecopzer Chen <lecopzer.chen@mediatek.com>
Acked-by: Andrey Konovalov <andreyknvl@gmail.com>
Tested-by: Andrey Konovalov <andreyknvl@gmail.com>
Tested-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20210324040522.15548-3-lecopzer.chen@mediatek.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

Bug: 201711661
(cherry picked from commit 7d7b88ff5f)
Signed-off-by: Yee Lee <yee.lee@mediatek.com>
Change-Id: I806cb3d57e2064c272f3c87f0eb212ceea80c424
2021-10-04 15:44:20 +00:00
Lecopzer Chen
4d91b1f6ee UPSTREAM: arm64: kasan: don't populate vmalloc area for CONFIG_KASAN_VMALLOC
Linux support KAsan for VMALLOC since commit 3c5c3cfb9e
("kasan: support backing vmalloc space with real shadow memory")

Like how the MODULES_VADDR does now, just not to early populate
the VMALLOC_START between VMALLOC_END.

Before:

MODULE_VADDR: no mapping, no zero shadow at init
VMALLOC_VADDR: backed with zero shadow at init

After:

MODULE_VADDR: no mapping, no zero shadow at init
VMALLOC_VADDR: no mapping, no zero shadow at init

Thus the mapping will get allocated on demand by the core function
of KASAN_VMALLOC.

  -----------  vmalloc_shadow_start
 |           |
 |           |
 |           | <= non-mapping
 |           |
 |           |
 |-----------|
 |///////////|<- kimage shadow with page table mapping.
 |-----------|
 |           |
 |           | <= non-mapping
 |           |
 ------------- vmalloc_shadow_end
 |00000000000|
 |00000000000| <= Zero shadow
 |00000000000|
 ------------- KASAN_SHADOW_END

Signed-off-by: Lecopzer Chen <lecopzer.chen@mediatek.com>
Acked-by: Andrey Konovalov <andreyknvl@gmail.com>
Tested-by: Andrey Konovalov <andreyknvl@gmail.com>
Tested-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20210324040522.15548-2-lecopzer.chen@mediatek.com
[catalin.marinas@arm.com: add a build check on VMALLOC_START != MODULES_END]
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

Bug: 201711661
(cherry picked from commit 9a0732efa7)
Signed-off-by: Yee Lee <yee.lee@mediatek.com>
Change-Id: I82c4b624685cc9e083d720904787df2326cb9cc0
2021-10-04 15:44:10 +00:00
Kever Yang
935b5c3bdd ANDROID: GKI: rockchip: Enable symbols for rk808-regulator
Functions changes summary: 0 Removed, 0 Changed (1546 filtered out), 2 Added functions
Variables changes summary: 0 Removed, 0 Changed (11 filtered out), 0 Added variables

2 Added functions:

  [A] 'function gpio_desc* devm_gpiod_get_index_optional(device*, const char*, unsigned int, gpiod_flags)'
  [A] 'function int gpiod_is_active_low(const gpio_desc*)'

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ie06fa99d6616cb389bccc1d9167f084c7cafbe89
2021-10-04 15:48:04 +02:00
Kever Yang
9a8a15b8bd ANDROID: GKI: rockchip: Enable symbols for hid
Functions changes summary: 0 Removed, 0 Changed (1546 filtered out), 1 Added functions
Variables changes summary: 0 Removed, 0 Changed (11 filtered out), 0 Added variables

1 Added function:

  [A] 'function hid_report* hid_validate_values(hid_device*, unsigned int, unsigned int, unsigned int, unsigned int)'

Leaf changes summary: 11 artifacts changed
Changed leaf types summary: 0 leaf type changed

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I941c191d5c0fb5a01a6b9269f0afa7ea77db327a
2021-10-04 13:38:23 +02:00
Peter Collingbourne
55b0b34791 FROMGIT: arm64: kasan: mte: move GCR_EL1 switch to task switch when KASAN disabled
It is not necessary to write to GCR_EL1 on every kernel entry and
exit when HW tag-based KASAN is disabled because the kernel will not
execute any IRG instructions in that mode. Since accessing GCR_EL1
can be expensive on some microarchitectures, avoid doing so by moving
the access to task switch when HW tag-based KASAN is disabled.

Signed-off-by: Peter Collingbourne <pcc@google.com>
Acked-by: Andrey Konovalov <andreyknvl@gmail.com>
Link: https://linux-review.googlesource.com/id/I78e90d60612a94c24344526f476ac4ff216e10d2
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Link: https://lore.kernel.org/r/20210924010655.2886918-1-pcc@google.com
Signed-off-by: Will Deacon <will@kernel.org>
(cherry picked from commit e5af50a5df
 https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/mte)
Change-Id: I0f06de2fce4dea2967c0fee608d1900915493d23
Bug: 192536783
2021-10-01 09:39:36 -07:00
Peter Collingbourne
6c6d1d7e42 UPSTREAM: arm64: add MTE supported check to thread switching and syscall entry/exit
This lets us avoid doing unnecessary work on hardware that does not
support MTE, and will allow us to freely use MTE instructions in the
code called by mte_thread_switch().

Since this would mean that we do a redundant check in
mte_check_tfsr_el1(), remove it and add two checks now required in its
callers. This also avoids an unnecessary DSB+ISB sequence on the syscall
exit path for hardware not supporting MTE.

Fixes: 65812c6921 ("arm64: mte: Enable async tag check fault")
Cc: <stable@vger.kernel.org> # 5.13.x
Signed-off-by: Peter Collingbourne <pcc@google.com>
Link: https://linux-review.googlesource.com/id/I02fd000d1ef2c86c7d2952a7f099b254ec227a5d
Link: https://lore.kernel.org/r/20210915190336.398390-1-pcc@google.com
[catalin.marinas@arm.com: adjust the commit log slightly]
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 8c8a3b5bd9)
Change-Id: I131933b18581a40cea9abf556625c80b12e4e974
Bug: 192536783
2021-10-01 09:39:36 -07:00
Mark Rutland
f746714fe4 UPSTREAM: arm64: kasan: mte: use a constant kernel GCR_EL1 value
When KASAN_HW_TAGS is selected, KASAN is enabled at boot time, and the
hardware supports MTE, we'll initialize `kernel_gcr_excl` with a value
dependent on KASAN_TAG_MAX. While the resulting value is a constant
which depends on KASAN_TAG_MAX, we have to perform some runtime work to
generate the value, and have to read the value from memory during the
exception entry path. It would be better if we could generate this as a
constant at compile-time, and use it as such directly.

Early in boot within __cpu_setup(), we initialize GCR_EL1 to a safe
value, and later override this with the value required by KASAN. If
CONFIG_KASAN_HW_TAGS is not selected, or if KASAN is disabeld at boot
time, the kernel will not use IRG instructions, and so the initial value
of GCR_EL1 is does not matter to the kernel. Thus, we can instead have
__cpu_setup() initialize GCR_EL1 to a value consistent with
KASAN_TAG_MAX, and avoid the need to re-initialize it during hotplug and
resume form suspend.

This patch makes arem64 use a compile-time constant KERNEL_GCR_EL1
value, which is compatible with KASAN_HW_TAGS when this is selected.
This removes the need to re-initialize GCR_EL1 dynamically, and acts as
an optimization to the entry assembly, which no longer needs to load
this value from memory. The redundant initialization hooks are removed.

In order to do this, KASAN_TAG_MAX needs to be visible outside of the
core KASAN code. To do this, I've moved the KASAN_TAG_* values into
<linux/kasan-tags.h>.

There should be no functional change as a result of this patch.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Peter Collingbourne <pcc@google.com>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Cc: Will Deacon <will@kernel.org>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Andrey Konovalov <andreyknvl@gmail.com>
Tested-by: Andrey Konovalov <andreyknvl@gmail.com>
Link: https://lore.kernel.org/r/20210714143843.56537-3-mark.rutland@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 8286824789)
Change-Id: I397025af7051bedcdd35987af5deec46c228f8e2
Signed-off-by: Peter Collingbourne <pcc@google.com>
Bug: 192536783
2021-10-01 09:39:35 -07:00
Greg Kroah-Hartman
eb02ea0e35 ANDROID: GKI: fix mode of android/abi_gki_aarch64.xml file
Somehow the android/abi_gki_aarch64.xml file became executable in a
previous commit.  Fix this up by setting the mode properly.

Bug: 149040612
Cc: Chun-Hung Wu <chun-hung.wu@mediatek.com>
Cc: Sandeep Patil <sspatil@google.com>
Fixes: 55d7c4eca6 ("ANDROID: Update symbol list for mtk")
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Iecb61df3481cf2a257d2f999297a98cdbcb38295
2021-09-30 21:51:03 +00:00
Woogeun Lee
62ad82b86b ANDROID: ABI: update allowed list for galaxy
Leaf changes summary: 84 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 67 Added functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 17 Added variables

67 Added functions:

  [A] 'function int __hid_register_driver(hid_driver*, module*, const char*)'
  [A] 'function int __hid_request(hid_device*, hid_report*, int)'
  [A] 'function tty_driver* __tty_alloc_driver(unsigned int, module*, unsigned long int)'
  [A] 'function int __usb_get_extra_descriptor(char*, unsigned int, unsigned char, void**, size_t)'
  [A] 'function int cdc_ncm_bind_common(usbnet*, usb_interface*, u8, int)'
  [A] 'function int cdc_ncm_change_mtu(net_device*, int)'
  [A] 'function sk_buff* cdc_ncm_fill_tx_frame(usbnet*, sk_buff*, __le32)'
  [A] 'function int cdc_ncm_rx_verify_ndp16(sk_buff*, int)'
  [A] 'function int cdc_ncm_rx_verify_nth16(cdc_ncm_ctx*, sk_buff*)'
  [A] 'function u8 cdc_ncm_select_altsetting(usb_interface*)'
  [A] 'function void cdc_ncm_unbind(usbnet*, usb_interface*)'
  [A] 'function int cdc_parse_cdc_header(usb_cdc_parsed_header*, usb_interface*, u8*, int)'
  [A] 'function u16 crc16(u16, const u8*, size_t)'
  [A] 'function int driver_attach(device_driver*)'
  [A] 'function void drm_mode_sort(list_head*)'
  [A] 'function void hid_hw_close(hid_device*)'
  [A] 'function int hid_hw_open(hid_device*)'
  [A] 'function int hid_hw_start(hid_device*, unsigned int)'
  [A] 'function void hid_hw_stop(hid_device*)'
  [A] 'function int hid_open_report(hid_device*)'
  [A] 'function int hid_report_raw_event(hid_device*, int, u8*, u32, int)'
  [A] 'function void hid_unregister_driver(hid_driver*)'
  [A] 'function void in6_dev_finish_destroy(inet6_dev*)'
  [A] 'function int input_ff_create_memless(input_dev*, void*, int (input_dev*, void*, ff_effect*)*)'
  [A] 'function int phy_connect_direct(net_device*, phy_device*, void (net_device*)*, phy_interface_t)'
  [A] 'function phy_device* phy_find_first(mii_bus*)'
  [A] 'function void phy_get_pause(phy_device*, bool*, bool*)'
  [A] 'function void put_tty_driver(tty_driver*)'
  [A] 'function int smp_call_function_single_async(int, __call_single_data*)'
  [A] 'function unsigned int stack_trace_save_regs(pt_regs*, unsigned long int*, unsigned int, unsigned int)'
  [A] 'function int tcp_register_congestion_control(tcp_congestion_ops*)'
  [A] 'function void tcp_reno_cong_avoid(sock*, u32, u32)'
  [A] 'function u32 tcp_reno_ssthresh(sock*)'
  [A] 'function u32 tcp_reno_undo_cwnd(sock*)'
  [A] 'function u32 tcp_slow_start(tcp_sock*, u32)'
  [A] 'function void tcp_unregister_congestion_control(tcp_congestion_ops*)'
  [A] 'function void tty_ldisc_deref(tty_ldisc*)'
  [A] 'function tty_ldisc* tty_ldisc_ref(tty_struct*)'
  [A] 'function void tty_port_close(tty_port*, tty_struct*, file*)'
  [A] 'function void tty_port_destroy(tty_port*)'
  [A] 'function void tty_port_hangup(tty_port*)'
  [A] 'function void tty_port_init(tty_port*)'
  [A] 'function int tty_port_open(tty_port*, tty_struct*, file*)'
  [A] 'function device* tty_port_register_device(tty_port*, tty_driver*, unsigned int, device*)'
  [A] 'function void tty_port_tty_wakeup(tty_port*)'
  [A] 'function int tty_register_driver(tty_driver*)'
  [A] 'function void tty_set_operations(tty_driver*, const tty_operations*)'
  [A] 'function int tty_standard_install(tty_driver*, tty_struct*)'
  [A] 'function void tty_termios_copy_hw(ktermios*, ktermios*)'
  [A] 'function void tty_unregister_device(tty_driver*, unsigned int)'
  [A] 'function int tty_unregister_driver(tty_driver*)'
  [A] 'function void tty_vhangup(tty_struct*)'
  [A] 'function void usb_autopm_get_interface_no_resume(usb_interface*)'
  [A] 'function void usb_deregister_dev(usb_interface*, usb_class_driver*)'
  [A] 'function usb_interface* usb_find_interface(usb_driver*, int)'
  [A] 'function usb_device* usb_get_dev(usb_device*)'
  [A] 'function usb_interface* usb_get_intf(usb_interface*)'
  [A] 'function const usb_device_id* usb_match_id(usb_interface*, const usb_device_id*)'
  [A] 'function int usb_match_one_id(usb_interface*, const usb_device_id*)'
  [A] 'function void usb_poison_anchored_urbs(usb_anchor*)'
  [A] 'function void usb_put_intf(usb_interface*)'
  [A] 'function int usb_register_dev(usb_interface*, usb_class_driver*)'
  [A] 'function int usb_set_interface(usb_device*, int, int)'
  [A] 'function ssize_t usb_show_dynids(usb_dynids*, char*)'
  [A] 'function ssize_t usb_store_new_id(usb_dynids*, const usb_device_id*, device_driver*, const char*, size_t)'
  [A] 'function void usb_unpoison_urb(urb*)'
  [A] 'function void usbnet_defer_kevent(usbnet*, int)'

17 Added variables:

  [A] 'tracepoint __tracepoint_android_rvh_arm64_serror_panic'
  [A] 'tracepoint __tracepoint_android_rvh_bad_mode'
  [A] 'tracepoint __tracepoint_android_rvh_dequeue_task_idle'
  [A] 'tracepoint __tracepoint_android_rvh_do_sea'
  [A] 'tracepoint __tracepoint_android_rvh_do_undefinstr'
  [A] 'tracepoint __tracepoint_android_vh_rtmutex_wait_finish'
  [A] 'tracepoint __tracepoint_android_vh_rtmutex_wait_start'
  [A] 'tracepoint __tracepoint_android_vh_rwsem_read_wait_finish'
  [A] 'tracepoint __tracepoint_android_vh_rwsem_read_wait_start'
  [A] 'tracepoint __tracepoint_android_vh_rwsem_write_wait_finish'
  [A] 'tracepoint __tracepoint_android_vh_rwsem_write_wait_start'
  [A] 'tracepoint __tracepoint_android_vh_sched_show_task'
  [A] 'tracepoint __tracepoint_android_vh_try_to_freeze_todo'
  [A] 'tracepoint __tracepoint_android_vh_try_to_freeze_todo_unfrozen'
  [A] 'tracepoint __tracepoint_android_vh_watchdog_timer_softlockup'
  [A] 'tracepoint __tracepoint_android_vh_wq_lockup_pool'
  [A] 'ktermios tty_std_termios'

Bug: 201598560

Change-Id: I74e725575a435865af714d5cad17dd6c7c600692
Signed-off-by: Woogeun Lee <woogeun.lee@samsung.com>
2021-09-30 13:43:14 +00:00
Kever Yang
f1a5448fa7 ANDROID: GKI: rockchip: Convert symbol to order by module
This patch does not add any new symbol, but make the symbol list order
by the module.

Bug: 194515348
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Change-Id: I0bec2f90a46ec92d7e391ab9e9c49180c4d87ae9
2021-09-30 18:40:06 +08:00
fengmingli
18d90d0300 ANDROID: GKI: Add a symbol to symbol list
Leaf changes summary: 1 artifact changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 1 Added function
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

1 Added function:

  [A] 'function int ucsi_send_command(ucsi*, u64, void*, size_t)'

Bug: 194373509

Change-Id: I93707355c2e37aef92d243e5ad324bac5487a804
Signed-off-by: fengmingli <mingli.feng@vivo.com>
2021-09-30 04:35:10 +08:00
Sudarshan Rajagopalan
cb7a5d58a9 FROMLIST: arm64: mm: update max_pfn after memory hotplug
After new memory blocks have been hotplugged, max_pfn and max_low_pfn
needs updating to reflect on new PFNs being hot added to system.
Without this patch, debug-related functions that use max_pfn such as
get_max_dump_pfn() or read_page_owner() will not work with any page in
memory that is hot-added after boot.

Link: https://lore.kernel.org/lkml/cover.1632853776.git.quic_cgoldswo@quicinc.com/T/#md084740c6377eb12369bfe6eb8786f4689dc8498
Bug: 200171991
Fixes: 4ab2150615 ("arm64: Add memory hotplug support")
Signed-off-by: Sudarshan Rajagopalan <quic_sudaraja@quicinc.com>
Signed-off-by: Chris Goldsworthy <quic_cgoldswo@quicinc.com>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Georgi Djakov <quic_c_gdjako@quicinc.com>
Change-Id: I1cb50889299957c871c498e19aa05778c7583c9d
2021-09-28 19:15:36 +00:00
huangqiujun
477cd8fd78 ANDROID: GKI: Update symbols to symbol list
Update symbols to symbol list externed by oem modules.

Leaf changes summary: 18 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 13 Added
functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 5 Added
variables

13 Added functions:

  [A] 'function int __traceiter_android_vh_kmalloc_slab(void*, unsigned
int, gfp_t, kmem_cache**)'
  [A] 'function int __traceiter_android_vh_save_track_hash(void*, bool,
unsigned long int)'
  [A] 'function int __traceiter_android_vh_save_vmalloc_stack(void*,
unsigned long int, vm_struct*)'
  [A] 'function int __traceiter_android_vh_show_stack_hash(void*,
seq_file*, vm_struct*)'
  [A] 'function void cpufreq_update_limits(unsigned int)'
  [A] 'function bool inode_owner_or_capable(const inode*)'
  [A] 'function int inode_permission(inode*, int)'
  [A] 'function void on_each_cpu_cond(smp_cond_func_t, smp_call_func_t,
void*, bool)'
  [A] 'function void pm_get_active_wakeup_sources(char*, size_t)'
  [A] 'function int rtc_read_alarm(rtc_device*, rtc_wkalrm*)'
  [A] 'function int rtc_set_alarm(rtc_device*, rtc_wkalrm*)'
  [A] 'function u8 sdio_writeb_readb(sdio_func*, u8, unsigned int,
int*)'
  [A] 'function unsigned long int timespec64_to_jiffies(const
timespec64*)'

5 Added variables:

  [A] 'tracepoint __tracepoint_android_vh_kmalloc_slab'
  [A] 'tracepoint __tracepoint_android_vh_save_track_hash'
  [A] 'tracepoint __tracepoint_android_vh_save_vmalloc_stack'
  [A] 'tracepoint __tracepoint_android_vh_show_stack_hash'
  [A] 'static_key_false memcg_kmem_enabled_key'

Bug: 193384408

Change-Id: Iafe49d5a0ca39542d7f109e79f496346009ac7b7
Signed-off-by: huangqiujun <huangqiujun@oppo.com>
2021-09-28 17:23:59 +00:00
Gao Xiang
dcd77f0b74 UPSTREAM: erofs: fix 1 lcluster-sized pcluster for big pcluster
If the 1st NONHEAD lcluster of a pcluster isn't CBLKCNT lcluster type
rather than a HEAD or PLAIN type instead, which means its pclustersize
_must_ be 1 lcluster (since its uncompressed size < 2 lclusters),
as illustrated below:

       HEAD     HEAD / PLAIN    lcluster type
   ____________ ____________
  |_:__________|_________:__|   file data (uncompressed)
   .                .
  .____________.
  |____________|                pcluster data (compressed)

Such on-disk case was explained before [1] but missed to be handled
properly in the runtime implementation.

It can be observed if manually generating 1 lcluster-sized pcluster
with 2 lclusters (thus CBLKCNT doesn't exist.) Let's fix it now.

[1] https://lore.kernel.org/r/20210407043927.10623-1-xiang@kernel.org

Link: https://lore.kernel.org/r/20210510064715.29123-1-xiang@kernel.org
Fixes: cec6e93bea ("erofs: support parsing big pcluster compress indexes")
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <xiang@kernel.org>

Bug: 201372112
Change-Id: I7e46baa993790f8908287ac36e19d32e536116db
(cherry picked from commit 0852b6ca94)
Signed-off-by: Huang Jianan <huangjianan@oppo.com>
2021-09-28 08:33:46 +00:00
Gao Xiang
e085d3f0d0 UPSTREAM: erofs: enable big pcluster feature
Enable COMPR_CFGS and BIG_PCLUSTER since the implementations are
all settled properly.

Link: https://lore.kernel.org/r/20210407043927.10623-11-xiang@kernel.org
Acked-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>

Bug: 201372112
Change-Id: I85a9045c146b6877eb371904e82d0481e21bbb75
(cherry picked from commit 8e6c8fa9f2)
Signed-off-by: Huang Jianan <huangjianan@oppo.com>
2021-09-28 08:33:20 +00:00
Gao Xiang
ed0607cc52 UPSTREAM: erofs: support decompress big pcluster for lz4 backend
Prior to big pcluster, there was only one compressed page so it'd
easy to map this. However, when big pcluster is enabled, more work
needs to be done to handle multiple compressed pages. In detail,

 - (maptype 0) if there is only one compressed page + no need
   to copy inplace I/O, just map it directly what we did before;

 - (maptype 1) if there are more compressed pages + no need to
   copy inplace I/O, vmap such compressed pages instead;

 - (maptype 2) if inplace I/O needs to be copied, use per-CPU
   buffers for decompression then.

Another thing is how to detect inplace decompression is feasable or
not (it's still quite easy for non big pclusters), apart from the
inplace margin calculation, inplace I/O page reusing order is also
needed to be considered for each compressed page. Currently, if the
compressed page is the xth page, it shouldn't be reused as [0 ...
nrpages_out - nrpages_in + x], otherwise a full copy will be triggered.

Although there are some extra optimization ideas for this, I'd like
to make big pcluster work correctly first and obviously it can be
further optimized later since it has nothing with the on-disk format
at all.

Link: https://lore.kernel.org/r/20210407043927.10623-10-xiang@kernel.org
Acked-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>

Bug: 201372112
Change-Id: I8e8b90bd0a401850ea81d895dc55e5d8a2772ed7
(cherry picked from commit 598162d050)
Signed-off-by: Huang Jianan <huangjianan@oppo.com>
2021-09-28 08:32:20 +00:00
Gao Xiang
d34cb6cdc0 UPSTREAM: erofs: support parsing big pcluster compact indexes
Different from non-compact indexes, several lclusters are packed
as the compact form at once and an unique base blkaddr is stored for
each pack, so each lcluster index would take less space on avarage
(e.g. 2 bytes for COMPACT_2B.) btw, that is also why BIG_PCLUSTER
switch should be consistent for compact head0/1.

Prior to big pcluster, the size of all pclusters was 1 lcluster.
Therefore, when a new HEAD lcluster was scanned, blkaddr would be
bumped by 1 lcluster. However, that way doesn't work anymore for
big pcluster since we actually don't know the compressed size of
pclusters in advance (before reading CBLKCNT lcluster).

So, instead, let blkaddr of each pack be the first pcluster blkaddr
with a valid CBLKCNT, in detail,

 1) if CBLKCNT starts at the pack, this first valid pcluster is
    itself, e.g.
  _____________________________________________________________
 |_CBLKCNT0_|_NONHEAD_| .. |_HEAD_|_CBLKCNT1_| ... |_HEAD_| ...
 ^ = blkaddr base          ^ += CBLKCNT0           ^ += CBLKCNT1

 2) if CBLKCNT doesn't start at the pack, the first valid pcluster
    is the next pcluster, e.g.
  _________________________________________________________
 | NONHEAD_| .. |_HEAD_|_CBLKCNT0_| ... |_HEAD_|_HEAD_| ...
                ^ = blkaddr base        ^ += CBLKCNT0
                                               ^ += 1

When a CBLKCNT is found, blkaddr will be increased by CBLKCNT
lclusters, or a new HEAD is found immediately, bump blkaddr by 1
instead (see the picture above.)

Also noted if CBLKCNT is the end of the pack, instead of storing
delta1 (distance of the next HEAD lcluster) as normal NONHEADs,
it still uses the compressed block count (delta0) since delta1
can be calculated indirectly but the block count can't.

Adjust decoding logic to fit big pcluster compact indexes as well.

Link: https://lore.kernel.org/r/20210407043927.10623-9-xiang@kernel.org
Acked-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>

Bug: 201372112
Change-Id: I09d6bb4c9d390dc6169cb9dd4efbc7fd6b3be5d0
(cherry picked from commit b86269f438)
Signed-off-by: Huang Jianan <huangjianan@oppo.com>
2021-09-28 08:31:56 +00:00
Gao Xiang
051d76b899 UPSTREAM: erofs: support parsing big pcluster compress indexes
When INCOMPAT_BIG_PCLUSTER sb feature is enabled, legacy compress indexes
will also have the same on-disk header compact indexes to keep per-file
configurations instead of leaving it zeroed.

If ADVISE_BIG_PCLUSTER is set for a file, CBLKCNT will be loaded for each
pcluster in this file by parsing 1st non-head lcluster.

Link: https://lore.kernel.org/r/20210407043927.10623-8-xiang@kernel.org
Acked-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>

Bug: 201372112
Change-Id: I97b8d1cc54e057789d22f1cdfafc21ed6a69b149
(cherry picked from commit cec6e93bea)
Signed-off-by: Huang Jianan <huangjianan@oppo.com>
2021-09-28 08:31:46 +00:00
Gao Xiang
d149931601 UPSTREAM: erofs: adjust per-CPU buffers according to max_pclusterblks
Adjust per-CPU buffers on demand since big pcluster definition is
available. Also, bail out unsupported pcluster size according to
Z_EROFS_PCLUSTER_MAX_SIZE.

Link: https://lore.kernel.org/r/20210407043927.10623-7-xiang@kernel.org
Acked-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>

Bug: 201372112
Change-Id: I86665be0519f328614d93aa24cb06043655576b9
(cherry picked from commit 4fea63f7d7)
Signed-off-by: Huang Jianan <huangjianan@oppo.com>
2021-09-28 08:31:21 +00:00
Gao Xiang
95a1d5df84 UPSTREAM: erofs: add big physical cluster definition
Big pcluster indicates the size of compressed data for each physical
pcluster is no longer fixed as block size, but could be more than 1
block (more accurately, 1 logical pcluster)

When big pcluster feature is enabled for head0/1, delta0 of the 1st
non-head lcluster index will keep block count of this pcluster in
lcluster size instead of 1. Or, the compressed size of pcluster
should be 1 lcluster if pcluster has no non-head lcluster index.

Also note that BIG_PCLUSTER feature reuses COMPR_CFGS feature since
it depends on COMPR_CFGS and will be released together.

Link: https://lore.kernel.org/r/20210407043927.10623-6-xiang@kernel.org
Acked-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>

Bug: 201372112
Change-Id: Ibd33f2764f4420f370f9293ed325efdba9ea70a7
(cherry picked from commit 5404c33010)
Signed-off-by: Huang Jianan <huangjianan@oppo.com>
2021-09-28 08:30:24 +00:00
Gao Xiang
8043aaed1d UPSTREAM: erofs: fix up inplace I/O pointer for big pcluster
When picking up inplace I/O pages, it should be traversed in reverse
order in aligned with the traversal order of file-backed online pages.
Also, index should be updated together when preloading compressed pages.

Previously, only page-sized pclustersize was supported so no problem
at all. Also rename `compressedpages' to `icpage_ptr' to reflect its
functionality.

Link: https://lore.kernel.org/r/20210407043927.10623-5-xiang@kernel.org
Acked-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>

Bug: 201372112
Change-Id: I752769d004c18f74636bcfdea767572daa6f7072
(cherry picked from commit 81382f5f5c)
Signed-off-by: Huang Jianan <huangjianan@oppo.com>
2021-09-28 08:29:52 +00:00
Gao Xiang
6ad2f8f169 UPSTREAM: erofs: introduce physical cluster slab pools
Since multiple pcluster sizes could be used at once, the number of
compressed pages will become a variable factor. It's necessary to
introduce slab pools rather than a single slab cache now.

This limits the pclustersize to 1M (Z_EROFS_PCLUSTER_MAX_SIZE), and
get rid of the obsolete EROFS_FS_CLUSTER_PAGE_LIMIT, which has no
use now.

Link: https://lore.kernel.org/r/20210407043927.10623-4-xiang@kernel.org
Acked-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>

Bug: 201372112
Change-Id: I821f3cf35820dbb320eeedc3ae934fd1d455dfd7
(cherry picked from commit 9f6cc76e6f)
Signed-off-by: Huang Jianan <huangjianan@oppo.com>
2021-09-28 08:29:22 +00:00
Gao Xiang
432f58b100 UPSTREAM: erofs: introduce multipage per-CPU buffers
To deal the with the cases which inplace decompression is infeasible
for some inplace I/O. Per-CPU buffers was introduced to get rid of page
allocation latency and thrash for low-latency decompression algorithms
such as lz4.

For the big pcluster feature, introduce multipage per-CPU buffers to
keep such inplace I/O pclusters temporarily as well but note that
per-CPU pages are just consecutive virtually.

When a new big pcluster fs is mounted, its max pclustersize will be
read and per-CPU buffers can be growed if needed. Shrinking adjustable
per-CPU buffers is more complex (because we don't know if such size
is still be used), so currently just release them all when unloading.

Link: https://lore.kernel.org/r/20210409190630.19569-1-xiang@kernel.org
Acked-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>

Bug: 201372112
Change-Id: I5b3ab69ef58aaea635911b0c08cceeb4b38122da
(cherry picked from commit 524887347f)
Signed-off-by: Huang Jianan <huangjianan@oppo.com>
2021-09-28 08:28:24 +00:00
Vladimir Zapolskiy
571c9a0bd3 UPSTREAM: erofs: remove a void EROFS_VERSION macro set in Makefile
Since commit 4f761fa253 ("erofs: rename errln/infoln/debugln to
erofs_{err, info, dbg}") the defined macro EROFS_VERSION has no affect,
therefore removing it from the Makefile is a non-functional change.

Link: https://lore.kernel.org/r/20201030122839.25431-1-vladimir@tuxera.com
Reviewed-by: Gao Xiang <hsiangkao@redhat.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Vladimir Zapolskiy <vladimir@tuxera.com>
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>

Bug: 201372112
Change-Id: I06df2883e85d4bfdc08bccb7aa7c014570cd156b
(cherry picked from commit a426ce9d67)
Signed-off-by: Huang Jianan <huangjianan@oppo.com>
2021-09-28 08:27:55 +00:00
Gao Xiang
431d73396d UPSTREAM: erofs: reserve physical_clusterbits[]
Formal big pcluster design is actually more powerful / flexable than
the previous thought whose pclustersize was fixed as power-of-2 blocks,
which was obviously inefficient and space-wasting. Instead, pclustersize
can now be set independently for each pcluster, so various pcluster
sizes can also be used together in one file if mkfs wants (for example,
according to data type and/or compression ratio).

Let's get rid of previous physical_clusterbits[] setting (also notice
that corresponding on-disk fields are still 0 for now). Therefore,
head1/2 can be used for at most 2 different algorithms in one file and
again pclustersize is now independent of these.

Link: https://lore.kernel.org/r/20210407043927.10623-2-xiang@kernel.org
Acked-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>

Bug: 201372112
Change-Id: I7db236f06b202949b882a366b347f0c4e9dc0c3e
(cherry picked from commit 54e0b6c873)
Signed-off-by: Huang Jianan <huangjianan@oppo.com>
2021-09-28 08:27:22 +00:00
Ruiqi Gong
89dbc6246a UPSTREAM: erofs: Clean up spelling mistakes found in fs/erofs
zmap.c: s/correspoinding/corresponding
zdata.c: s/endding/ending

Link: https://lore.kernel.org/r/20210331093920.31923-1-gongruiqi1@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Ruiqi Gong <gongruiqi1@huawei.com>
Reviewed-by: Gao Xiang <hsiangkao@redhat.com>
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>

Bug: 201372112
Change-Id: Ie848ca314462a8093fe94405b260c12b23b663b9
(cherry picked from commit fe6adcce7e)
Signed-off-by: Huang Jianan <huangjianan@oppo.com>
2021-09-28 08:26:25 +00:00
Gao Xiang
ac1f14e9d5 UPSTREAM: erofs: add on-disk compression configurations
Add a bitmap for available compression algorithms and a variable-sized
on-disk table for compression options in preparation for upcoming big
pcluster and LZMA algorithm, which follows the end of super block.

To parse the compression options, the bitmap is scanned one by one.
For each available algorithm, there is data followed by 2-byte `length'
correspondingly (it's enough for most cases, or entire fs blocks should
be used.)

With such available algorithm bitmap, kernel itself can also refuse to
mount such filesystem if any unsupported compression algorithm exists.

Note that COMPR_CFGS feature will be enabled with BIG_PCLUSTER.

Link: https://lore.kernel.org/r/20210329100012.12980-1-hsiangkao@aol.com
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>

Bug: 201372112
Change-Id: I9f9c69d5cd05da8c5f17e3650511e83c5f89200e
(cherry picked from commit 14373711dd)
Signed-off-by: Huang Jianan <huangjianan@oppo.com>
2021-09-28 08:26:06 +00:00
Gao Xiang
cd21e62366 UPSTREAM: erofs: introduce on-disk lz4 fs configurations
Introduce z_erofs_lz4_cfgs to store all lz4 configurations.
Currently it's only max_distance, but will be used for new
features later.

Link: https://lore.kernel.org/r/20210329012308.28743-4-hsiangkao@aol.com
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>

Bug: 201372112
Change-Id: Ib9873b530bdc82f8cc5e79ac85ede737d883ff12
(cherry picked from commit 46249cded1)
Signed-off-by: Huang Jianan <huangjianan@oppo.com>
2021-09-28 08:25:23 +00:00
Gao Xiang
e17fd2ac9d UPSTREAM: erofs: introduce erofs_sb_has_xxx() helpers
Introduce erofs_sb_has_xxx() to make long checks short, especially
for later big pcluster & LZMA features.

Link: https://lore.kernel.org/r/20210329012308.28743-2-hsiangkao@aol.com
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>

Bug: 201372112
Change-Id: I145fa9c670284b609b59a246f918fb09dc562356
(cherry picked from commit de06a6a375)
Signed-off-by: Huang Jianan <huangjianan@oppo.com>
2021-09-28 08:24:39 +00:00
Yue Hu
ba1a3d1fb2 UPSTREAM: erofs: don't use erofs_map_blocks() any more
Currently, erofs_map_blocks() will be called only from
erofs_{bmap, read_raw_page} which are all for uncompressed files.
So, the compression branch in erofs_map_blocks() is pointless. Let's
remove it and use erofs_map_blocks_flatmode() directly. Also update
related comments.

Link: https://lore.kernel.org/r/20210325071008.573-1-zbestahu@gmail.com
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Yue Hu <huyue2@yulong.com>
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>

Bug: 201372112
Change-Id: Ic3362c62d7c917f05f1cd11120ee6280a22221b8
(cherry picked from commit 8137824edd)
Signed-off-by: Huang Jianan <huangjianan@oppo.com>
2021-09-28 08:23:24 +00:00
Gao Xiang
384b2cdaf8 UPSTREAM: erofs: complete a missing case for inplace I/O
Add a missing case which could cause unnecessary page allocation but
not directly use inplace I/O instead, which increases runtime extra
memory footprint.

The detail is, considering an online file-backed page, the right half
of the page is chosen to be cached (e.g. the end page of a readahead
request) and some of its data doesn't exist in managed cache, so the
pcluster will be definitely kept in the submission chain. (IOWs, it
cannot be decompressed without I/O, e.g., due to the bypass queue).

Currently, DELAYEDALLOC/TRYALLOC cases can be downgraded as NOINPLACE,
and stop online pages from inplace I/O. After this patch, unneeded page
allocations won't be observed in pickup_page_for_submission() then.

Link: https://lore.kernel.org/r/20210321183227.5182-1-hsiangkao@aol.com
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>

Bug: 201372112
Change-Id: I639279e87b749b8625d2a8e77055a9fc52073542
(cherry picked from commit 0b964600d3)
Signed-off-by: Huang Jianan <huangjianan@oppo.com>
2021-09-28 08:21:51 +00:00
Minchan Kim
a9ac6ae90e BACKPORT: UPSTREAM: mm: fs: invalidate bh_lrus for only cold path
kernel test robot reported the regression of fio.write_iops[1] with [2].

Since lru_add_drain is called frequently, invalidate bh_lrus there could
increase bh_lrus cache miss ratio, which needs more IO in the end.

This patch moves the bh_lrus invalidation from the hot path( e.g.,
zap_page_range, pagevec_release) to cold path(i.e., lru_add_drain_all,
lru_cache_disable).

"Xing, Zhengjun" confirmed

: I test the patch, the regression reduced to -2.9%.

[1] https://lore.kernel.org/lkml/20210520083144.GD14190@xsang-OptiPlex-9020/
[2] 8cc621d2f4, mm: fs: invalidate BH LRU during page migration

Bug: 194673488
Link: https://lkml.kernel.org/r/20210907212347.1977686-1-minchan@kernel.org
(cherry picked from commit 243418e392)
[Chris: resolved conflicts due to Minchan's AOSP LRU commits]
Signed-off-by: Minchan Kim <minchan@kernel.org>
Reported-by: kernel test robot <oliver.sang@intel.com>
Reviewed-by: Chris Goldsworthy <cgoldswo@codeaurora.org>
Tested-by: "Xing, Zhengjun" <zhengjun.xing@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Chris Goldsworthy <quic_cgoldswo@quicinc.com>
Change-Id: Icc5e456b058df516480b4378853464d6d7b43505
2021-09-27 17:48:37 -07:00