From d35fa164172b6d3be504ea53ef6684788cd24c9b Mon Sep 17 00:00:00 2001 From: Balazs Gerofi Date: Sun, 20 Aug 2017 12:02:40 +0900 Subject: [PATCH] HFI1: more detailed profiling (disabled by default) --- kernel/include/profile.h | 1 + kernel/profile.c | 1 + kernel/user_sdma.c | 23 ++++++++++++++--------- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/kernel/include/profile.h b/kernel/include/profile.h index 2b802c60..f8eed0c1 100644 --- a/kernel/include/profile.h +++ b/kernel/include/profile.h @@ -44,6 +44,7 @@ enum profile_event_type { PROFILE_mmap_anon_no_contig_phys, PROFILE_mmap_regular_file, PROFILE_mmap_device_file, + PROFILE_sdma_0, PROFILE_sdma_1, PROFILE_sdma_2, PROFILE_sdma_3, diff --git a/kernel/profile.c b/kernel/profile.c index 0808fb3b..741e0803 100644 --- a/kernel/profile.c +++ b/kernel/profile.c @@ -69,6 +69,7 @@ char *profile_event_names[] = "mmap_anon_no_contig_phys", "mmap_regular_file", "mmap_device_file", + "sdma_0", "sdma_1", "sdma_2", "sdma_3", diff --git a/kernel/user_sdma.c b/kernel/user_sdma.c index 0be25ac5..b8baee0c 100644 --- a/kernel/user_sdma.c +++ b/kernel/user_sdma.c @@ -1277,11 +1277,6 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts) #else tx = kmalloc_cache_alloc(&txreq_cache, sizeof(*tx)); #endif /* __HFI1_ORIG__ */ -#ifdef PROFILE_ENABLE - profile_event_add(PROFILE_sdma_1, - (rdtsc() - prof_ts)); - prof_ts = rdtsc(); -#endif // PROFILE_ENABLE if (!tx) return -ENOMEM; TP("- kmalloc"); @@ -1299,6 +1294,11 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts) tx->flags |= (TXREQ_FLAGS_REQ_ACK | TXREQ_FLAGS_REQ_DISABLE_SH); +#ifdef PROFILE_ENABLE + profile_event_add(PROFILE_sdma_0, + (rdtsc() - prof_ts)); + prof_ts = rdtsc(); +#endif // PROFILE_ENABLE /* * Calculate the payload size - this is min of the fragment * (MTU) size or the remaining bytes in the request but only @@ -1335,6 +1335,11 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts) } } +#ifdef PROFILE_ENABLE + profile_event_add(PROFILE_sdma_1, + (rdtsc() - prof_ts)); + prof_ts = rdtsc(); +#endif // PROFILE_ENABLE if (test_bit(SDMA_REQ_HAVE_AHG, &req->flags)) { TP("+ if test_bit(SDMA_REQ_HAVE_AHG, &req->flags)"); if (!req->seqnum) { @@ -1404,15 +1409,15 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts) } TP("- test_bit(SDMA_REQ_HAVE_AHG, &req->flags)"); - /* - * If the request contains any data vectors, add up to - * fragsize bytes to the descriptor. - */ #ifdef PROFILE_ENABLE profile_event_add(PROFILE_sdma_2, (rdtsc() - prof_ts)); prof_ts = rdtsc(); #endif // PROFILE_ENABLE + /* + * If the request contains any data vectors, add up to + * fragsize bytes to the descriptor. + */ TP("+ If the request contains any data vectors, add up to fragsize bytes to the descriptor."); while (queued < datalen && (req->sent + data_sent) < req->data_len) {