Re: [PATCH] powerpc/vas: Limit open window failure messages in log bufffer

2023-10-18 Thread Michael Ellerman
Haren Myneni  writes:
> The VAS open window call prints error message and returns -EBUSY
> after the migration suspend event initiated and until the resume
> event completed on the destination system. It can cause the log
> buffer filled with these error messages if the user space issues
> continuous open window calls.  Similar case even for DLPAR CPU
> remove event when no credits are available until the credits are
> freed or with the other DLPAR CPU add event.

This should probably have a Fixes: tag so it gets backported.

> So changes in the patch to use pr_err_ratelimited() instead of
> pr_err() to display open window failure and not-available credits
> error messages.
>
> Signed-off-by: Haren Myneni 
> ---
>  arch/powerpc/platforms/book3s/vas-api.c | 4 ++--
>  arch/powerpc/platforms/pseries/vas.c| 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/platforms/book3s/vas-api.c 
> b/arch/powerpc/platforms/book3s/vas-api.c
> index 77ea9335fd04..203cfc2fb8ff 100644
> --- a/arch/powerpc/platforms/book3s/vas-api.c
> +++ b/arch/powerpc/platforms/book3s/vas-api.c
> @@ -311,8 +311,8 @@ static int coproc_ioc_tx_win_open(struct file *fp, 
> unsigned long arg)
>   txwin = cp_inst->coproc->vops->open_win(uattr.vas_id, uattr.flags,
>   cp_inst->coproc->cop_type);
>   if (IS_ERR(txwin)) {
> - pr_err("%s() VAS window open failed, %ld\n", __func__,
> - PTR_ERR(txwin));
> + pr_err_ratelimited("%s() VAS window open failed, %ld\n",
> + __func__, PTR_ERR(txwin));

Rather than using __func__ which is a bit over specific for a user
visible error, I'd prefer something like "vas: window open failed rc = %ld".

Probably vas-api.c should use pr_fmt so that all the messages have a
consistent prefix.

cheers

>   return PTR_ERR(txwin);
>   }
>  
> diff --git a/arch/powerpc/platforms/pseries/vas.c 
> b/arch/powerpc/platforms/pseries/vas.c
> index b86f0db08e98..7259e6676503 100644
> --- a/arch/powerpc/platforms/pseries/vas.c
> +++ b/arch/powerpc/platforms/pseries/vas.c
> @@ -341,7 +341,7 @@ static struct vas_window *vas_allocate_window(int vas_id, 
> u64 flags,
>  
>   if (atomic_inc_return(_feat_caps->nr_used_credits) >
>   atomic_read(_feat_caps->nr_total_credits)) {
> - pr_err("Credits are not available to allocate window\n");
> + pr_err_ratelimited("Credits are not available to allocate 
> window\n");
>   rc = -EINVAL;
>   goto out;
>   }
> @@ -439,7 +439,7 @@ static struct vas_window *vas_allocate_window(int vas_id, 
> u64 flags,
>  
>   put_vas_user_win_ref(>vas_win.task_ref);
>   rc = -EBUSY;
> - pr_err("No credit is available to allocate window\n");
> + pr_err_ratelimited("No credit is available to allocate window\n");
>  
>  out_free:
>   /*
> -- 
> 2.26.3


[PATCH] powerpc/vas: Limit open window failure messages in log bufffer

2023-10-17 Thread Haren Myneni
The VAS open window call prints error message and returns -EBUSY
after the migration suspend event initiated and until the resume
event completed on the destination system. It can cause the log
buffer filled with these error messages if the user space issues
continuous open window calls.  Similar case even for DLPAR CPU
remove event when no credits are available until the credits are
freed or with the other DLPAR CPU add event.

So changes in the patch to use pr_err_ratelimited() instead of
pr_err() to display open window failure and not-available credits
error messages.

Signed-off-by: Haren Myneni 
---
 arch/powerpc/platforms/book3s/vas-api.c | 4 ++--
 arch/powerpc/platforms/pseries/vas.c| 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/book3s/vas-api.c 
b/arch/powerpc/platforms/book3s/vas-api.c
index 77ea9335fd04..203cfc2fb8ff 100644
--- a/arch/powerpc/platforms/book3s/vas-api.c
+++ b/arch/powerpc/platforms/book3s/vas-api.c
@@ -311,8 +311,8 @@ static int coproc_ioc_tx_win_open(struct file *fp, unsigned 
long arg)
txwin = cp_inst->coproc->vops->open_win(uattr.vas_id, uattr.flags,
cp_inst->coproc->cop_type);
if (IS_ERR(txwin)) {
-   pr_err("%s() VAS window open failed, %ld\n", __func__,
-   PTR_ERR(txwin));
+   pr_err_ratelimited("%s() VAS window open failed, %ld\n",
+   __func__, PTR_ERR(txwin));
return PTR_ERR(txwin);
}
 
diff --git a/arch/powerpc/platforms/pseries/vas.c 
b/arch/powerpc/platforms/pseries/vas.c
index b86f0db08e98..7259e6676503 100644
--- a/arch/powerpc/platforms/pseries/vas.c
+++ b/arch/powerpc/platforms/pseries/vas.c
@@ -341,7 +341,7 @@ static struct vas_window *vas_allocate_window(int vas_id, 
u64 flags,
 
if (atomic_inc_return(_feat_caps->nr_used_credits) >
atomic_read(_feat_caps->nr_total_credits)) {
-   pr_err("Credits are not available to allocate window\n");
+   pr_err_ratelimited("Credits are not available to allocate 
window\n");
rc = -EINVAL;
goto out;
}
@@ -439,7 +439,7 @@ static struct vas_window *vas_allocate_window(int vas_id, 
u64 flags,
 
put_vas_user_win_ref(>vas_win.task_ref);
rc = -EBUSY;
-   pr_err("No credit is available to allocate window\n");
+   pr_err_ratelimited("No credit is available to allocate window\n");
 
 out_free:
/*
-- 
2.26.3