Re: [PATCH v4 4/4] rcu: Add RCU stall diagnosis information

From: Leizhen (ThunderTown)
Date: Thu Nov 03 2022 - 23:13:00 EST




On 2022/11/4 10:12, Zhen Lei wrote:
> diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
> index d4a97e40ea9c3e2..44d49819a31f050 100644
> --- a/kernel/rcu/tree.h
> +++ b/kernel/rcu/tree.h
> @@ -158,6 +158,22 @@ union rcu_noqs {
> u16 s; /* Set of bits, aggregate OR here. */
> };
>
> +/*
> + * Record the snapshot of the core stats at 1/2 rcu stall timeout. The member
> + * gp_seq is used to ensure that all members are updated only once during the
> + * second half period. The snapshot is taken only if this gp_seq is not equal
> + * to rdp->gp_seq.
> + */
> +struct rcu_snap_record {
> + unsigned long gp_seq; /* Track rdp->gp_seq counter */
> + u64 cputime_irq; /* Accumulated cputime of hard irqs */
> + u64 cputime_softirq;/* Accumulated cputime of soft irqs */
> + u64 cputime_system; /* Accumulated cputime of kernel tasks */
> + unsigned long nr_hardirqs; /* Accumulated number of hard irqs */
> + unsigned int nr_softirqs; /* Accumulated number of soft irqs */
> + unsigned long long nr_csw; /* Accumulated number of task switches */
> +};
> +
> /* Per-CPU data for read-copy update. */
> struct rcu_data {
> /* 1) quiescent-state and grace-period handling : */
> @@ -262,6 +278,7 @@ struct rcu_data {
> short rcu_onl_gp_flags; /* ->gp_flags at last online. */
> unsigned long last_fqs_resched; /* Time of last rcu_resched(). */
> unsigned long last_sched_clock; /* Jiffies of last rcu_sched_clock_irq(). */
> + struct rcu_snap_record snap_record; /* Snapshot of core stats at 1/2 rcu stall timeout */
>
> int cpu;
> };

Sorry, I forgot to update linux-rcu.git. There is a conflict here.

----------------
int cpu;
};
------------should be--------
long lazy_len; /* Length of buffered lazy callbacks. */
int cpu;
----------------

--
Regards,
Zhen Lei