Re: [PATCH v4] powerpc/pseries/vas: Use usleep_range() to support HCALL delay

2023-12-31 Thread Aneesh Kumar K . V
Haren Myneni  writes:

> VAS allocate, modify and deallocate HCALLs returns
> H_LONG_BUSY_ORDER_1_MSEC or H_LONG_BUSY_ORDER_10_MSEC for busy
> delay and expects OS to reissue HCALL after that delay. But using
> msleep() will often sleep at least 20 msecs even though the
> hypervisor suggests OS reissue these HCALLs after 1 or 10msecs.
>
> The open and close VAS window functions hold mutex and then issue
> these HCALLs. So these operations can take longer than the
> necessary when multiple threads issue open or close window APIs
> simultaneously, especially might affect the performance in the
> case of repeat open/close APIs for each compression request.
> On the large machine configuration which allows more simultaneous
> open/close windows (Ex: 240 cores provides 4800 VAS credits), the
> user can observe hung task traces in dmesg due to mutex contention
> around open/close HCAlls.
>
> So instead of msleep(), use usleep_range() to ensure sleep with
> the expected value before issuing HCALL again.
>
> Signed-off-by: Haren Myneni 
> Suggested-by: Nathan Lynch 
>
> ---
> v1 -> v2:
> - Use usleep_range instead of using RTAS sleep routine as
>   suggested by Nathan
> v2 -> v3:
> - Sleep 10MSecs even for HCALL delay > 10MSecs and the other
>   commit / comemnt changes as suggested by Nathan and Ellerman.
> v4 -> v3:
> - More description in the commit log with the visible impact for
>   the current code as suggested by Aneesh
> ---
>  arch/powerpc/platforms/pseries/vas.c | 25 -
>  1 file changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/platforms/pseries/vas.c 
> b/arch/powerpc/platforms/pseries/vas.c
> index 71d52a670d95..5cf81c564d4b 100644
> --- a/arch/powerpc/platforms/pseries/vas.c
> +++ b/arch/powerpc/platforms/pseries/vas.c
> @@ -38,7 +38,30 @@ static long hcall_return_busy_check(long rc)
>  {
>   /* Check if we are stalled for some time */
>   if (H_IS_LONG_BUSY(rc)) {
> - msleep(get_longbusy_msecs(rc));
> + unsigned int ms;
> + /*
> +  * Allocate, Modify and Deallocate HCALLs returns
> +  * H_LONG_BUSY_ORDER_1_MSEC or H_LONG_BUSY_ORDER_10_MSEC
> +  * for the long delay. So the sleep time should always
> +  * be either 1 or 10msecs, but in case if the HCALL
> +  * returns the long delay > 10 msecs, clamp the sleep
> +  * time to 10msecs.
> +  */
> + ms = clamp(get_longbusy_msecs(rc), 1, 10);
> +
> + /*
> +  * msleep() will often sleep at least 20 msecs even
> +  * though the hypervisor suggests that the OS reissue
> +  * HCALLs after 1 or 10msecs. Also the delay hint from
> +  * the HCALL is just a suggestion. So OK to pause for
> +  * less time than the hinted delay. Use usleep_range()
> +  * to ensure we don't sleep much longer than actually
> +  * needed.
> +  *
> +  * See Documentation/timers/timers-howto.rst for
> +  * explanation of the range used here.
> +  */
> + usleep_range(ms * 100, ms * 1000);
>

Is there more details on this range? (ms *100, ms * 1000)

can we use USEC_PER_MSEC instead of 1000.



>   rc = H_BUSY;
>   } else if (rc == H_BUSY) {
>   cond_resched();


It would be good to convert this to a helper and switch rtas_busy_delay
to use this new helper. One question though is w.r.t the clamp values.
Does that need to be specific to each hcall? Can we make it generic?

rtas_busy_delay() expliclity check for 20msec. Any reason to do that?
timers-howto.rst suggest > 10msec to use msleep. 

if (ms <= 20)
usleep_range(ms * 100, ms * 1000);
else
msleep(ms);


[Bug 216368] do_IRQ: stack overflow at boot during btrfs handling on a PowerMac G5 11,2

2023-12-31 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=216368

Erhard F. (erhar...@mailbox.org) changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |OBSOLETE

--- Comment #9 from Erhard F. (erhar...@mailbox.org) ---
Have not seen this on my G5 and the Talos II since some kernel releases.

Closing as obsolete.

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

[GIT PULL] Please pull powerpc/linux.git powerpc-6.8-1 tag

2023-12-31 Thread Michael Ellerman
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Hi Linus,

When the time comes, please pull powerpc updates for 6.8:

The following changes since commit 98b1cc82c4affc16f5598d4fa14b1858671b2263:

  Linux 6.7-rc2 (2023-11-19 15:02:14 -0800)

are available in the git repository at:

  https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git 
tags/powerpc-6.8-1

for you to fetch changes up to 44a1aad2fe6c10bfe0589d8047057b10a4c18a19:

  Merge branch 'topic/ppc-kvm' into next (2023-12-29 15:30:45 +1100)

- --
powerpc updates for 6.8

 - Add initial support to recognise the HeXin C2000 processor.

 - Add papr-vpd and papr-sysparm character device drivers for VPD & sysparm
   retrieval, so userspace tools can be adapted to avoid doing raw firmware
   calls from userspace.

 - Sched domains optimisations for shared processor partitions on P9/P10.

 - A series of optimisations for KVM running as a nested HV under PowerVM.

 - Other small features and fixes.

Thanks to: Aditya Gupta, Aneesh Kumar K.V, Arnd Bergmann, Christophe Leroy,
Colin Ian King, Dario Binacchi, David Heidelberg, Geoff Levand, Gustavo A.
R. Silva, Haoran Liu, Jordan Niethe, Kajol Jain, Kevin Hao, Kunwu Chan, Li
kunyu, Li zeming, Masahiro Yamada, Michal Suchánek, Nathan Lynch, Naveen N Rao,
Nicholas Piggin, Randy Dunlap, Sathvika Vasireddy, Srikar Dronamraju, Stephen
Rothwell, Vaibhav Jain, Zhao Ke.

- --
Aditya Gupta (1):
  powerpc: add cpu_spec.cpu_features to vmcoreinfo

Aneesh Kumar K.V (1):
  powerpc/sched: Cleanup vcpu_is_preempted()

Aneesh Kumar K.V (IBM) (2):
  powerpc/book3s/hash: Drop _PAGE_PRIVILEGED from PAGE_NONE
  powerpc/book3s64: Avoid __pte_protnone() check in __pte_flags_need_flush()

Arnd Bergmann (3):
  powerpc/ps3: move udbg_shutdown_ps3gelic prototype
  powerpc/pasemi: mark pas_shutdown() static
  powerpc/powermac: mark smp_psurge_{give,take}_timebase static

Colin Ian King (1):
  selftests/powerpc: Fix spelling mistake "EACCESS" -> "EACCES"

Dario Binacchi (1):
  powerpc/85xx: Fix typo in code comment

David Heidelberg (1):
  powerpc/fsl: Fix fsl,tmu-calibration to match the schema

Geoff Levand (1):
  powerpc/ps3_defconfig: Disable PPC64_BIG_ENDIAN_ELF_ABI_V2

Haoran Liu (1):
  powerpc/powernv: Add error handling to opal_prd_range_is_valid

Jordan Niethe (11):
  KVM: PPC: Book3S HV nestedv2: Invalidate RPT before deleting a guest
  KVM: PPC: Book3S HV nestedv2: Avoid reloading the tb offset
  KVM: PPC: Book3S HV nestedv2: Do not check msr on hcalls
  KVM: PPC: Book3S HV nestedv2: Get the PID only if needed to copy tofrom a 
guest
  KVM: PPC: Book3S HV nestedv2: Ensure LPCR_MER bit is passed to the L0
  KVM: PPC: Book3S HV nestedv2: Do not inject certain interrupts
  KVM: PPC: Book3S HV nestedv2: Avoid msr check in kvmppc_handle_exit_hv()
  KVM: PPC: Book3S HV nestedv2: Do not call H_COPY_TOFROM_GUEST
  KVM: PPC: Book3S HV nestedv2: Register the VPA with the L0
  KVM: PPC: Reduce reliance on analyse_instr() in mmio emulation
  KVM: PPC: Book3S HV nestedv2: Do not cancel pending decrementer exception

Kajol Jain (1):
  powerpc/hv-gpci: Add return value check in 
affinity_domain_via_partition_show function

Kevin Hao (3):
  powerpc/mpc83xx: Add the missing set_freezable() for agent_thread_fn()
  powerpc/mpc83xx: Use wait_event_freezable() for freezable kthread
  powerpc/ps3: Add missing set_freezable() for ps3_probe_thread()

Kunwu Chan (6):
  powerpc/xics: Check return value of kasprintf in icp_native_map_one_cpu
  powerpc/mm: Fix null-pointer dereference in pgtable_cache_add
  powerpc/powernv: Add a null pointer check to scom_debug_init_one()
  powerpc/powernv: Add a null pointer check in opal_event_init()
  powerpc/powernv: Add a null pointer check in opal_powercap_init()
  powerpc/imc-pmu: Add a null pointer check in update_events_in_group()

Li kunyu (1):
  misc: ocxl: main: Remove unnecessary ‘0’ values from rc

Li zeming (3):
  misc: ocxl: context: Remove unnecessary (void*) conversions
  misc: ocxl: afu_irq: Remove unnecessary (void*) conversions
  misc: ocxl: link: Remove unnecessary (void*) conversions

Masahiro Yamada (1):
  powerpc: add crtsavres.o to always-y instead of extra-y

Michael Ellerman (25):
  powerpc/configs/64s: Enable CONFIG_MEM_SOFT_DIRTY
  powerpc: Make cpu_spec __ro_after_init
  powerpc: Remove orphaned reg_a2.h
  powerpc/32: Drop unused grackle_set_stg()
  powerpc/lib: Avoid array bounds warnings in vec ops
  powerpc/suspend: Add prototype for do_after_copyback()
  powerpc/512x: Make pdm360ng_init() static
  powerpc/512x: Fix missing prototype warnings
  powerpc/44x: Make ppc44x_idle_init() static
  powerpc/64s: Fix CONFIG_NUMA=n build due to create_section_mapping()

Re: [PATCH] powerpc/hvcall: Reorder Nestedv2 hcall opcodes

2023-12-31 Thread Michael Ellerman
On Tue, 19 Dec 2023 14:52:36 +0530, Vaibhav Jain wrote:
> This trivial patch reorders the newly introduced hcall opcodes for Nestedv2
> to follow the increasing-opcode-number convention followed in
> 'hvcall.h'. The patch also updates the value for MAX_HCALL_OPCODE which is
> at various places in arch code for range checking.
> 
> 

Applied to powerpc/next.

[1/1] powerpc/hvcall: Reorder Nestedv2 hcall opcodes
  https://git.kernel.org/powerpc/c/eb8446e164572180c2cd0ea4e8494e4419202396

cheers


Re: [PATCH] powerpc/86xx: Drop unused CONFIG_MPC8610

2023-12-31 Thread Michael Ellerman
On Thu, 23 Nov 2023 14:29:02 +1100, Michael Ellerman wrote:
> The MPC8610 symbol used to be default y if MPC8610_HPCD, but since
> MPC8610_HPCD was removed MPC8610 is now never used. Remove it.
> 
> 

Applied to powerpc/next.

[1/1] powerpc/86xx: Drop unused CONFIG_MPC8610
  https://git.kernel.org/powerpc/c/5bb13e63cb00f0fdca5141f33d7a47bb26730a81

cheers


Re: [PATCH] powerpc/powernv: Add error handling to opal_prd_range_is_valid

2023-12-31 Thread Michael Ellerman
On Mon, 27 Nov 2023 06:41:08 -0800, Haoran Liu wrote:
> In the opal_prd_range_is_valid function within opal-prd.c,
> error handling was missing for the of_get_address call.
> This patch adds necessary error checking, ensuring that the
> function gracefully handles scenarios where of_get_address fails.
> 
> 

Applied to powerpc/next.

[1/1] powerpc/powernv: Add error handling to opal_prd_range_is_valid
  https://git.kernel.org/powerpc/c/e6beb47edb89ca9dc8906515e2dfbeb5913312c8

cheers


Re: [PATCH 0/3] powerpc: Fixes and optimization for the freezable kthread

2023-12-31 Thread Michael Ellerman
On Thu, 21 Dec 2023 12:45:07 +0800, Kevin Hao wrote:
> The main changes include:
>   - Invoke set_freezable() for the kthread which could be frozen
>   - Drop redundant try_to_freeze() invocation
> 
> Kevin Hao (3):
>   powerpc: mpc83xx: Add the missing set_freezable() for
> agent_thread_fn()
>   powerpc: mpc83xx: Use wait_event_freezable() for freezable kthread
>   powerpc: ps3: Add missing set_freezable() for ps3_probe_thread()
> 
> [...]

Applied to powerpc/next.

[1/3] powerpc: mpc83xx: Add the missing set_freezable() for agent_thread_fn()
  https://git.kernel.org/powerpc/c/6addc560e69cd1b2e68ef43ad62a878ac1956f51
[2/3] powerpc: mpc83xx: Use wait_event_freezable() for freezable kthread
  https://git.kernel.org/powerpc/c/11611d254c15cce1f58431b2965c6edb5aa7e610
[3/3] powerpc: ps3: Add missing set_freezable() for ps3_probe_thread()
  https://git.kernel.org/powerpc/c/ccc0f7b7673e63139ba9d916f4567d4fadb14b55

cheers


Re: [PATCH] powerpc/ps3_defconfig: Disable PPC64_BIG_ENDIAN_ELF_ABI_V2

2023-12-31 Thread Michael Ellerman
On Sun, 24 Dec 2023 09:52:46 +0900, Geoff Levand wrote:
> Commit 8c5fa3b5c4df3d071dab42b04b971df370d99354 (powerpc/64: Make ELFv2 the
> default for big-endian builds), merged in Linux-6.5-rc1 changes the calling 
> ABI
> in a way that is incompatible with the current code for the PS3's LV1 
> hypervisor
> calls.
> 
> This change just adds the line '# CONFIG_PPC64_BIG_ENDIAN_ELF_ABI_V2 is not 
> set'
> to the ps3_defconfig file so that the PPC64_ELF_ABI_V1 is used.
> 
> [...]

Applied to powerpc/next.

[1/1] powerpc/ps3_defconfig: Disable PPC64_BIG_ENDIAN_ELF_ABI_V2
  https://git.kernel.org/powerpc/c/482b718a84f08b6fc84879c3e90cc57dba11c115

cheers


Re: [PATCH][next] powerpc/selftests: Fix spelling mistake "EACCESS" -> "EACCES"

2023-12-31 Thread Michael Ellerman
On Fri, 15 Dec 2023 11:24:56 +, Colin Ian King wrote:
> There is a spelling mistake of the EACCES error name, fix it.
> 
> 

Applied to powerpc/next.

[1/1] powerpc/selftests: Fix spelling mistake "EACCESS" -> "EACCES"
  https://git.kernel.org/powerpc/c/ba5b952ad5f52e58c0f288b9d5427ad734600568

cheers