From: Gaetan Rivet <[email protected]> Count individual simple, EM and SM cache misses as well. Currently misses are counted globally, meaning that missing in all caches one after the other counts as single miss. It is not sufficient to decide whether each match stage is efficient.
To decide to disable the EMC or the SMC, we must know how many lookups are done specifically within each of those stages. This also allows knowing how many lookups are done totally, by adding the hits and misses for each caches. Signed-off-by: Gaetan Rivet <[email protected]> Acked-by: Roi Dayan <[email protected]> --- lib/dpif-netdev-avx512.c | 9 +++++++++ lib/dpif-netdev-perf.h | 3 +++ lib/dpif-netdev.c | 10 ++++++++++ utilities/checkpatch.py | 2 +- 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/lib/dpif-netdev-avx512.c b/lib/dpif-netdev-avx512.c index 83e7a1394ded..32aad6242806 100644 --- a/lib/dpif-netdev-avx512.c +++ b/lib/dpif-netdev-avx512.c @@ -119,6 +119,9 @@ dp_netdev_input_outer_avx512(struct dp_netdev_pmd_thread *pmd, uint32_t smc_hits = 0; uint32_t phwol_hits = 0; + uint32_t emc_miss = 0; + uint32_t smc_miss = 0; + /* A 1 bit in this mask indicates a hit, so no DPCLS lookup on the pkt. */ uint32_t hwol_emc_smc_hitmask = 0; uint32_t smc_hitmask = 0; @@ -259,6 +262,8 @@ dp_netdev_input_outer_avx512(struct dp_netdev_pmd_thread *pmd, emc_hits++; hwol_emc_smc_hitmask |= (UINT32_C(1) << i); continue; + } else { + emc_miss++; } } @@ -269,6 +274,8 @@ dp_netdev_input_outer_avx512(struct dp_netdev_pmd_thread *pmd, smc_hits++; smc_hitmask |= (UINT32_C(1) << i); continue; + } else { + smc_miss++; } } @@ -348,6 +355,8 @@ dp_netdev_input_outer_avx512(struct dp_netdev_pmd_thread *pmd, mfex_hit_cnt); pmd_perf_update_counter(&pmd->perf_stats, PMD_STAT_EXACT_HIT, emc_hits); pmd_perf_update_counter(&pmd->perf_stats, PMD_STAT_SMC_HIT, smc_hits); + pmd_perf_update_counter(&pmd->perf_stats, PMD_STAT_EXACT_MISS, emc_miss); + pmd_perf_update_counter(&pmd->perf_stats, PMD_STAT_SMC_MISS, smc_miss); pmd_perf_update_counter(&pmd->perf_stats, PMD_STAT_MASKED_HIT, dpcls_key_idx); pmd_perf_update_counter(&pmd->perf_stats, PMD_STAT_MASKED_LOOKUP, diff --git a/lib/dpif-netdev-perf.h b/lib/dpif-netdev-perf.h index dc5753fac2be..fd533a63d29a 100644 --- a/lib/dpif-netdev-perf.h +++ b/lib/dpif-netdev-perf.h @@ -62,6 +62,9 @@ enum pmd_stat_type { PMD_STAT_EXACT_HIT, /* Packets that had an exact match (emc). */ PMD_STAT_SMC_HIT, /* Packets that had a sig match hit (SMC). */ PMD_STAT_MASKED_HIT, /* Packets that matched in the flow table. */ + PMD_STAT_SIMPLE_MISS, /* Packets that had a simple match miss. */ + PMD_STAT_EXACT_MISS, /* Packets that had an exact match miss (EMC). */ + PMD_STAT_SMC_MISS, /* Packets that had a sig match miss (SMC). */ PMD_STAT_MISS, /* Packets that did not match and upcall was ok. */ PMD_STAT_LOST, /* Packets that did not match and upcall failed. */ /* The above statistics account for the total diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 32985b5d8e9d..4f76e82882e0 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -8414,6 +8414,7 @@ smc_lookup_batch(struct dp_netdev_pmd_thread *pmd, } pmd_perf_update_counter(&pmd->perf_stats, PMD_STAT_SMC_HIT, n_smc_hit); + pmd_perf_update_counter(&pmd->perf_stats, PMD_STAT_SMC_MISS, n_missed); } struct dp_netdev_flow * @@ -8530,6 +8531,7 @@ dfc_processing(struct dp_netdev_pmd_thread *pmd, const size_t cnt = dp_packet_batch_size(packets_); size_t n_missed = 0, n_emc_hit = 0, n_phwol_hit = 0; size_t n_mfex_opt_hit = 0, n_simple_hit = 0; + size_t n_emc_miss = 0, n_simple_miss = 0; struct dfc_cache *cache = &pmd->flow_cache; struct netdev_flow_key *key = &keys[0]; struct dp_packet *packet; @@ -8599,6 +8601,8 @@ dfc_processing(struct dp_netdev_pmd_thread *pmd, packet, flow, tcp_flags, batch_enable, batches, n_batches, flow_map, &map_cnt); continue; + } else { + n_simple_miss++; } } @@ -8618,6 +8622,9 @@ dfc_processing(struct dp_netdev_pmd_thread *pmd, packet, flow, tcp_flags, batch_enable, batches, n_batches, flow_map, &map_cnt); } else { + if (cur_min != 0) { + n_emc_miss++; + } /* Exact match cache missed. Group missed packets together at * the beginning of the 'packets' array. */ dp_packet_batch_refill(packets_, packet, i); @@ -8646,7 +8653,10 @@ dfc_processing(struct dp_netdev_pmd_thread *pmd, n_mfex_opt_hit); pmd_perf_update_counter(&pmd->perf_stats, PMD_STAT_SIMPLE_HIT, n_simple_hit); + pmd_perf_update_counter(&pmd->perf_stats, PMD_STAT_SIMPLE_MISS, + n_simple_miss); pmd_perf_update_counter(&pmd->perf_stats, PMD_STAT_EXACT_HIT, n_emc_hit); + pmd_perf_update_counter(&pmd->perf_stats, PMD_STAT_EXACT_MISS, n_emc_miss); if (!smc_enable_db) { return dp_packet_batch_size(packets_); diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py index b8ded0b12dea..e03c828abfc2 100755 --- a/utilities/checkpatch.py +++ b/utilities/checkpatch.py @@ -115,7 +115,7 @@ def open_spell_check_dict(): 'tftp', 'timeval', 'trie', 'tso', 'ubsan', 'ukey', 'umask', 'unassociated', 'unixctl', 'uuid' 'virtqueue', 'vms', 'vnet', 'vport', 'vports', - 'vtep', 'wc', 'wget', 'xenserver', 'sig'] + 'vtep', 'wc', 'wget', 'xenserver', 'sig', 'lookups'] global spell_check_dict -- 2.47.0 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
