From 860abc773161431dc38893376ce7009109ad4544 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sun, 8 Feb 2026 16:07:20 +0100 Subject: [PATCH] 5.10-stable patches added patches: gve-correct-ethtool-rx_dropped-calculation.patch gve-fix-stats-report-corruption-on-queue-count-change.patch platform-x86-intel_telemetry-fix-swapped-arrays-in-pss-output.patch tracing-fix-ftrace-event-field-alignments.patch --- ...rrect-ethtool-rx_dropped-calculation.patch | 60 ++++++ ...ort-corruption-on-queue-count-change.patch | 124 ++++++++++++ ...try-fix-swapped-arrays-in-pss-output.patch | 55 +++++ queue-5.10/series | 4 + ...ng-fix-ftrace-event-field-alignments.patch | 188 ++++++++++++++++++ 5 files changed, 431 insertions(+) create mode 100644 queue-5.10/gve-correct-ethtool-rx_dropped-calculation.patch create mode 100644 queue-5.10/gve-fix-stats-report-corruption-on-queue-count-change.patch create mode 100644 queue-5.10/platform-x86-intel_telemetry-fix-swapped-arrays-in-pss-output.patch create mode 100644 queue-5.10/tracing-fix-ftrace-event-field-alignments.patch diff --git a/queue-5.10/gve-correct-ethtool-rx_dropped-calculation.patch b/queue-5.10/gve-correct-ethtool-rx_dropped-calculation.patch new file mode 100644 index 0000000000..a8cc7786ba --- /dev/null +++ b/queue-5.10/gve-correct-ethtool-rx_dropped-calculation.patch @@ -0,0 +1,60 @@ +From stable+bounces-214825-greg=kroah.com@vger.kernel.org Sat Feb 7 20:46:52 2026 +From: Sasha Levin +Date: Sat, 7 Feb 2026 14:46:45 -0500 +Subject: gve: Correct ethtool rx_dropped calculation +To: stable@vger.kernel.org +Cc: Max Yuan , Jordan Rhee , Joshua Washington , Matt Olson , Harshitha Ramamurthy , Jacob Keller , Jakub Kicinski , Sasha Levin +Message-ID: <20260207194645.533741-1-sashal@kernel.org> + +From: Max Yuan + +[ Upstream commit c7db85d579a1dccb624235534508c75fbf2dfe46 ] + +The gve driver's "rx_dropped" statistic, exposed via `ethtool -S`, +incorrectly includes `rx_buf_alloc_fail` counts. These failures +represent an inability to allocate receive buffers, not true packet +drops where a received packet is discarded. This misrepresentation can +lead to inaccurate diagnostics. + +This patch rectifies the ethtool "rx_dropped" calculation. It removes +`rx_buf_alloc_fail` from the total and adds `xdp_tx_errors` and +`xdp_redirect_errors`, which represent legitimate packet drops within +the XDP path. + +Cc: stable@vger.kernel.org +Fixes: 433e274b8f7b ("gve: Add stats for gve.") +Signed-off-by: Max Yuan +Reviewed-by: Jordan Rhee +Reviewed-by: Joshua Washington +Reviewed-by: Matt Olson +Signed-off-by: Harshitha Ramamurthy +Reviewed-by: Jacob Keller +Link: https://patch.msgid.link/20260202193925.3106272-3-hramamurthy@google.com +Signed-off-by: Jakub Kicinski +[ removed rx_buf_alloc_fail from rx_dropped calculation ] +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/google/gve/gve_ethtool.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/drivers/net/ethernet/google/gve/gve_ethtool.c ++++ b/drivers/net/ethernet/google/gve/gve_ethtool.c +@@ -210,8 +210,7 @@ gve_get_ethtool_stats(struct net_device + data[i++] = rx_bytes; + data[i++] = tx_bytes; + /* total rx dropped packets */ +- data[i++] = rx_skb_alloc_fail + rx_buf_alloc_fail + +- rx_desc_err_dropped_pkt; ++ data[i++] = rx_skb_alloc_fail + rx_desc_err_dropped_pkt; + /* Skip tx_dropped */ + i++; + +@@ -285,7 +284,6 @@ gve_get_ethtool_stats(struct net_device + data[i++] = tmp_rx_bytes; + /* rx dropped packets */ + data[i++] = tmp_rx_skb_alloc_fail + +- tmp_rx_buf_alloc_fail + + tmp_rx_desc_err_dropped_pkt; + data[i++] = rx->rx_copybreak_pkt; + data[i++] = rx->rx_copied_pkt; diff --git a/queue-5.10/gve-fix-stats-report-corruption-on-queue-count-change.patch b/queue-5.10/gve-fix-stats-report-corruption-on-queue-count-change.patch new file mode 100644 index 0000000000..5fa51f817e --- /dev/null +++ b/queue-5.10/gve-fix-stats-report-corruption-on-queue-count-change.patch @@ -0,0 +1,124 @@ +From stable+bounces-214817-greg=kroah.com@vger.kernel.org Sat Feb 7 19:14:15 2026 +From: Sasha Levin +Date: Sat, 7 Feb 2026 13:14:04 -0500 +Subject: gve: Fix stats report corruption on queue count change +To: stable@vger.kernel.org +Cc: Debarghya Kundu , Joshua Washington , Harshitha Ramamurthy , Jacob Keller , Jakub Kicinski , Sasha Levin +Message-ID: <20260207181404.488041-1-sashal@kernel.org> + +From: Debarghya Kundu + +[ Upstream commit 7b9ebcce0296e104a0d82a6b09d68564806158ff ] + +The driver and the NIC share a region in memory for stats reporting. +The NIC calculates its offset into this region based on the total size +of the stats region and the size of the NIC's stats. + +When the number of queues is changed, the driver's stats region is +resized. If the queue count is increased, the NIC can write past +the end of the allocated stats region, causing memory corruption. +If the queue count is decreased, there is a gap between the driver +and NIC stats, leading to incorrect stats reporting. + +This change fixes the issue by allocating stats region with maximum +size, and the offset calculation for NIC stats is changed to match +with the calculation of the NIC. + +Cc: stable@vger.kernel.org +Fixes: 24aeb56f2d38 ("gve: Add Gvnic stats AQ command and ethtool show/set-priv-flags.") +Signed-off-by: Debarghya Kundu +Reviewed-by: Joshua Washington +Signed-off-by: Harshitha Ramamurthy +Reviewed-by: Jacob Keller +Link: https://patch.msgid.link/20260202193925.3106272-2-hramamurthy@google.com +Signed-off-by: Jakub Kicinski +[ Same changes as 6.1 + context ] +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/google/gve/gve_ethtool.c | 42 +++++++++++++++++--------- + drivers/net/ethernet/google/gve/gve_main.c | 4 +- + 2 files changed, 31 insertions(+), 15 deletions(-) + +--- a/drivers/net/ethernet/google/gve/gve_ethtool.c ++++ b/drivers/net/ethernet/google/gve/gve_ethtool.c +@@ -140,7 +140,8 @@ gve_get_ethtool_stats(struct net_device + tmp_rx_desc_err_dropped_pkt, tmp_tx_pkts, tmp_tx_bytes; + u64 rx_buf_alloc_fail, rx_desc_err_dropped_pkt, rx_pkts, + rx_skb_alloc_fail, rx_bytes, tx_pkts, tx_bytes; +- int stats_idx, base_stats_idx, max_stats_idx; ++ int rx_base_stats_idx, max_rx_stats_idx, max_tx_stats_idx; ++ int stats_idx, stats_region_len, nic_stats_len; + struct stats *report_stats; + int *rx_qid_to_stats_idx; + int *tx_qid_to_stats_idx; +@@ -226,14 +227,33 @@ gve_get_ethtool_stats(struct net_device + data[i++] = priv->stats_report_trigger_cnt; + i = GVE_MAIN_STATS_LEN; + +- /* For rx cross-reporting stats, start from nic rx stats in report */ +- base_stats_idx = GVE_TX_STATS_REPORT_NUM * priv->tx_cfg.num_queues + +- GVE_RX_STATS_REPORT_NUM * priv->rx_cfg.num_queues; +- max_stats_idx = NIC_RX_STATS_REPORT_NUM * priv->rx_cfg.num_queues + +- base_stats_idx; ++ rx_base_stats_idx = 0; ++ max_rx_stats_idx = 0; ++ max_tx_stats_idx = 0; ++ stats_region_len = priv->stats_report_len - ++ sizeof(struct gve_stats_report); ++ nic_stats_len = (NIC_RX_STATS_REPORT_NUM * priv->rx_cfg.num_queues + ++ NIC_TX_STATS_REPORT_NUM * priv->tx_cfg.num_queues) * ++ sizeof(struct stats); ++ if (unlikely((stats_region_len - ++ nic_stats_len) % sizeof(struct stats))) { ++ net_err_ratelimited("Starting index of NIC stats should be multiple of stats size"); ++ } else { ++ /* For rx cross-reporting stats, ++ * start from nic rx stats in report ++ */ ++ rx_base_stats_idx = (stats_region_len - nic_stats_len) / ++ sizeof(struct stats); ++ max_rx_stats_idx = NIC_RX_STATS_REPORT_NUM * ++ priv->rx_cfg.num_queues + ++ rx_base_stats_idx; ++ max_tx_stats_idx = NIC_TX_STATS_REPORT_NUM * ++ priv->tx_cfg.num_queues + ++ max_rx_stats_idx; ++ } + /* Preprocess the stats report for rx, map queue id to start index */ + skip_nic_stats = false; +- for (stats_idx = base_stats_idx; stats_idx < max_stats_idx; ++ for (stats_idx = rx_base_stats_idx; stats_idx < max_rx_stats_idx; + stats_idx += NIC_RX_STATS_REPORT_NUM) { + u32 stat_name = be32_to_cpu(report_stats[stats_idx].stat_name); + u32 queue_id = be32_to_cpu(report_stats[stats_idx].queue_id); +@@ -286,13 +306,9 @@ gve_get_ethtool_stats(struct net_device + i += priv->rx_cfg.num_queues * NUM_GVE_RX_CNTS; + } + +- /* For tx cross-reporting stats, start from nic tx stats in report */ +- base_stats_idx = max_stats_idx; +- max_stats_idx = NIC_TX_STATS_REPORT_NUM * priv->tx_cfg.num_queues + +- max_stats_idx; +- /* Preprocess the stats report for tx, map queue id to start index */ + skip_nic_stats = false; +- for (stats_idx = base_stats_idx; stats_idx < max_stats_idx; ++ /* NIC TX stats start right after NIC RX stats */ ++ for (stats_idx = max_rx_stats_idx; stats_idx < max_tx_stats_idx; + stats_idx += NIC_TX_STATS_REPORT_NUM) { + u32 stat_name = be32_to_cpu(report_stats[stats_idx].stat_name); + u32 queue_id = be32_to_cpu(report_stats[stats_idx].queue_id); +--- a/drivers/net/ethernet/google/gve/gve_main.c ++++ b/drivers/net/ethernet/google/gve/gve_main.c +@@ -124,9 +124,9 @@ static int gve_alloc_stats_report(struct + int tx_stats_num, rx_stats_num; + + tx_stats_num = (GVE_TX_STATS_REPORT_NUM + NIC_TX_STATS_REPORT_NUM) * +- priv->tx_cfg.num_queues; ++ priv->tx_cfg.max_queues; + rx_stats_num = (GVE_RX_STATS_REPORT_NUM + NIC_RX_STATS_REPORT_NUM) * +- priv->rx_cfg.num_queues; ++ priv->rx_cfg.max_queues; + priv->stats_report_len = struct_size(priv->stats_report, stats, + size_add(tx_stats_num, rx_stats_num)); + priv->stats_report = diff --git a/queue-5.10/platform-x86-intel_telemetry-fix-swapped-arrays-in-pss-output.patch b/queue-5.10/platform-x86-intel_telemetry-fix-swapped-arrays-in-pss-output.patch new file mode 100644 index 0000000000..31a210338e --- /dev/null +++ b/queue-5.10/platform-x86-intel_telemetry-fix-swapped-arrays-in-pss-output.patch @@ -0,0 +1,55 @@ +From stable+bounces-214803-greg=kroah.com@vger.kernel.org Sat Feb 7 16:55:05 2026 +From: Sasha Levin +Date: Sat, 7 Feb 2026 10:54:58 -0500 +Subject: platform/x86: intel_telemetry: Fix swapped arrays in PSS output +To: stable@vger.kernel.org +Cc: "Kaushlendra Kumar" , "Ilpo Järvinen" , "Sasha Levin" +Message-ID: <20260207155458.405088-1-sashal@kernel.org> + +From: Kaushlendra Kumar + +[ Upstream commit 25e9e322d2ab5c03602eff4fbf4f7c40019d8de2 ] + +The LTR blocking statistics and wakeup event counters are incorrectly +cross-referenced during debugfs output rendering. The code populates +pss_ltr_blkd[] with LTR blocking data and pss_s0ix_wakeup[] with wakeup +data, but the display loops reference the wrong arrays. + +This causes the "LTR Blocking Status" section to print wakeup events +and the "Wakes Status" section to print LTR blockers, misleading power +management analysis and S0ix residency debugging. + +Fix by aligning array usage with the intended output section labels. + +Fixes: 87bee290998d ("platform:x86: Add Intel Telemetry Debugfs interfaces") +Cc: stable@vger.kernel.org +Signed-off-by: Kaushlendra Kumar +Link: https://patch.msgid.link/20251224032053.3915900-1-kaushlendra.kumar@intel.com +Reviewed-by: Ilpo Järvinen +Signed-off-by: Ilpo Järvinen +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/platform/x86/intel_telemetry_debugfs.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/platform/x86/intel_telemetry_debugfs.c ++++ b/drivers/platform/x86/intel_telemetry_debugfs.c +@@ -449,7 +449,7 @@ static int telem_pss_states_show(struct + for (index = 0; index < debugfs_conf->pss_ltr_evts; index++) { + seq_printf(s, "%-32s\t%u\n", + debugfs_conf->pss_ltr_data[index].name, +- pss_s0ix_wakeup[index]); ++ pss_ltr_blkd[index]); + } + + seq_puts(s, "\n--------------------------------------\n"); +@@ -459,7 +459,7 @@ static int telem_pss_states_show(struct + for (index = 0; index < debugfs_conf->pss_wakeup_evts; index++) { + seq_printf(s, "%-32s\t%u\n", + debugfs_conf->pss_wakeup[index].name, +- pss_ltr_blkd[index]); ++ pss_s0ix_wakeup[index]); + } + + return 0; diff --git a/queue-5.10/series b/queue-5.10/series index 3bd2db27de..34931d2587 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -35,3 +35,7 @@ nvmet-tcp-fix-regression-in-data_digest-calculation.patch nvmet-tcp-don-t-map-pages-which-can-t-come-from-high.patch nvmet-tcp-add-bounds-checks-in-nvmet_tcp_build_pdu_i.patch asoc-amd-fix-memory-leak-in-acp3x-pdm-dma-ops.patch +platform-x86-intel_telemetry-fix-swapped-arrays-in-pss-output.patch +gve-fix-stats-report-corruption-on-queue-count-change.patch +tracing-fix-ftrace-event-field-alignments.patch +gve-correct-ethtool-rx_dropped-calculation.patch diff --git a/queue-5.10/tracing-fix-ftrace-event-field-alignments.patch b/queue-5.10/tracing-fix-ftrace-event-field-alignments.patch new file mode 100644 index 0000000000..a5b80b5060 --- /dev/null +++ b/queue-5.10/tracing-fix-ftrace-event-field-alignments.patch @@ -0,0 +1,188 @@ +From stable+bounces-214821-greg=kroah.com@vger.kernel.org Sat Feb 7 20:15:36 2026 +From: Sasha Levin +Date: Sat, 7 Feb 2026 14:14:41 -0500 +Subject: tracing: Fix ftrace event field alignments +To: stable@vger.kernel.org +Cc: Steven Rostedt , Mathieu Desnoyers , Mark Rutland , "Masami Hiramatsu (Google)" , "jempty.liang" , Sasha Levin +Message-ID: <20260207191441.516221-1-sashal@kernel.org> + +From: Steven Rostedt + +[ Upstream commit 033c55fe2e326bea022c3cc5178ecf3e0e459b82 ] + +The fields of ftrace specific events (events used to save ftrace internal +events like function traces and trace_printk) are generated similarly to +how normal trace event fields are generated. That is, the fields are added +to a trace_events_fields array that saves the name, offset, size, +alignment and signness of the field. It is used to produce the output in +the format file in tracefs so that tooling knows how to parse the binary +data of the trace events. + +The issue is that some of the ftrace event structures are packed. The +function graph exit event structures are one of them. The 64 bit calltime +and rettime fields end up 4 byte aligned, but the algorithm to show to +userspace shows them as 8 byte aligned. + +The macros that create the ftrace events has one for embedded structure +fields. There's two macros for theses fields: + + __field_desc() and __field_packed() + +The difference of the latter macro is that it treats the field as packed. + +Rename that field to __field_desc_packed() and create replace the +__field_packed() to be a normal field that is packed and have the calltime +and rettime use those. + +This showed up on 32bit architectures for function graph time fields. It +had: + + ~# cat /sys/kernel/tracing/events/ftrace/funcgraph_exit/format +[..] + field:unsigned long func; offset:8; size:4; signed:0; + field:unsigned int depth; offset:12; size:4; signed:0; + field:unsigned int overrun; offset:16; size:4; signed:0; + field:unsigned long long calltime; offset:24; size:8; signed:0; + field:unsigned long long rettime; offset:32; size:8; signed:0; + +Notice that overrun is at offset 16 with size 4, where in the structure +calltime is at offset 20 (16 + 4), but it shows the offset at 24. That's +because it used the alignment of unsigned long long when used as a +declaration and not as a member of a structure where it would be aligned +by word size (in this case 4). + +By using the proper structure alignment, the format has it at the correct +offset: + + ~# cat /sys/kernel/tracing/events/ftrace/funcgraph_exit/format +[..] + field:unsigned long func; offset:8; size:4; signed:0; + field:unsigned int depth; offset:12; size:4; signed:0; + field:unsigned int overrun; offset:16; size:4; signed:0; + field:unsigned long long calltime; offset:20; size:8; signed:0; + field:unsigned long long rettime; offset:28; size:8; signed:0; + +Cc: stable@vger.kernel.org +Cc: Mathieu Desnoyers +Cc: Mark Rutland +Acked-by: Masami Hiramatsu (Google) +Reported-by: "jempty.liang" +Link: https://patch.msgid.link/20260204113628.53faec78@gandalf.local.home +Fixes: 04ae87a52074e ("ftrace: Rework event_create_dir()") +Closes: https://lore.kernel.org/all/20260130015740.212343-1-imntjempty@163.com/ +Closes: https://lore.kernel.org/all/20260202123342.2544795-1-imntjempty@163.com/ +Signed-off-by: Steven Rostedt (Google) +[ Renames + context ] +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + kernel/trace/trace.h | 7 +++++-- + kernel/trace/trace_entries.h | 14 +++++++------- + kernel/trace/trace_export.c | 21 +++++++++++++++------ + 3 files changed, 27 insertions(+), 15 deletions(-) + +--- a/kernel/trace/trace.h ++++ b/kernel/trace/trace.h +@@ -56,14 +56,17 @@ enum trace_type { + #undef __field_fn + #define __field_fn(type, item) type item; + ++#undef __field_packed ++#define __field_packed(type, item) type item; ++ + #undef __field_struct + #define __field_struct(type, item) __field(type, item) + + #undef __field_desc + #define __field_desc(type, container, item) + +-#undef __field_packed +-#define __field_packed(type, container, item) ++#undef __field_desc_packed ++#define __field_desc_packed(type, container, item) + + #undef __array + #define __array(type, item, size) type item[size]; +--- a/kernel/trace/trace_entries.h ++++ b/kernel/trace/trace_entries.h +@@ -78,8 +78,8 @@ FTRACE_ENTRY_PACKED(funcgraph_entry, ftr + + F_STRUCT( + __field_struct( struct ftrace_graph_ent, graph_ent ) +- __field_packed( unsigned long, graph_ent, func ) +- __field_packed( int, graph_ent, depth ) ++ __field_desc_packed( unsigned long, graph_ent, func ) ++ __field_desc_packed( int, graph_ent, depth ) + ), + + F_printk("--> %ps (%d)", (void *)__entry->func, __entry->depth) +@@ -92,11 +92,11 @@ FTRACE_ENTRY_PACKED(funcgraph_exit, ftra + + F_STRUCT( + __field_struct( struct ftrace_graph_ret, ret ) +- __field_packed( unsigned long, ret, func ) +- __field_packed( unsigned long, ret, overrun ) +- __field_packed( unsigned long long, ret, calltime) +- __field_packed( unsigned long long, ret, rettime ) +- __field_packed( int, ret, depth ) ++ __field_desc_packed( unsigned long, ret, func ) ++ __field_desc_packed( unsigned long, ret, overrun ) ++ __field_desc_packed( unsigned long long, ret, calltime) ++ __field_desc_packed( unsigned long long, ret, rettime ) ++ __field_desc_packed( int, ret, depth ) + ), + + F_printk("<-- %ps (%d) (start: %llx end: %llx) over: %d", +--- a/kernel/trace/trace_export.c ++++ b/kernel/trace/trace_export.c +@@ -42,11 +42,14 @@ static int ftrace_event_register(struct + #undef __field_fn + #define __field_fn(type, item) type item; + ++#undef __field_packed ++#define __field_packed(type, item) type item; ++ + #undef __field_desc + #define __field_desc(type, container, item) type item; + +-#undef __field_packed +-#define __field_packed(type, container, item) type item; ++#undef __field_desc_packed ++#define __field_desc_packed(type, container, item) type item; + + #undef __array + #define __array(type, item, size) type item[size]; +@@ -101,11 +104,14 @@ static void __always_unused ____ftrace_c + #undef __field_fn + #define __field_fn(_type, _item) __field_ext(_type, _item, FILTER_TRACE_FN) + ++#undef __field_packed ++#define __field_packed(_type, _item) __field_ext_packed(_type, _item, FILTER_OTHER) ++ + #undef __field_desc + #define __field_desc(_type, _container, _item) __field_ext(_type, _item, FILTER_OTHER) + +-#undef __field_packed +-#define __field_packed(_type, _container, _item) __field_ext_packed(_type, _item, FILTER_OTHER) ++#undef __field_desc_packed ++#define __field_desc_packed(_type, _container, _item) __field_ext_packed(_type, _item, FILTER_OTHER) + + #undef __array + #define __array(_type, _item, _len) { \ +@@ -139,11 +145,14 @@ static struct trace_event_fields ftrace_ + #undef __field_fn + #define __field_fn(type, item) + ++#undef __field_packed ++#define __field_packed(type, item) ++ + #undef __field_desc + #define __field_desc(type, container, item) + +-#undef __field_packed +-#define __field_packed(type, container, item) ++#undef __field_desc_packed ++#define __field_desc_packed(type, container, item) + + #undef __array + #define __array(type, item, len) -- 2.47.3