RTAS changes for 6.4
cover RTAS changes for 6.4
Proposed changes for the RTAS subsystem and client code.
Fixes that are subject to backporting are at the front of the queue, followed by documentation and cleanups, with enhancements at the end.
Noteworthy changes:
* Change sys_rtas() to consume -2/990x statuses instead of returning them to user space.
* Lockdep annotations for invariants in rtas.c.
---
Nathan Lynch (8):
powerpc/rtas: ensure 8-byte alignment for struct rtas_args powerpc/rtas: use memmove for potentially overlapping buffer copy powerpc/rtas: rtas_call_unlocked() kerneldoc powerpc/rtas: fix miswording in rtas_function kerneldoc powerpc/rtas: rename va_rtas_call_unlocked() to va_rtas_call() powerpc/rtas: lockdep annotations
powerpc/rtas: warn on unsafe argument to rtas_call_unlocked() powerpc/rtas: consume retry statuses in sys_rtas()
arch/powerpc/include/asm/rtas-types.h | 5 +- arch/powerpc/kernel/rtas.c | 92 +++++++++++++++++++++++++---------- 2 files changed, 69 insertions(+), 28 deletions(-)
---
base-commit: 422fbcbf91303706823bc3babceb1df1a42112bf
change-id: 20230220-rtas-queue-for-6-4-214eb2ba1407
Best regards,
Signature · 1 line
Nathan Lynch <[email protected]>
PATCH 1/8 powerpc/rtas: ensure 8-byte alignment for struct rtas_args
CHRP and PAPR agree: "In order to make an RTAS call, the operating system must construct an argument call buffer aligned on an eight byte boundary in physically contiguous real memory [...]." (7.2.7 Calling Mechanism and Conventions).
struct rtas_args is the type used for this argument call buffer. The unarchitected 'rets' member happens to produce 8-byte alignment for the struct on 64-bit targets in practice. But without an alignment directive the structure will have only 4-byte alignment on 32-bit targets:
$ nm b/{before,after}/chrp32/vmlinux | grep rtas_args
c096881c b rtas_args
c0968820 b rtas_argsAdd an alignment directive to the struct rtas_args declaration so all instances have the alignment required by the specs. rtas-types.h no longer refers to any spinlock types, so drop the spinlock_types.h inclusion while we're here.
--- arch/powerpc/include/asm/rtas-types.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/rtas-types.h +3 -2
@@ -2,7 +2,8 @@#ifndef _ASM_POWERPC_RTAS_TYPES_H#define _ASM_POWERPC_RTAS_TYPES_H -#include <linux/spinlock_types.h> +#include <linux/compiler_attributes.h> +#include <linux/sizes.h> typedef __be32 rtas_arg_t ;
@@ -12,7 +13,7 @@ struct rtas_args {__be32 nret;rtas_arg_t args[16 ];rtas_arg_t *rets;/* Pointer to return values in args[]. */ -}; +}__aligned(SZ_8) ;struct rtas_t {unsigned long entry;/* physical address pointer */
Signature · 1 line
2.39.1
Re: [PATCH 1/8] powerpc/rtas: ensure 8-byte alignment for struct rtas_args
Quoted 20 lines · On Mon, 2023-03-06 at 15:33 -0600, Nathan Lynch via B4 Relay wrote:
Quoted 20 lines
From: Nathan Lynch <[email protected]>
CHRP and PAPR agree: "In order to make an RTAS call, the operating system must construct an argument call buffer aligned on an eight byte
boundary in physically contiguous real memory [...]." (7.2.7 Calling
Mechanism and Conventions).struct
rtas_argsis the type used for this argument call buffer. The
unarchitected 'rets' member happens to produce 8-byte alignment for the struct on 64-bit targets in practice. But without an alignment directive the structure will have only 4-byte alignment on 32-bit targets:$ nm b/{before,after}/chrp32/vmlinux | grep rtas_args c096881c b rtas_args c0968820 b rtas_args
Quoted 7 lines
Quoted 7 lines
Add an alignment directive to the struct
rtas_argsdeclaration so all
instances have the alignment required by the specs.rtas-types.hno longer refers to any spinlock types, so drop thespinlock_types.hinclusion while we're here.Signed-off-by Nathan Lynch <[email protected]>
Quoted 19 lines
Quoted 19 lines
---
arch/powerpc/include/asm/rtas-types.h | 5 +++--1 file changed, 3 insertions(+), 2 deletions(-)arch/powerpc/include/asm/rtas-types.h +0
-0@@ -2,7 +2,8 @@ #ifndef _ASM_POWERPC_RTAS_TYPES_H #define _ASM_POWERPC_RTAS_TYPES_Harch/powerpc/include/asm/rtas-types.h +2
-1-#include <linux/spinlock_types.h> +#include <linux/compiler_attributes.h> +#include <linux/sizes.h>
typedef__be32rtas_arg_t;
Quoted 8 lines
arch/powerpc/include/asm/rtas-types.h struct rtas_args { · line 16
Quoted 8 lines
arch/powerpc/include/asm/rtas-types.h +0
-0@@ -12,7 +13,7 @@ struct rtas_args { __be32 nret; rtas_arg_t args[16];rtas_arg_t *rets; /* Pointer to return values in args[].
*/arch/powerpc/include/asm/rtas-types.h +1
-1-}; +}__aligned(SZ_8) ;
Nowhere else in the kernel uses __aligned(SZ_8) over just __aligned(8), which I suppose would also save an include, but I don't care either way.
Quoted 5 lines
Quoted 5 lines
structrtas_t{
unsigned long entry; /* physical address pointer */
Signature · 2 lines
Andrew Donnellan OzLabs, ADL Canberra [email protected] IBM Australia Limited
PATCH 2/8 powerpc/rtas: use memmove for potentially overlapping buffer copy
In reply to Nathan LynchUsing memcpy() isn't safe when buf is identical to rtas_err_buf, which can happen during boot before slab is up. Full context which may not be obvious from the diff:
if (altbuf) {
buf = altbuf;
} else {
buf = rtas_err_buf;
if (slab_is_available())
buf = kmalloc(RTAS_ERROR_LOG_MAX, GFP_ATOMIC);
}
if (buf)
memcpy(buf, rtas_err_buf, RTAS_ERROR_LOG_MAX);This was found by inspection and I'm not aware of it causing problems in practice. It appears to have been introduced by commit 033ef338b6e0 ("powerpc: Merge rtas.c into arch/powerpc/kernel"); the old ppc64 version of this code did not have this problem.
Use memmove() instead.
--- arch/powerpc/kernel/rtas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/rtas.c +1 -1
@@ -981,7 +981,7 @@ static char *__fetch_rtas_last_error(char *altbuf) buf =kmalloc (RTAS_ERROR_LOG_MAX ,GFP_ATOMIC ); }if (buf) -memcpy (buf, rtas_err_buf,RTAS_ERROR_LOG_MAX ); +memmove (buf, rtas_err_buf,RTAS_ERROR_LOG_MAX ); }return buf;
Signature · 1 line
2.39.1
Re: [PATCH 2/8] powerpc/rtas: use memmove for potentially overlapping buffer copy
Quoted 23 lines · On Mon, 2023-03-06 at 15:33 -0600, Nathan Lynch via B4 Relay wrote:
From: Nathan Lynch <[email protected]>
Using
memcpy()isn't safe when buf is identical tortas_err_buf, which
can happen during boot before slab is up. Full context which may not be obvious from the diff:if (altbuf) {
buf = altbuf;
} else {
buf =rtas_err_buf;
if (slab_is_available())
buf =kmalloc(RTAS_ERROR_LOG_MAX, GFP_ATOMIC);
}
if (buf)
memcpy(buf,rtas_err_buf,RTAS_ERROR_LOG_MAX);This was found by inspection and I'm not aware of it causing problems in practice. It appears to have been introduced by commit
033ef338b6e0("powerpc: Mergertas.cintoarch/powerpc/kernel"); the old ppc64 version of this code did not have this problem.
Quoted 5 lines
Use
memmove()instead.Fixes 033ef338b6e0 ("powerpc: Merge rtas.c into
arch/powerpc/kernel")Signed-off-by Nathan Lynch <[email protected]>
Signature · 2 lines
Andrew Donnellan OzLabs, ADL Canberra [email protected] IBM Australia Limited
PATCH 3/8 powerpc/rtas: rtas_call_unlocked() kerneldoc
In reply to Nathan LynchAdd documentation for rtas_call_unlocked(), including details on how it differs from rtas_call().
--- arch/powerpc/kernel/rtas.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/powerpc/kernel/rtas.c +17 -0
@@ -1016,6 +1016,23 @@ va_rtas_call_unlocked(struct rtas_args *args, int token, int nargs, int nret,do_enter_rtas (args); } +/** +* rtas_call_unlocked() - Invoke an RTAS firmware function without synchronization. +* @args: RTAS parameter block to be used for the call, must obey RTAS addressing +* constraints. +* @token: Identifies the function being invoked. +* @nargs: Number of input parameters. Does not include token. +* @nret: Number of output parameters, including the call status. +* @....: List of @nargs input parameters. +* +* Invokes the RTAS function indicated by @token, which the caller +* should obtain via rtas_function_token(). +* +* This function is similar to rtas_call(), but must be used with a +* limited set of RTAS calls specifically exempted from the general +* requirement that only one RTAS call may be in progress at any +* time. Examples include stop-self and ibm,nmi-interlock. +*/ void rtas_call_unlocked (struct rtas_args *args,int token,int nargs,int nret, ...) {va_list list;
Signature · 1 line
2.39.1
Re: [PATCH 3/8] powerpc/rtas: rtas_call_unlocked() kerneldoc
Quoted 6 lines · On Mon, 2023-03-06 at 15:33 -0600, Nathan Lynch via B4 Relay wrote:
From: Nathan Lynch <[email protected]>
Add documentation for
rtas_call_unlocked(), including details on how it differs fromrtas_call().Signed-off-by Nathan Lynch <[email protected]>
Signature · 2 lines
Andrew Donnellan OzLabs, ADL Canberra [email protected] IBM Australia Limited
PATCH 4/8 powerpc/rtas: fix miswording in rtas_function kerneldoc
In reply to Nathan LynchThe 'filter' member is a pointer, not a bool; fix the wording accordingly.
--- arch/powerpc/kernel/rtas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/rtas.c +1 -1
@@ -68,7 +68,7 @@ struct rtas_filter {* functions are believed to have no users on * ppc64le, and we want to keep it that way. It does * not make sense for this to be set when @filter -* is false. +* is NULL. */ struct rtas_function {s32 token;
Signature · 1 line
2.39.1
Re: [PATCH 4/8] powerpc/rtas: fix miswording in rtas_function kerneldoc
Quoted 6 lines · On Mon, 2023-03-06 at 15:33 -0600, Nathan Lynch via B4 Relay wrote:
From: Nathan Lynch <[email protected]>
The 'filter' member is a pointer, not a bool; fix the wording accordingly.
Signed-off-by Nathan Lynch <[email protected]>
Quoted 21 lines
---
arch/powerpc/kernel/rtas.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)arch/powerpc/kernel/rtas.c +0
-0@@ -68,7 +68,7 @@ struct rtas_filter { * functions are believed to have nousers on
* ppc64le, and we want to keep it that way. It does
* not make sense for this to be set when @filter
- * is false.
+ * is NULL.
*/
structrtas_function{
s32 token;
Signature · 2 lines
Andrew Donnellan OzLabs, ADL Canberra [email protected] IBM Australia Limited
PATCH 5/8 powerpc/rtas: rename va_rtas_call_unlocked() to va_rtas_call()
In reply to Nathan LynchThe function name va_rtas_call_unlocked() is confusing: it may be called with or without rtas_lock held. Rename it to va_rtas_call().
--- arch/powerpc/kernel/rtas.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
arch/powerpc/kernel/rtas.c +4 -5
@@ -996,9 +996,8 @@ static void __init init_error_log_max(void) {}#endif -static void -va_rtas_call_unlocked (struct rtas_args *args,int token,int nargs,int nret, -va_list list) +static void va_rtas_call (struct rtas_args *args,int token,int nargs,int nret, +va_list list) {int i;
@@ -1038,7 +1037,7 @@ void rtas_call_unlocked(struct rtas_args *args, int token, int nargs, int nret,va_list list;va_start (list, nret); -va_rtas_call_unlocked (args, token, nargs, nret, list); +va_rtas_call (args, token, nargs, nret, list);va_end (list); }
@@ -1138,7 +1137,7 @@ int rtas_call(int token, int nargs, int nret, int *outputs, ...) args = &rtas_args;va_start (list, outputs); -va_rtas_call_unlocked (args, token, nargs, nret, list); +va_rtas_call (args, token, nargs, nret, list);va_end (list);/* A -1 return code indicates that the last command couldn't
Signature · 1 line
2.39.1
Re: [PATCH 5/8] powerpc/rtas: rename va_rtas_call_unlocked() to va_rtas_call()
Quoted 6 lines · On Mon, 2023-03-06 at 15:33 -0600, Nathan Lynch via B4 Relay wrote:
From: Nathan Lynch <[email protected]>
The function name
va_rtas_call_unlocked()is confusing: it may be called with or withoutrtas_lockheld. Rename it tova_rtas_call().Signed-off-by Nathan Lynch <[email protected]>
Not a huge fan of the name, the va_ suggests that the only difference between this function and rtas_call() is the varargs handling. Perhaps something like __rtas_call()?
Quoted 43 lines
---
arch/powerpc/kernel/rtas.c | 9 ++++-----1 file changed, 4 insertions(+), 5 deletions(-)arch/powerpc/kernel/rtas.c +0
-0@@ -996,9 +996,8 @@ static void __init init_error_log_max(void) {} #endif
arch/powerpc/kernel/rtas.c +0
-2-static void -va_rtas_call_unlocked(struct rtas_args *args, int token, int nargs,int nret,
-va_listlist)
+static void va_rtas_call(structrtas_args*args, int token, int nargs, int nret,
+va_listlist)
{
int i;arch/powerpc/kernel/rtas.c +0
-0@@ -1038,7 +1037,7 @@ void rtas_call_unlocked(struct rtas_args *args, int token, int nargs, int nret, va_list list;
va_start(list, nret);
- va_rtas_call_unlocked(args, token, nargs, nret, list); + va_rtas_call(args, token, nargs, nret, list);va_end(list);
}arch/powerpc/kernel/rtas.c +0
-0@@ -1138,7 +1137,7 @@ int rtas_call(int token, int nargs, int nret, int *outputs, ...) args = &rtas_args;
va_start(list, outputs);
- va_rtas_call_unlocked(args, token, nargs, nret, list); + va_rtas_call(args, token, nargs, nret, list);va_end(list);
/* A -1 return code indicates that the last command couldn't
Signature · 2 lines
Andrew Donnellan OzLabs, ADL Canberra [email protected] IBM Australia Limited
Re: [PATCH 5/8] powerpc/rtas: rename va_rtas_call_unlocked() to va_rtas_call()
Quoted 11 lines · Andrew Donnellan
Quoted 6 lines · On Mon, 2023-03-06 at 15:33 -0600, Nathan Lynch via B4 Relay wrote:
From: Nathan Lynch <[email protected]>
The function name
va_rtas_call_unlocked()is confusing: it may be called with or withoutrtas_lockheld. Rename it tova_rtas_call().Signed-off-by Nathan Lynch <[email protected]>Not a huge fan of the name, the
va_suggests that the only difference between this function andrtas_call()is the varargs handling. Perhaps something like__rtas_call()?
I would be more inclined to agree if va_rtas_call() were a public API, like rtas_call().
But it's not, so the convention you're appealing to shouldn't inform the expectations of external users of the rtas_* APIs, at least.
__rtas_call() conveys strictly less information than va_rtas_call() IMO. Most functions in the kernel that take a va_list have a "v" worked into their name somehow.
Michael Ellerman
reviewerRe: [PATCH 5/8] powerpc/rtas: rename va_rtas_call_unlocked() to va_rtas_call()
In reply to Nathan LynchNathan Lynch via B4 Relay <[email protected]>
Quoted 4 lines · writes:
From: Nathan Lynch <[email protected]>
The function name
va_rtas_call_unlocked()is confusing: it may be called with or withoutrtas_lockheld. Rename it tova_rtas_call().
I'm not sure about this one.
The "unlocked" is meant to convey that it doesn't do any locking. The caller has to be OK with that, or do its own locking.
Andrew is right that the common naming pattern is foo() that takes the lock and __foo() that doesn't - but I agree that's not very pretty.
Can we just leave it as-is?
cheers
PATCH 6/8 powerpc/rtas: lockdep annotations
In reply to Nathan LynchAdd lockdep annotations for the following properties that must hold:
* Any error log retrieval must be atomically coupled with the prior RTAS call, without a window for another RTAS call to occur before the error log can be retrieved.
* All users of the core rtas_args parameter block must hold rtas_lock.
Move the definitions of rtas_lock and rtas_args up in the file so that __do_enter_rtas_trace() can refer to them.
--- arch/powerpc/kernel/rtas.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-)
arch/powerpc/kernel/rtas.c +23 -10
@@ -16,6 +16,7 @@#include <linux/init.h> #include <linux/kconfig.h> #include <linux/kernel.h> +#include <linux/lockdep.h> #include <linux/memblock.h> #include <linux/of.h> #include <linux/of_fdt.h>
@@ -453,6 +454,16 @@ static struct rtas_function rtas_function_table[] __ro_after_init = { }, }; +/* +* Nearly all RTAS calls need to be serialized. All uses of the +* default rtas_args block must hold rtas_lock. +* +* Exceptions to the RTAS serialization requirement (e.g. stop-self) +* must use a separate rtas_args structure. +*/ +static DEFINE_RAW_SPINLOCK (rtas_lock); +static struct rtas_args rtas_args; +/** * rtas_function_token() - RTAS function token lookup. * @handle: Function handle, e.g. RTAS_FN_EVENT_SCAN.
@@ -560,6 +571,9 @@ static void __do_enter_rtas(struct rtas_args *args)static void __do_enter_rtas_trace (struct rtas_args *args) {const char *name =NULL ; + +if (args == &rtas_args) +lockdep_assert_held (&rtas_lock);/* * If the tracepoints that consume the function name aren't * active, avoid the lookup.
@@ -619,16 +633,6 @@ static void do_enter_rtas(struct rtas_args *args)struct rtas_t rtas; -/* -* Nearly all RTAS calls need to be serialized. All uses of the -* default rtas_args block must hold rtas_lock. -* -* Exceptions to the RTAS serialization requirement (e.g. stop-self) -* must use a separate rtas_args structure. -*/ -static DEFINE_RAW_SPINLOCK (rtas_lock); -static struct rtas_args rtas_args; -DEFINE_SPINLOCK (rtas_data_buf_lock);EXPORT_SYMBOL_GPL (rtas_data_buf_lock);
@@ -951,6 +955,8 @@ static char *__fetch_rtas_last_error(char *altbuf)u32 bufsz;char *buf =NULL ; +lockdep_assert_held (&rtas_lock); +if (token ==-1 )return NULL ;
@@ -1107,6 +1113,7 @@ static bool token_is_restricted_errinjct(s32 token)*/ int rtas_call (int token,int nargs,int nret,int *outputs, ...) { +struct pin_cookie cookie;va_list list;int i;unsigned long flags;
@@ -1133,6 +1140,8 @@ int rtas_call(int token, int nargs, int nret, int *outputs, ...) }raw_spin_lock_irqsave (&rtas_lock, flags); + cookie =lockdep_pin_lock (&rtas_lock); +/* We use the global rtas args buffer */ args = &rtas_args;
@@ -1150,6 +1159,7 @@ int rtas_call(int token, int nargs, int nret, int *outputs, ...) outputs[i] =be32_to_cpu (args->rets[i +1 ]); ret = (nret >0 ) ?be32_to_cpu (args->rets[0 ]) :0 ; +lockdep_unpin_lock (&rtas_lock, cookie);raw_spin_unlock_irqrestore (&rtas_lock, flags);if (buff_copy) {
@@ -1781,6 +1791,7 @@ static bool block_rtas_call(int token, int nargs,/* We assume to be passed big endian arguments */ SYSCALL_DEFINE1(rtas, struct rtas_args __user *, uargs) { +struct pin_cookie cookie;struct rtas_args args;unsigned long flags;char *buff_copy, *errbuf =NULL ;
@@ -1849,6 +1860,7 @@ SYSCALL_DEFINE1(rtas, struct rtas_args __user *, uargs) buff_copy =get_errorlog_buffer ();raw_spin_lock_irqsave (&rtas_lock, flags); + cookie =lockdep_pin_lock (&rtas_lock); rtas_args = args;do_enter_rtas (&rtas_args);
@@ -1859,6 +1871,7 @@ SYSCALL_DEFINE1(rtas, struct rtas_args __user *, uargs)if (be32_to_cpu (args.rets[0 ]) ==-1 ) errbuf =__fetch_rtas_last_error (buff_copy); +lockdep_unpin_lock (&rtas_lock, cookie);raw_spin_unlock_irqrestore (&rtas_lock, flags);if (buff_copy) {
Signature · 1 line
2.39.1
Re: [PATCH 6/8] powerpc/rtas: lockdep annotations
Quoted 9 lines · On Mon, 2023-03-06 at 15:33 -0600, Nathan Lynch via B4 Relay wrote:
From: Nathan Lynch <[email protected]>
Add lockdep annotations for the following properties that must hold:
* Any error log retrieval must be atomically coupled with the prior RTAS call, without a window for another RTAS call to occur before the
error log can be retrieved.
Quoted 8 lines
* All users of the core
rtas_argsparameter block must holdrtas_lock.Move the definitions of
rtas_lockandrtas_argsup in the file so that__do_enter_rtas_trace()can refer to them.Signed-off-by Nathan Lynch <[email protected]>
I'm no lockdep expert and I haven't checked if every possible case that can be annotated has been annotated, but these changes make sense as far as I can tell from my limited inspection.
Signature · 2 lines
Andrew Donnellan OzLabs, ADL Canberra [email protected] IBM Australia Limited
PATCH 7/8 powerpc/rtas: warn on unsafe argument to rtas_call_unlocked()
In reply to Nathan LynchAny caller of rtas_call_unlocked() must provide an rtas_args parameter block distinct from the core rtas_args buffer used by the rtas_call() path. It's an unlikely error to make, but the potential consequences are grim, and it's trivial to check.
--- arch/powerpc/kernel/rtas.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/powerpc/kernel/rtas.c +7 -0
@@ -1042,6 +1042,13 @@ void rtas_call_unlocked(struct rtas_args *args, int token, int nargs, int nret, {va_list list; +/* +* Callers must not use rtas_args; otherwise they risk +* corrupting the state of the rtas_call() path, which is +* serialized by rtas_lock. +*/ +WARN_ON (args == &rtas_args); +va_start (list, nret);va_rtas_call (args, token, nargs, nret, list);va_end (list);
Signature · 1 line
2.39.1
Re: [PATCH 7/8] powerpc/rtas: warn on unsafe argument to rtas_call_unlocked()
Quoted 9 lines · On Mon, 2023-03-06 at 15:33 -0600, Nathan Lynch via B4 Relay wrote:
From: Nathan Lynch <[email protected]>
Any caller of
rtas_call_unlocked()must provide anrtas_argsparameter
block distinct from the corertas_argsbuffer used by thertas_call()path. It's an unlikely error to make, but the potential consequences are grim, and it's trivial to check.Signed-off-by Nathan Lynch <[email protected]>
call_rtas_display_status() seems to do exactly this, or am I missing something?
Quoted 24 lines
---
arch/powerpc/kernel/rtas.c | 7 +++++++1 file changed, 7 insertions(+)arch/powerpc/kernel/rtas.c +0
-0@@ -1042,6 +1042,13 @@ void rtas_call_unlocked(struct rtas_args *args, int token, int nargs, int nret, { va_list list;
+ /*
+ * Callers must not usertas_args; otherwise they risk + * corrupting the state of thertas_call()path, which is + * serialized byrtas_lock.
+ */
+ WARN_ON(args ==&rtas_args);
+
va_start(list, nret);
va_rtas_call(args, token, nargs, nret, list);va_end(list);
Signature · 2 lines
Andrew Donnellan OzLabs, ADL Canberra [email protected] IBM Australia Limited
Re: [PATCH 7/8] powerpc/rtas: warn on unsafe argument to rtas_call_unlocked()
Quoted 9 lines · Andrew Donnellan
Quoted 8 lines · On Mon, 2023-03-06 at 15:33 -0600, Nathan Lynch via B4 Relay wrote:
From: Nathan Lynch <[email protected]>
Any caller of
rtas_call_unlocked()must provide anrtas_argsparameter
block distinct from the corertas_argsbuffer used by thertas_call()path. It's an unlikely error to make, but the potential consequences are grim, and it's trivial to check.
Quoted 4 lines
Quoted 1 line
Signed-off-by Nathan Lynch <[email protected]>
call_rtas_display_status()seems to do exactly this, or am I missing something?
No you're right, the warning would be spurious in that case. May need to drop this one, or refactor rtas_call():
4456f4524604be2558e5f6a8e0f7cc9ed17c783e
Author: Michael Ellerman <[email protected]>
AuthorDate: Tue Nov 24 22:26:11 2015 +1100
powerpc/rtas: Use rtas_call_unlocked() in call_rtas_display_status()
Although call_rtas_display_status() does actually want to use the regular RTAS locking, it doesn't want the extra logic that is in rtas_call(), so currently it open codes the logic.
Instead we can use rtas_call_unlocked(), after taking the RTAS lock.
aside: does anyone know if the display_status() code is worth keeping? It looks like it is used to drive the 16-character wide physical LCD I remember seeing on P4-era and older machines. Is it a vestige of non-LPAR pseries that should be dropped, or is it perhaps useful for chrp or cell?
Re: [PATCH 7/8] powerpc/rtas: warn on unsafe argument to rtas_call_unlocked()
Quoted 6 lines · Nathan Lynch
aside: does anyone know if the
display_status()code is worth keeping? It looks like it is used to drive the 16-character wide physical LCD I remember seeing on P4-era and older machines. Is it a vestige of non-LPAR pseries that should be dropped, or is it perhaps useful for chrp or cell?
Never mind, I see the display-character token and associated properties on a P8 LPAR and in a current PAPR.
Michael Ellerman
reviewerRe: [PATCH 7/8] powerpc/rtas: warn on unsafe argument to rtas_call_unlocked()
Quoted 10 lines · Nathan Lynch
Quoted 6 lines · Nathan Lynch
aside: does anyone know if the
display_status()code is worth keeping? It looks like it is used to drive the 16-character wide physical LCD I remember seeing on P4-era and older machines. Is it a vestige of non-LPAR pseries that should be dropped, or is it perhaps useful for chrp or cell?Never mind, I see the display-character token and associated properties on a P8 LPAR and in a current PAPR.
Or a P10 LPAR even.
The characters written using it are shown on the HMC, somewhere on the partition info page.
cheers
Re: [PATCH 7/8] powerpc/rtas: warn on unsafe argument to rtas_call_unlocked()
Quoted 9 lines · Michael Ellerman
Quoted 8 lines · Nathan Lynch
Quoted 6 lines · Nathan Lynch
aside: does anyone know if the
display_status()code is worth keeping? It looks like it is used to drive the 16-character wide physical LCD I remember seeing on P4-era and older machines. Is it a vestige of non-LPAR pseries that should be dropped, or is it perhaps useful for chrp or cell?
Quoted 7 lines
Quoted 2 lines
Never mind, I see the display-character token and associated properties on a P8 LPAR and in a current PAPR.
Or a P10 LPAR even.
The characters written using it are shown on the HMC, somewhere on the partition info page.
Yes, in the "Reference code" field. On the command line, you can see the history, too:
hscroot@ltchmcv3:~> lsrefcode -r lpar -m ltczep4 --filter lpar_names=ltczep4-lp3 -n 10 -F 'time_stamp refcode' "03/28/2023 18:38:20" "Linux ppc64le"
"03/28/2023 18:38:19" CA000093
"03/28/2023 18:38:19" CA00E891
"03/28/2023 18:38:19" CA260208
"03/28/2023 18:38:19" CA260208
"03/28/2023 18:38:19" CA00E890
"03/28/2023 18:38:19" CA000050
"03/28/2023 18:38:19" CA000040
"03/28/2023 18:38:19" CA00E880
"03/28/2023 18:38:19" CA00E879
https://www.ibm.com/docs/en/power10/000V-HMC?topic=commands-lsrefcode
PATCH 8/8 powerpc/rtas: consume retry statuses in sys_rtas()
In reply to Nathan LynchThe kernel can handle retrying RTAS function calls in response to -2/990x in the sys_rtas() handler instead of relaying the intermediate status to user space.
Justifications:
* Currently it's nondeterministic and quite variable in practice whether a retry status is returned for any given invocation of sys_rtas(). Therefore user space code cannot be expecting a retry result without already being broken.
* This tends to significantly reduce the total number of system calls issued by programs such as drmgr which make use of sys_rtas(), improving the experience of tracing and debugging such programs. This is the main motivation for me: I think this change will make it easier for us to characterize current sys_rtas() use cases as we move them to other interfaces over time.
* It reduces the number of opportunities for user space to leave complex operations, such as those associated with DLPAR, incomplete and diffcult to recover.
* We can expect performance improvements for existing sys_rtas() users, not only because of overall reduction in the number of system calls issued, but also due to the better handling of -2/990x in the kernel. For example, librtas still sleeps for 1ms on -2, which is completely unnecessary.
Performance differences for PHB add and remove on a small P10 PowerVM partition are included below. For add, elapsed time is slightly reduced. For remove, there are more significant improvements: the number of context switches is reduced by an order of magnitude, and elapsed time is reduced by over half.
(- before, + after):
Performance counter stats for 'drmgr -c phb -a -s PHB 23' (5 runs):
- 1,847.58 msec task-clock # 0.135 CPUs utilized ( +- 14.15% ) - 10,867 cs # 9.800 K/sec ( +- 14.14% ) + 1,901.15 msec task-clock # 0.148 CPUs utilized ( +- 14.13% ) + 10,451 cs # 9.158 K/sec ( +- 14.14% )
- 13.656557 +- 0.000124 seconds time elapsed ( +- 0.00% )
+ 12.88080 +- 0.00404 seconds time elapsed ( +- 0.03% )
Performance counter stats for 'drmgr -c phb -r -s PHB 23' (5 runs):
- 1,473.75 msec task-clock # 0.092 CPUs utilized ( +- 14.15% ) - 2,652 cs # 3.000 K/sec ( +- 14.16% ) + 1,444.55 msec task-clock # 0.221 CPUs utilized ( +- 14.14% ) + 104 cs # 119.957 /sec ( +- 14.63% )
- 15.99718 +- 0.00801 seconds time elapsed ( +- 0.05% ) + 6.54256 +- 0.00830 seconds time elapsed ( +- 0.13% )
Move the existing rtas_lock-guarded critical section in sys_rtas() into a conventional rtas_busy_delay()-based loop, returning to user space only when a final success or failure result is available.
--- arch/powerpc/kernel/rtas.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-)
arch/powerpc/kernel/rtas.c +16 -12
@@ -1798,7 +1798,6 @@ static bool block_rtas_call(int token, int nargs,/* We assume to be passed big endian arguments */ SYSCALL_DEFINE1(rtas, struct rtas_args __user *, uargs) { -struct pin_cookie cookie;struct rtas_args args;unsigned long flags;char *buff_copy, *errbuf =NULL ;
@@ -1866,20 +1865,25 @@ SYSCALL_DEFINE1(rtas, struct rtas_args __user *, uargs) buff_copy =get_errorlog_buffer (); -raw_spin_lock_irqsave (&rtas_lock, flags); - cookie =lockdep_pin_lock (&rtas_lock); +do { +struct pin_cookie cookie; - rtas_args = args; -do_enter_rtas (&rtas_args); - args = rtas_args; +raw_spin_lock_irqsave (&rtas_lock, flags); + cookie =lockdep_pin_lock (&rtas_lock); -/* A -1 return code indicates that the last command couldn't -be completed due to a hardware error. */ -if (be32_to_cpu (args.rets[0 ]) ==-1 ) - errbuf =__fetch_rtas_last_error (buff_copy); + rtas_args = args; +do_enter_rtas (&rtas_args); + args = rtas_args; -lockdep_unpin_lock (&rtas_lock, cookie); -raw_spin_unlock_irqrestore (&rtas_lock, flags); +/* +* Handle error record retrieval before releasing the lock. +*/ +if (be32_to_cpu (args.rets[0 ]) ==-1 ) + errbuf =__fetch_rtas_last_error (buff_copy); + +lockdep_unpin_lock (&rtas_lock, cookie); +raw_spin_unlock_irqrestore (&rtas_lock, flags); + }while (rtas_busy_delay (be32_to_cpu (args.rets[0 ])));if (buff_copy) {if (errbuf)
Signature · 1 line
2.39.1
Re: [PATCH 8/8] powerpc/rtas: consume retry statuses in sys_rtas()
Quoted 25 lines · On Mon, 2023-03-06 at 15:33 -0600, Nathan Lynch via B4 Relay wrote:
From: Nathan Lynch <[email protected]>
The kernel can handle retrying RTAS function calls in response to -2/990x in the
sys_rtas()handler instead of relaying the intermediate
status to user space.Justifications:
* Currently it's nondeterministic and quite variable in practice whether a retry status is returned for any given invocation of
sys_rtas(). Therefore user space code cannot be expecting a retry result without already being broken.* This tends to significantly reduce the total number of system calls issued by programs such as drmgr which make use of
sys_rtas(), improving the experience of tracing and debugging such programs. This is the main motivation for me: I think this change will make it easier for us to characterize currentsys_rtas()use cases as we move them to other interfaces over time.* It reduces the number of opportunities for user space to leave complex operations, such as those associated with DLPAR, incomplete and diffcult to recover.
Quoted 6 lines
* We can expect performance improvements for existing
sys_rtas()users, not only because of overall reduction in the number of system
calls issued, but also due to the better handling of -2/990x in the kernel. For example, librtas still sleeps for 1ms on -2, which is completely unnecessary.
Would be good to see this fixed on the librtas side.
Quoted 34 lines
Performance differences for PHB add and remove on a small P10 PowerVM partition are included below. For add, elapsed time is slightly reduced. For remove, there are more significant improvements: the number of context switches is reduced by an order of magnitude, and elapsed time is reduced by over half.
(- before, + after):
Performance counter stats for 'drmgr -c phb -a -s PHB 23' (5 runs):
- 1,847.58 msec task-clock # 0.135 CPUs utilized ( +- 14.15% )
- 10,867 cs # 9.800 K/sec ( +- 14.14% )
+ 1,901.15 msec task-clock # 0.148 CPUs utilized ( +- 14.13% )
+ 10,451 cs # 9.158 K/sec ( +- 14.14% )- 13.656557 +- 0.000124 seconds time elapsed ( +- 0.00% ) + 12.88080 +- 0.00404 seconds time elapsed ( +- 0.03% )
Performance counter stats for 'drmgr -c phb -r -s PHB 23' (5 runs):
- 1,473.75 msec task-clock # 0.092 CPUs utilized ( +- 14.15% )
- 2,652 cs # 3.000 K/sec ( +- 14.16% )
+ 1,444.55 msec task-clock # 0.221 CPUs utilized ( +- 14.14% )
+ 104 cs # 119.957 /sec ( +- 14.63% )
Quoted 8 lines
- 15.99718 +- 0.00801 seconds time elapsed ( +- 0.05% ) + 6.54256 +- 0.00830 seconds time elapsed ( +- 0.13% )
Move the existing rtas_lock-guarded critical section in
sys_rtas()into a conventional rtas_busy_delay()-based loop, returning to user space only when a final success or failure result is available.Signed-off-by Nathan Lynch <[email protected]>
Should there be some kind of timeout? I'm a bit worried by sleeping in a syscall for an extended period.
Signature · 2 lines
Andrew Donnellan OzLabs, ADL Canberra [email protected] IBM Australia Limited
Re: [PATCH 8/8] powerpc/rtas: consume retry statuses in sys_rtas()
Quoted 9 lines · Andrew Donnellan
Quoted 6 lines · On Mon, 2023-03-06 at 15:33 -0600, Nathan Lynch via B4 Relay wrote:
* We can expect performance improvements for existing
sys_rtas()users, not only because of overall reduction in the number of system
calls issued, but also due to the better handling of -2/990x in the kernel. For example, librtas still sleeps for 1ms on -2, which is completely unnecessary.Would be good to see this fixed on the librtas side.
Filed an issue: https://github.com/ibm-power-utilities/librtas/issues/30
Michael Ellerman
reviewerRe: [PATCH 8/8] powerpc/rtas: consume retry statuses in sys_rtas()
In reply to Nathan LynchQuoted 5 lines · Nathan Lynch via B4 Relay <[email protected]> writes:
From: Nathan Lynch <[email protected]>
The kernel can handle retrying RTAS function calls in response to -2/990x in the
sys_rtas()handler instead of relaying the intermediate status to user space.
This looks good in general.
One query ...
Quoted 36 lines
arch/powerpc/kernel/rtas.c +7
-11@@ -1798,7 +1798,6 @@ static bool block_rtas_call(int token, int nargs,/* We assume to be passed big endian arguments */ SYSCALL_DEFINE1(rtas, struct rtas_args __user *, uargs) { -struct pin_cookie cookie;struct rtas_args args;unsigned long flags;char *buff_copy, *errbuf =NULL ;@@ -1866,20 +1865,25 @@ SYSCALL_DEFINE1(rtas, struct rtas_args __user *, uargs) buff_copy =get_errorlog_buffer (); -raw_spin_lock_irqsave (&rtas_lock, flags); - cookie =lockdep_pin_lock (&rtas_lock); + do { + struct pin_cookie cookie; - rtas_args = args; -do_enter_rtas (&rtas_args); - args = rtas_args; + raw_spin_lock_irqsave(&rtas_lock, flags); + cookie = lockdep_pin_lock(&rtas_lock); -/* A -1 return code indicates that the last command couldn't -be completed due to a hardware error. */ -if (be32_to_cpu (args.rets[0 ]) ==-1 ) - errbuf =__fetch_rtas_last_error (buff_copy); + rtas_args = args; + do_enter_rtas(&rtas_args); + args = rtas_args; -lockdep_unpin_lock (&rtas_lock, cookie);
arch/powerpc/kernel/rtas.c SYSCALL_DEFINE1(rtas, struct rtas_args __user *, uargs) · line 1886
Quoted 10 lines
arch/powerpc/kernel/rtas.c +9
-1-raw_spin_unlock_irqrestore (&rtas_lock, flags); +/* +* Handle error record retrieval before releasing the lock. +*/ +if (be32_to_cpu (args.rets[0 ]) ==-1 ) + errbuf =__fetch_rtas_last_error (buff_copy); + +lockdep_unpin_lock (&rtas_lock, cookie); +raw_spin_unlock_irqrestore (&rtas_lock, flags); + }while (rtas_busy_delay (be32_to_cpu (args.rets[0 ])));
rtas_busy_delay_early() has the successive_ext_delays case that will break out eventually. But if we keep getting plain RTAS_BUSY back from RTAS I *think* this loop will never terminate?
To avoid that, and just as good manners, I think we should have a fatal_signal_pending() check, and if that returns true we bail out of the syscall with -EINTR ?
cheers
Re: [PATCH 8/8] powerpc/rtas: consume retry statuses in sys_rtas()
Quoted 46 lines · Michael Ellerman
Quoted 5 lines · Nathan Lynch via B4 Relay <[email protected]> writes:
From: Nathan Lynch <[email protected]>
The kernel can handle retrying RTAS function calls in response to -2/990x in the
sys_rtas()handler instead of relaying the intermediate status to user space.This looks good in general.
One query ...
Quoted 35 lines
arch/powerpc/kernel/rtas.c +7
-10@@ -1798,7 +1798,6 @@ static bool block_rtas_call(int token, int nargs,/* We assume to be passed big endian arguments */ SYSCALL_DEFINE1(rtas, struct rtas_args __user *, uargs) { -struct pin_cookie cookie;struct rtas_args args;unsigned long flags;char *buff_copy, *errbuf =NULL ;@@ -1866,20 +1865,25 @@ SYSCALL_DEFINE1(rtas, struct rtas_args __user *, uargs) buff_copy =get_errorlog_buffer (); -raw_spin_lock_irqsave (&rtas_lock, flags); - cookie =lockdep_pin_lock (&rtas_lock); + do { + struct pin_cookie cookie; - rtas_args = args; -do_enter_rtas (&rtas_args); - args = rtas_args; + raw_spin_lock_irqsave(&rtas_lock, flags); + cookie = lockdep_pin_lock(&rtas_lock); -/* A -1 return code indicates that the last command couldn't -be completed due to a hardware error. */ -if (be32_to_cpu (args.rets[0 ]) ==-1 ) - errbuf =__fetch_rtas_last_error (buff_copy); + rtas_args = args; + do_enter_rtas(&rtas_args); + args = rtas_args;
Quoted 15 lines
arch/powerpc/kernel/rtas.c SYSCALL_DEFINE1(rtas, struct rtas_args __user *, uargs) · line 1886
Quoted 11 lines
arch/powerpc/kernel/rtas.c +9
-2-lockdep_unpin_lock (&rtas_lock, cookie); -raw_spin_unlock_irqrestore (&rtas_lock, flags); +/* +* Handle error record retrieval before releasing the lock. +*/ +if (be32_to_cpu (args.rets[0 ]) ==-1 ) + errbuf =__fetch_rtas_last_error (buff_copy); + +lockdep_unpin_lock (&rtas_lock, cookie); +raw_spin_unlock_irqrestore (&rtas_lock, flags); + }while (rtas_busy_delay (be32_to_cpu (args.rets[0 ])));
rtas_busy_delay_early()has thesuccessive_ext_delayscase that will break out eventually. But if we keep getting plainRTAS_BUSYback from RTAS I *think* this loop will never terminate?
Yes, but if this happens, then there is a serious bug in Linux or RTAS. The only time I've seen something like that on PowerVM is when Linux corrupted internal RTAS state by not serializing calls correctly.
rtas_busy_delay_early() has a bail-out heuristic, not for RTAS_BUSY, but for extended delay statuses (990x), which I suspect happen rarely (if ever) that early. That's there in order to allow boot to proceed and hopefully get useful messages out in a truly unexpected circumstance.
That said...
Quoted 3 lines
To avoid that, and just as good manners, I think we should have a
fatal_signal_pending()check, and if that returns true we bail out of the syscall with-EINTR?
That probably makes sense. In its current state, I could see this patch preventing or delaying OS shutdown in situations where it wouldn't have occurred before.
I think I would want the bailout condition in this case to be (fatal_signal_pending() && retries > some_threshold), to reduce the likelihood of non-"stuck" operations from being left unfinished. And it should dump a stack trace.
Re: [PATCH 8/8] powerpc/rtas: consume retry statuses in sys_rtas()
In reply to Nathan LynchHi Nathan,
Le 06/03/2023 à 22:33, Nathan Lynch via B4 Relay a écrit :
Quoted 5 lines
From: Nathan Lynch <[email protected]>
The kernel can handle retrying RTAS function calls in response to -2/990x in the
sys_rtas()handler instead of relaying the intermediate status to user space.
From this series with still have patches 5, 7 and 8 awaiting in
patchwork, see
https://patchwork.ozlabs.org/project/linuxppc-dev/list/?submitter=85747
and patch 8 doesn't apply anymore.
Are those 3 patches still relevant or should they be discarded ?
Thanks
Christophe
Quoted 112 lines
Justifications:
* Currently it's nondeterministic and quite variable in practice whether a retry status is returned for any given invocation of
sys_rtas(). Therefore user space code cannot be expecting a retry result without already being broken.* This tends to significantly reduce the total number of system calls issued by programs such as drmgr which make use of
sys_rtas(), improving the experience of tracing and debugging such programs. This is the main motivation for me: I think this change will make it easier for us to characterize currentsys_rtas()use cases as we move them to other interfaces over time.* It reduces the number of opportunities for user space to leave complex operations, such as those associated with DLPAR, incomplete and diffcult to recover.
* We can expect performance improvements for existing
sys_rtas()users, not only because of overall reduction in the number of system calls issued, but also due to the better handling of -2/990x in the kernel. For example, librtas still sleeps for 1ms on -2, which is completely unnecessary.Performance differences for PHB add and remove on a small P10 PowerVM partition are included below. For add, elapsed time is slightly reduced. For remove, there are more significant improvements: the number of context switches is reduced by an order of magnitude, and elapsed time is reduced by over half.
(- before, + after):
Performance counter stats for 'drmgr -c phb -a -s PHB 23' (5 runs):
(quoted diff) +6
-6- 1,847.58 msec task-clock # 0.135 CPUs utilized ( +- 14.15% ) - 10,867 cs # 9.800 K/sec ( +- 14.14% ) + 1,901.15 msec task-clock # 0.148 CPUs utilized ( +- 14.13% ) + 10,451 cs # 9.158 K/sec ( +- 14.14% ) - 13.656557 +- 0.000124 seconds time elapsed ( +- 0.00% ) + 12.88080 +- 0.00404 seconds time elapsed ( +- 0.03% ) Performance counter stats for 'drmgr -c phb -r -s PHB 23' (5 runs): - 1,473.75 msec task-clock # 0.092 CPUs utilized ( +- 14.15% ) - 2,652 cs # 3.000 K/sec ( +- 14.16% ) + 1,444.55 msec task-clock # 0.221 CPUs utilized ( +- 14.14% ) + 104 cs # 119.957 /sec ( +- 14.63% ) - 15.99718 +- 0.00801 seconds time elapsed ( +- 0.05% ) + 6.54256 +- 0.00830 seconds time elapsed ( +- 0.13% )Move the existing rtas_lock-guarded critical section in
sys_rtas()into a conventional rtas_busy_delay()-based loop, returning to user space only when a final success or failure result is available.Signed-off-by Nathan Lynch <[email protected]>--- arch/powerpc/kernel/rtas.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-)arch/powerpc/kernel/rtas.c +16
-12@@ -1798,7 +1798,6 @@ static bool block_rtas_call(int token, int nargs,/* We assume to be passed big endian arguments */ SYSCALL_DEFINE1(rtas, struct rtas_args __user *, uargs) { -struct pin_cookie cookie;struct rtas_args args;unsigned long flags;char *buff_copy, *errbuf =NULL ;@@ -1866,20 +1865,25 @@ SYSCALL_DEFINE1(rtas, struct rtas_args __user *, uargs) buff_copy =get_errorlog_buffer (); -raw_spin_lock_irqsave (&rtas_lock, flags); - cookie =lockdep_pin_lock (&rtas_lock); +do { +struct pin_cookie cookie; - rtas_args = args; -do_enter_rtas (&rtas_args); - args = rtas_args; +raw_spin_lock_irqsave (&rtas_lock, flags); + cookie =lockdep_pin_lock (&rtas_lock); -/* A -1 return code indicates that the last command couldn't -be completed due to a hardware error. */ -if (be32_to_cpu (args.rets[0 ]) ==-1 ) - errbuf =__fetch_rtas_last_error (buff_copy); + rtas_args = args; +do_enter_rtas (&rtas_args); + args = rtas_args; -lockdep_unpin_lock (&rtas_lock, cookie); -raw_spin_unlock_irqrestore (&rtas_lock, flags); +/* +* Handle error record retrieval before releasing the lock. +*/ +if (be32_to_cpu (args.rets[0 ]) ==-1 ) + errbuf =__fetch_rtas_last_error (buff_copy); + +lockdep_unpin_lock (&rtas_lock, cookie); +raw_spin_unlock_irqrestore (&rtas_lock, flags); + }while (rtas_busy_delay (be32_to_cpu (args.rets[0 ])));if (buff_copy) {if (errbuf)
Re: [PATCH 8/8] powerpc/rtas: consume retry statuses in sys_rtas()
Quoted 9 lines · Christophe Leroy
Hi Nathan,
Le 06/03/2023 à 22:33, Nathan Lynch via B4 Relay a écrit :
Quoted 5 lines
From: Nathan Lynch <[email protected]>
The kernel can handle retrying RTAS function calls in response to -2/990x in the
sys_rtas()handler instead of relaying the intermediate status to user space.
Quoted 6 lines
From this series with still have patches 5, 7 and 8 awaiting in
patchwork, see
https://patchwork.ozlabs.org/project/linuxppc-dev/list/?submitter=85747
and patch 8 doesn't apply anymore.Are those 3 patches still relevant or should they be discarded ?
Thanks for checking - 5 and 7 can be discarded.
I intend to return to 8/8 ("consume retry statuses...") when time allows. So that could be put in "changes requested" state I suppose, but if it's easier on the maintainer side to discard it that's fine with me too.
Re: [PATCH 8/8] powerpc/rtas: consume retry statuses in sys_rtas()
Le 25/01/2024 à 17:33, Nathan Lynch a écrit :
Quoted 15 lines
Quoted 14 lines · Christophe Leroy
Hi Nathan,
Le 06/03/2023 à 22:33, Nathan Lynch via B4 Relay a écrit :
Quoted 5 lines
From: Nathan Lynch <[email protected]>
The kernel can handle retrying RTAS function calls in response to -2/990x in the
sys_rtas()handler instead of relaying the intermediate status to user space.From this series with still have patches 5, 7 and 8 awaiting in
patchwork, see
https://patchwork.ozlabs.org/project/linuxppc-dev/list/?submitter=85747
and patch 8 doesn't apply anymore.
Quoted 8 lines
Quoted 1 line
Are those 3 patches still relevant or should they be discarded ?
Thanks for checking - 5 and 7 can be discarded.
I intend to return to 8/8 ("consume retry statuses...") when time allows. So that could be put in "changes requested" state I suppose, but if it's easier on the maintainer side to discard it that's fine with me too.
Ok, thanks for answering, I rejected 5 and 7 and requested changes to 8.
While at it, what about patch 2 of series
https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=382195&state=*
Christophe
Re: [PATCH 8/8] powerpc/rtas: consume retry statuses in sys_rtas()
Quoted 25 lines · Christophe Leroy
Le 25/01/2024 à 17:33, Nathan Lynch a écrit :
Quoted 15 lines
Quoted 14 lines · Christophe Leroy
Hi Nathan,
Le 06/03/2023 à 22:33, Nathan Lynch via B4 Relay a écrit :
Quoted 5 lines
From: Nathan Lynch <[email protected]>
The kernel can handle retrying RTAS function calls in response to -2/990x in the
sys_rtas()handler instead of relaying the intermediate status to user space.From this series with still have patches 5, 7 and 8 awaiting in
patchwork, see
https://patchwork.ozlabs.org/project/linuxppc-dev/list/?submitter=85747
and patch 8 doesn't apply anymore.Quoted 8 lines
Quoted 1 line
Are those 3 patches still relevant or should they be discarded ?
Thanks for checking - 5 and 7 can be discarded.
I intend to return to 8/8 ("consume retry statuses...") when time allows. So that could be put in "changes requested" state I suppose, but if it's easier on the maintainer side to discard it that's fine with me too.
Quoted 4 lines
Ok, thanks for answering, I rejected 5 and 7 and requested changes to 8.
While at it, what about patch 2 of series
https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=382195&state=*
Drop it, thanks.
Michael Ellerman
AppliedRe: (subset) [PATCH 0/8] RTAS changes for 6.4
In reply to Nathan LynchQuoted 11 lines · Nathan Lynch
Proposed changes for the RTAS subsystem and client code.
Fixes that are subject to backporting are at the front of the queue, followed by documentation and cleanups, with enhancements at the end.
Noteworthy changes:
* Changesys_rtas()to consume -2/990x statuses instead of returning them to user space.
* Lockdep annotations for invariants inrtas.c.[...]
Applied to powerpc/next.
[6/8] powerpc/rtas: lockdep annotations
https://git.kernel.org/powerpc/c/af8bc68263b2184e63ee67ca70cecff4636f7901
cheers
Quoted 11 lines · Nathan Lynch
Proposed changes for the RTAS subsystem and client code.
Fixes that are subject to backporting are at the front of the queue, followed by documentation and cleanups, with enhancements at the end.
Noteworthy changes:
* Changesys_rtas()to consume -2/990x statuses instead of returning them to user space.
* Lockdep annotations for invariants inrtas.c.[...]
Patches 1-4, 6 applied to powerpc/next.
[1/8] powerpc/rtas: ensure 8-byte alignment for struct rtas_args
https://git.kernel.org/powerpc/c/f40b0f6c5c27de167fdd10e541e0a4b5f2bc772b [2/8] powerpc/rtas: use memmove for potentially overlapping buffer copy https://git.kernel.org/powerpc/c/271208ee5e335cb1ad280d22784940daf7ddf820 [3/8] powerpc/rtas: rtas_call_unlocked() kerneldoc https://git.kernel.org/powerpc/c/1792e46ed0cfc1fa27c8c805f8098f806bcc5fc3 [4/8] powerpc/rtas: fix miswording in rtas_function kerneldoc https://git.kernel.org/powerpc/c/32740fce09f98d30f3c71a09ee4e9d90b3965427 [6/8] powerpc/rtas: lockdep annotations https://git.kernel.org/powerpc/c/af8bc68263b2184e63ee67ca70cecff4636f7901
cheers