* [PATCH RESEND 1/4] powerpc/vas: Fix order of cleanup in debugfs dir @ 2018-02-10 3:49 Sukadev Bhattiprolu 2018-02-10 3:49 ` [PATCH 2/4] powerpc/vas: Fix cleanup when VAS is not configured Sukadev Bhattiprolu ` (2 more replies) 0 siblings, 3 replies; 8+ messages in thread From: Sukadev Bhattiprolu @ 2018-02-10 3:49 UTC (permalink / raw) To: Michael Ellerman Cc: Benjamin Herrenschmidt, mikey, hbabu, linuxppc-dev, linux-kernel Fix the order of cleanup to ensure we free the name buffer in case of an error creating 'hvwc' or 'info' files. Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> --- arch/powerpc/platforms/powernv/vas-debug.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/platforms/powernv/vas-debug.c b/arch/powerpc/platforms/powernv/vas-debug.c index ca22f1e..b4de4c6 100644 --- a/arch/powerpc/platforms/powernv/vas-debug.c +++ b/arch/powerpc/platforms/powernv/vas-debug.c @@ -166,13 +166,13 @@ void vas_window_init_dbgdir(struct vas_window *window) return; -free_name: - kfree(window->dbgname); - window->dbgname = NULL; - remove_dir: debugfs_remove_recursive(window->dbgdir); window->dbgdir = NULL; + +free_name: + kfree(window->dbgname); + window->dbgname = NULL; } void vas_instance_init_dbgdir(struct vas_instance *vinst) -- 2.7.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/4] powerpc/vas: Fix cleanup when VAS is not configured 2018-02-10 3:49 [PATCH RESEND 1/4] powerpc/vas: Fix order of cleanup in debugfs dir Sukadev Bhattiprolu @ 2018-02-10 3:49 ` Sukadev Bhattiprolu 2018-02-12 5:23 ` Michael Ellerman 2018-02-10 3:49 ` [PATCH RESEND 3/4] powerpc/vas: Remove a stray line in Makefile Sukadev Bhattiprolu 2018-02-10 3:49 ` [PATCH 4/4] powerpc/vas: Add a couple of trace points Sukadev Bhattiprolu 2 siblings, 1 reply; 8+ messages in thread From: Sukadev Bhattiprolu @ 2018-02-10 3:49 UTC (permalink / raw) To: Michael Ellerman Cc: Benjamin Herrenschmidt, mikey, hbabu, linuxppc-dev, linux-kernel When VAS is not configured in the system, make sure to remove the VAS debugfs directory and unregister the platform driver. Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> --- arch/powerpc/platforms/powernv/vas-debug.c | 5 +++++ arch/powerpc/platforms/powernv/vas.c | 5 ++++- arch/powerpc/platforms/powernv/vas.h | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/powernv/vas-debug.c b/arch/powerpc/platforms/powernv/vas-debug.c index b4de4c6..e6e4067 100644 --- a/arch/powerpc/platforms/powernv/vas-debug.c +++ b/arch/powerpc/platforms/powernv/vas-debug.c @@ -207,3 +207,8 @@ void vas_init_dbgdir(void) if (IS_ERR(vas_debugfs)) vas_debugfs = NULL; } + +void vas_cleanup_dbgdir(void) +{ + debugfs_remove_recursive(vas_debugfs); +} diff --git a/arch/powerpc/platforms/powernv/vas.c b/arch/powerpc/platforms/powernv/vas.c index aebbe95..f83e27d8 100644 --- a/arch/powerpc/platforms/powernv/vas.c +++ b/arch/powerpc/platforms/powernv/vas.c @@ -169,8 +169,11 @@ static int __init vas_init(void) found++; } - if (!found) + if (!found) { + platform_driver_unregister(&vas_driver); + vas_cleanup_dbgdir(); return -ENODEV; + } pr_devel("Found %d instances\n", found); diff --git a/arch/powerpc/platforms/powernv/vas.h b/arch/powerpc/platforms/powernv/vas.h index ae0100f..2645613 100644 --- a/arch/powerpc/platforms/powernv/vas.h +++ b/arch/powerpc/platforms/powernv/vas.h @@ -406,6 +406,7 @@ extern struct mutex vas_mutex; extern struct vas_instance *find_vas_instance(int vasid); extern void vas_init_dbgdir(void); +extern void vas_cleanup_dbgdir(void); extern void vas_instance_init_dbgdir(struct vas_instance *vinst); extern void vas_window_init_dbgdir(struct vas_window *win); extern void vas_window_free_dbgdir(struct vas_window *win); -- 2.7.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/4] powerpc/vas: Fix cleanup when VAS is not configured 2018-02-10 3:49 ` [PATCH 2/4] powerpc/vas: Fix cleanup when VAS is not configured Sukadev Bhattiprolu @ 2018-02-12 5:23 ` Michael Ellerman 2018-02-12 20:25 ` Sukadev Bhattiprolu 0 siblings, 1 reply; 8+ messages in thread From: Michael Ellerman @ 2018-02-12 5:23 UTC (permalink / raw) To: Sukadev Bhattiprolu Cc: Benjamin Herrenschmidt, mikey, hbabu, linuxppc-dev, linux-kernel Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> writes: > When VAS is not configured in the system, make sure to remove > the VAS debugfs directory and unregister the platform driver. > > Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> ... > diff --git a/arch/powerpc/platforms/powernv/vas.c b/arch/powerpc/platforms/powernv/vas.c > index aebbe95..f83e27d8 100644 > --- a/arch/powerpc/platforms/powernv/vas.c > +++ b/arch/powerpc/platforms/powernv/vas.c > @@ -169,8 +169,11 @@ static int __init vas_init(void) > found++; > } > > - if (!found) > + if (!found) { > + platform_driver_unregister(&vas_driver); > + vas_cleanup_dbgdir(); > return -ENODEV; > + } The better patch would be to move the call to vas_init_dbgdir() down here, where we know we have successfully registered the driver. cheers ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/4] powerpc/vas: Fix cleanup when VAS is not configured 2018-02-12 5:23 ` Michael Ellerman @ 2018-02-12 20:25 ` Sukadev Bhattiprolu 2018-02-13 3:17 ` Michael Ellerman 0 siblings, 1 reply; 8+ messages in thread From: Sukadev Bhattiprolu @ 2018-02-12 20:25 UTC (permalink / raw) To: Michael Ellerman Cc: Benjamin Herrenschmidt, mikey, hbabu, linuxppc-dev, linux-kernel Michael Ellerman [mpe@ellerman.id.au] wrote: > Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> writes: > > > When VAS is not configured in the system, make sure to remove > > the VAS debugfs directory and unregister the platform driver. > > > > Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> > ... > > diff --git a/arch/powerpc/platforms/powernv/vas.c b/arch/powerpc/platforms/powernv/vas.c > > index aebbe95..f83e27d8 100644 > > --- a/arch/powerpc/platforms/powernv/vas.c > > +++ b/arch/powerpc/platforms/powernv/vas.c > > @@ -169,8 +169,11 @@ static int __init vas_init(void) > > found++; > > } > > > > - if (!found) > > + if (!found) { > > + platform_driver_unregister(&vas_driver); > > + vas_cleanup_dbgdir(); > > return -ENODEV; > > + } > > The better patch would be to move the call to vas_init_dbgdir() down > here, where we know we have successfully registered the driver. Well, when VAS is configured, init_vas_instance() expects the top level "vas" debugfs dir to already be setup. We could have each init_vas_instance() assume it is the first and unconditionally call vas_init_dbgdir(). vas_init_dbgdir() could make sure to initialize only once. Or, we could make a separate pass countng "ibm,vas" nodes. If there are none, skip both steps (dbgdir and registering platform driver). Sukadev ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/4] powerpc/vas: Fix cleanup when VAS is not configured 2018-02-12 20:25 ` Sukadev Bhattiprolu @ 2018-02-13 3:17 ` Michael Ellerman 0 siblings, 0 replies; 8+ messages in thread From: Michael Ellerman @ 2018-02-13 3:17 UTC (permalink / raw) To: Sukadev Bhattiprolu Cc: Benjamin Herrenschmidt, mikey, hbabu, linuxppc-dev, linux-kernel Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> writes: > Michael Ellerman [mpe@ellerman.id.au] wrote: >> Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> writes: >> >> > When VAS is not configured in the system, make sure to remove >> > the VAS debugfs directory and unregister the platform driver. >> > >> > Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> >> ... >> > diff --git a/arch/powerpc/platforms/powernv/vas.c b/arch/powerpc/platforms/powernv/vas.c >> > index aebbe95..f83e27d8 100644 >> > --- a/arch/powerpc/platforms/powernv/vas.c >> > +++ b/arch/powerpc/platforms/powernv/vas.c >> > @@ -169,8 +169,11 @@ static int __init vas_init(void) >> > found++; >> > } >> > >> > - if (!found) >> > + if (!found) { >> > + platform_driver_unregister(&vas_driver); >> > + vas_cleanup_dbgdir(); >> > return -ENODEV; >> > + } >> >> The better patch would be to move the call to vas_init_dbgdir() down >> here, where we know we have successfully registered the driver. > > Well, when VAS is configured, init_vas_instance() expects the top level > "vas" debugfs dir to already be setup. OK. > We could have each init_vas_instance() assume it is the first and > unconditionally call vas_init_dbgdir(). vas_init_dbgdir() could make > sure to initialize only once. Yeah that looks like a good solution. cheers ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH RESEND 3/4] powerpc/vas: Remove a stray line in Makefile 2018-02-10 3:49 [PATCH RESEND 1/4] powerpc/vas: Fix order of cleanup in debugfs dir Sukadev Bhattiprolu 2018-02-10 3:49 ` [PATCH 2/4] powerpc/vas: Fix cleanup when VAS is not configured Sukadev Bhattiprolu @ 2018-02-10 3:49 ` Sukadev Bhattiprolu 2018-02-10 3:49 ` [PATCH 4/4] powerpc/vas: Add a couple of trace points Sukadev Bhattiprolu 2 siblings, 0 replies; 8+ messages in thread From: Sukadev Bhattiprolu @ 2018-02-10 3:49 UTC (permalink / raw) To: Michael Ellerman Cc: Benjamin Herrenschmidt, mikey, hbabu, linuxppc-dev, linux-kernel Remove a bogus line from arch/powerpc/platforms/powernv/Makefile that was added by commit ece4e51 ("powerpc/vas: Export HVWC to debugfs"). Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> --- arch/powerpc/platforms/powernv/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/powerpc/platforms/powernv/Makefile b/arch/powerpc/platforms/powernv/Makefile index 6c9d519..703a350 100644 --- a/arch/powerpc/platforms/powernv/Makefile +++ b/arch/powerpc/platforms/powernv/Makefile @@ -16,5 +16,4 @@ obj-$(CONFIG_OPAL_PRD) += opal-prd.o obj-$(CONFIG_PERF_EVENTS) += opal-imc.o obj-$(CONFIG_PPC_MEMTRACE) += memtrace.o obj-$(CONFIG_PPC_VAS) += vas.o vas-window.o vas-debug.o -obj-$(CONFIG_PPC_FTW) += nx-ftw.o obj-$(CONFIG_OCXL_BASE) += ocxl.o -- 2.7.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/4] powerpc/vas: Add a couple of trace points 2018-02-10 3:49 [PATCH RESEND 1/4] powerpc/vas: Fix order of cleanup in debugfs dir Sukadev Bhattiprolu 2018-02-10 3:49 ` [PATCH 2/4] powerpc/vas: Fix cleanup when VAS is not configured Sukadev Bhattiprolu 2018-02-10 3:49 ` [PATCH RESEND 3/4] powerpc/vas: Remove a stray line in Makefile Sukadev Bhattiprolu @ 2018-02-10 3:49 ` Sukadev Bhattiprolu 2018-03-19 22:22 ` [4/4] " Michael Ellerman 2 siblings, 1 reply; 8+ messages in thread From: Sukadev Bhattiprolu @ 2018-02-10 3:49 UTC (permalink / raw) To: Michael Ellerman Cc: Benjamin Herrenschmidt, mikey, hbabu, linuxppc-dev, linux-kernel Add a couple of trace points in the VAS driver Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> --- Changelog [v2] - Make TRACE_INCLUDE_PATH relative to <trace/define_trace.h> --- arch/powerpc/platforms/powernv/vas-trace.h | 112 ++++++++++++++++++++++++++++ arch/powerpc/platforms/powernv/vas-window.c | 9 +++ 2 files changed, 121 insertions(+) create mode 100644 arch/powerpc/platforms/powernv/vas-trace.h diff --git a/arch/powerpc/platforms/powernv/vas-trace.h b/arch/powerpc/platforms/powernv/vas-trace.h new file mode 100644 index 0000000..939d85d --- /dev/null +++ b/arch/powerpc/platforms/powernv/vas-trace.h @@ -0,0 +1,112 @@ + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM vas + +#if !defined(_VAS_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) + +#define _VAS_TRACE_H +#include <linux/tracepoint.h> +#include <linux/sched.h> +#include <asm/vas.h> + +TRACE_EVENT( vas_rx_win_open, + + TP_PROTO(struct task_struct *tsk, + int vasid, + int cop, + struct vas_rx_win_attr *rxattr), + + TP_ARGS(tsk, vasid, cop, rxattr), + + TP_STRUCT__entry( + __field(struct task_struct *, tsk) + __field(int, pid) + __field(int, cop) + __field(int, vasid) + __field(struct vas_rx_win_attr *, rxattr) + __field(int, lnotify_lpid) + __field(int, lnotify_pid) + __field(int, lnotify_tid) + ), + + TP_fast_assign( + __entry->pid = tsk->pid; + __entry->vasid = vasid; + __entry->cop = cop; + __entry->lnotify_lpid = rxattr->lnotify_lpid; + __entry->lnotify_pid = rxattr->lnotify_pid; + __entry->lnotify_tid = rxattr->lnotify_tid; + ), + + TP_printk("pid=%d, vasid=%d, cop=%d, lpid=%d, pid=%d, tid=%d", + __entry->pid, __entry->vasid, __entry->cop, + __entry->lnotify_lpid, __entry->lnotify_pid, + __entry->lnotify_tid) +); + +TRACE_EVENT( vas_tx_win_open, + + TP_PROTO(struct task_struct *tsk, + int vasid, + int cop, + struct vas_tx_win_attr *txattr), + + TP_ARGS(tsk, vasid, cop, txattr), + + TP_STRUCT__entry( + __field(struct task_struct *, tsk) + __field(int, pid) + __field(int, cop) + __field(int, vasid) + __field(struct vas_tx_win_attr *, txattr) + __field(int, lpid) + __field(int, pidr) + ), + + TP_fast_assign( + __entry->pid = tsk->pid; + __entry->vasid = vasid; + __entry->cop = cop; + __entry->lpid = txattr->lpid; + __entry->pidr = txattr->pidr; + ), + + TP_printk("pid=%d, vasid=%d, cop=%d, lpid=%d, pidr=%d", + __entry->pid, __entry->vasid, __entry->cop, + __entry->lpid, __entry->pidr) +); + +TRACE_EVENT( vas_paste_crb, + + TP_PROTO(struct task_struct *tsk, + struct vas_window *win), + + TP_ARGS(tsk, win), + + TP_STRUCT__entry( + __field(struct task_struct *, tsk) + __field(struct vas_window *, win) + __field(int, pid) + __field(int, vasid) + __field(int, winid) + __field(unsigned long, paste_kaddr) + ), + + TP_fast_assign( + __entry->pid = tsk->pid; + __entry->vasid = win->vinst->vas_id; + __entry->winid = win->winid; + __entry->paste_kaddr = (unsigned long)win->paste_kaddr + ), + + TP_printk("pid=%d, vasid=%d, winid=%d, paste_kaddr=0x%016lx\n", + __entry->pid, __entry->vasid, __entry->winid, + __entry->paste_kaddr) +); + +#endif /* _VAS_TRACE_H */ + +#undef TRACE_INCLUDE_PATH +#define TRACE_INCLUDE_PATH ../../arch/powerpc/platforms/powernv +#define TRACE_INCLUDE_FILE vas-trace +#include <trace/define_trace.h> diff --git a/arch/powerpc/platforms/powernv/vas-window.c b/arch/powerpc/platforms/powernv/vas-window.c index 2b3eb01..6b2de9e 100644 --- a/arch/powerpc/platforms/powernv/vas-window.c +++ b/arch/powerpc/platforms/powernv/vas-window.c @@ -21,6 +21,9 @@ #include "vas.h" #include "copy-paste.h" +#define CREATE_TRACE_POINTS +#include "vas-trace.h" + /* * Compute the paste address region for the window @window using the * ->paste_base_addr and ->paste_win_id_shift we got from device tree. @@ -880,6 +883,8 @@ struct vas_window *vas_rx_win_open(int vasid, enum vas_cop_type cop, struct vas_winctx winctx; struct vas_instance *vinst; + trace_vas_rx_win_open(current, vasid, cop, rxattr); + if (!rx_win_args_valid(cop, rxattr)) return ERR_PTR(-EINVAL); @@ -1008,6 +1013,8 @@ struct vas_window *vas_tx_win_open(int vasid, enum vas_cop_type cop, struct vas_winctx winctx; struct vas_instance *vinst; + trace_vas_tx_win_open(current, vasid, cop, attr); + if (!tx_win_args_valid(cop, attr)) return ERR_PTR(-EINVAL); @@ -1100,6 +1107,8 @@ int vas_paste_crb(struct vas_window *txwin, int offset, bool re) void *addr; uint64_t val; + trace_vas_paste_crb(current, txwin); + /* * Only NX windows are supported for now and hardware assumes * report-enable flag is set for NX windows. Ensure software -- 2.7.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [4/4] powerpc/vas: Add a couple of trace points 2018-02-10 3:49 ` [PATCH 4/4] powerpc/vas: Add a couple of trace points Sukadev Bhattiprolu @ 2018-03-19 22:22 ` Michael Ellerman 0 siblings, 0 replies; 8+ messages in thread From: Michael Ellerman @ 2018-03-19 22:22 UTC (permalink / raw) To: Sukadev Bhattiprolu; +Cc: linuxppc-dev, mikey, linux-kernel On Sat, 2018-02-10 at 03:49:27 UTC, Sukadev Bhattiprolu wrote: > Add a couple of trace points in the VAS driver > > Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/007bb7d6c77ef2243dabf9c4132afa cheers ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-03-19 22:22 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-02-10 3:49 [PATCH RESEND 1/4] powerpc/vas: Fix order of cleanup in debugfs dir Sukadev Bhattiprolu 2018-02-10 3:49 ` [PATCH 2/4] powerpc/vas: Fix cleanup when VAS is not configured Sukadev Bhattiprolu 2018-02-12 5:23 ` Michael Ellerman 2018-02-12 20:25 ` Sukadev Bhattiprolu 2018-02-13 3:17 ` Michael Ellerman 2018-02-10 3:49 ` [PATCH RESEND 3/4] powerpc/vas: Remove a stray line in Makefile Sukadev Bhattiprolu 2018-02-10 3:49 ` [PATCH 4/4] powerpc/vas: Add a couple of trace points Sukadev Bhattiprolu 2018-03-19 22:22 ` [4/4] " Michael Ellerman
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.