Skip to content

Commit 73b2550

Browse files
hmynenimpe
authored andcommitted
powerpc/vas: Limit open window failure messages in log bufffer
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. Use pr_fmt() and make the corresponding changes to have the consistencein prefix all pr_*() messages (vas-api.c). Fixes: 37e6764 ("powerpc/pseries/vas: Add VAS migration handler") Signed-off-by: Haren Myneni <[email protected]> [mpe: Use "vas-api" as the prefix to match the file name.] Signed-off-by: Michael Ellerman <[email protected]> Link: https://msgid.link/[email protected]
1 parent 3bf983e commit 73b2550

File tree

2 files changed

+18
-20
lines changed

2 files changed

+18
-20
lines changed

arch/powerpc/platforms/book3s/vas-api.c

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* Copyright (C) 2019 Haren Myneni, IBM Corp
55
*/
66

7+
#define pr_fmt(fmt) "vas-api: " fmt
8+
79
#include <linux/kernel.h>
810
#include <linux/device.h>
911
#include <linux/cdev.h>
@@ -78,7 +80,7 @@ int get_vas_user_win_ref(struct vas_user_win_ref *task_ref)
7880
task_ref->mm = get_task_mm(current);
7981
if (!task_ref->mm) {
8082
put_pid(task_ref->pid);
81-
pr_err("VAS: pid(%d): mm_struct is not found\n",
83+
pr_err("pid(%d): mm_struct is not found\n",
8284
current->pid);
8385
return -EPERM;
8486
}
@@ -235,8 +237,7 @@ void vas_update_csb(struct coprocessor_request_block *crb,
235237
rc = kill_pid_info(SIGSEGV, &info, pid);
236238
rcu_read_unlock();
237239

238-
pr_devel("%s(): pid %d kill_proc_info() rc %d\n", __func__,
239-
pid_vnr(pid), rc);
240+
pr_devel("pid %d kill_proc_info() rc %d\n", pid_vnr(pid), rc);
240241
}
241242

242243
void vas_dump_crb(struct coprocessor_request_block *crb)
@@ -294,7 +295,7 @@ static int coproc_ioc_tx_win_open(struct file *fp, unsigned long arg)
294295

295296
rc = copy_from_user(&uattr, uptr, sizeof(uattr));
296297
if (rc) {
297-
pr_err("%s(): copy_from_user() returns %d\n", __func__, rc);
298+
pr_err("copy_from_user() returns %d\n", rc);
298299
return -EFAULT;
299300
}
300301

@@ -311,7 +312,7 @@ static int coproc_ioc_tx_win_open(struct file *fp, unsigned long arg)
311312
txwin = cp_inst->coproc->vops->open_win(uattr.vas_id, uattr.flags,
312313
cp_inst->coproc->cop_type);
313314
if (IS_ERR(txwin)) {
314-
pr_err("%s() VAS window open failed, %ld\n", __func__,
315+
pr_err_ratelimited("VAS window open failed rc=%ld\n",
315316
PTR_ERR(txwin));
316317
return PTR_ERR(txwin);
317318
}
@@ -405,8 +406,7 @@ static vm_fault_t vas_mmap_fault(struct vm_fault *vmf)
405406
* window is not opened. Shouldn't expect this error.
406407
*/
407408
if (!cp_inst || !cp_inst->txwin) {
408-
pr_err("%s(): Unexpected fault on paste address with TX window closed\n",
409-
__func__);
409+
pr_err("Unexpected fault on paste address with TX window closed\n");
410410
return VM_FAULT_SIGBUS;
411411
}
412412

@@ -421,8 +421,7 @@ static vm_fault_t vas_mmap_fault(struct vm_fault *vmf)
421421
* issue NX request.
422422
*/
423423
if (txwin->task_ref.vma != vmf->vma) {
424-
pr_err("%s(): No previous mapping with paste address\n",
425-
__func__);
424+
pr_err("No previous mapping with paste address\n");
426425
return VM_FAULT_SIGBUS;
427426
}
428427

@@ -481,19 +480,19 @@ static int coproc_mmap(struct file *fp, struct vm_area_struct *vma)
481480
txwin = cp_inst->txwin;
482481

483482
if ((vma->vm_end - vma->vm_start) > PAGE_SIZE) {
484-
pr_debug("%s(): size 0x%zx, PAGE_SIZE 0x%zx\n", __func__,
483+
pr_debug("size 0x%zx, PAGE_SIZE 0x%zx\n",
485484
(vma->vm_end - vma->vm_start), PAGE_SIZE);
486485
return -EINVAL;
487486
}
488487

489488
/* Ensure instance has an open send window */
490489
if (!txwin) {
491-
pr_err("%s(): No send window open?\n", __func__);
490+
pr_err("No send window open?\n");
492491
return -EINVAL;
493492
}
494493

495494
if (!cp_inst->coproc->vops || !cp_inst->coproc->vops->paste_addr) {
496-
pr_err("%s(): VAS API is not registered\n", __func__);
495+
pr_err("VAS API is not registered\n");
497496
return -EACCES;
498497
}
499498

@@ -510,14 +509,14 @@ static int coproc_mmap(struct file *fp, struct vm_area_struct *vma)
510509
*/
511510
mutex_lock(&txwin->task_ref.mmap_mutex);
512511
if (txwin->status != VAS_WIN_ACTIVE) {
513-
pr_err("%s(): Window is not active\n", __func__);
512+
pr_err("Window is not active\n");
514513
rc = -EACCES;
515514
goto out;
516515
}
517516

518517
paste_addr = cp_inst->coproc->vops->paste_addr(txwin);
519518
if (!paste_addr) {
520-
pr_err("%s(): Window paste address failed\n", __func__);
519+
pr_err("Window paste address failed\n");
521520
rc = -EINVAL;
522521
goto out;
523522
}
@@ -533,8 +532,8 @@ static int coproc_mmap(struct file *fp, struct vm_area_struct *vma)
533532
rc = remap_pfn_range(vma, vma->vm_start, pfn + vma->vm_pgoff,
534533
vma->vm_end - vma->vm_start, prot);
535534

536-
pr_devel("%s(): paste addr %llx at %lx, rc %d\n", __func__,
537-
paste_addr, vma->vm_start, rc);
535+
pr_devel("paste addr %llx at %lx, rc %d\n", paste_addr,
536+
vma->vm_start, rc);
538537

539538
txwin->task_ref.vma = vma;
540539
vma->vm_ops = &vas_vm_ops;
@@ -609,8 +608,7 @@ int vas_register_coproc_api(struct module *mod, enum vas_cop_type cop_type,
609608
goto err;
610609
}
611610

612-
pr_devel("%s: Added dev [%d,%d]\n", __func__, MAJOR(devno),
613-
MINOR(devno));
611+
pr_devel("Added dev [%d,%d]\n", MAJOR(devno), MINOR(devno));
614612

615613
return 0;
616614

arch/powerpc/platforms/pseries/vas.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ static struct vas_window *vas_allocate_window(int vas_id, u64 flags,
341341

342342
if (atomic_inc_return(&cop_feat_caps->nr_used_credits) >
343343
atomic_read(&cop_feat_caps->nr_total_credits)) {
344-
pr_err("Credits are not available to allocate window\n");
344+
pr_err_ratelimited("Credits are not available to allocate window\n");
345345
rc = -EINVAL;
346346
goto out;
347347
}
@@ -424,7 +424,7 @@ static struct vas_window *vas_allocate_window(int vas_id, u64 flags,
424424

425425
put_vas_user_win_ref(&txwin->vas_win.task_ref);
426426
rc = -EBUSY;
427-
pr_err("No credit is available to allocate window\n");
427+
pr_err_ratelimited("No credit is available to allocate window\n");
428428

429429
out_free:
430430
/*

0 commit comments

Comments
 (0)