From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65B95233721; Tue, 1 Sep 2026 01:43:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788227003; cv=none; b=PgIURGZcAOQgZF/68J2IM/SpauK9/xCq0OKXhiQEUj1iWGWhH0O4L3LJd116e+KQeWngQR/S6WIo1fSLeYg9plw5Z1u0NFv6TRalYWgjwEMBgxylfzpcDcWyzGu/yJ7uhxsya4+Dsqjkf9vSZMou4Ofd+YIkcsDtky8++b3IMYc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788227003; c=relaxed/simple; bh=RtYKfymBNp9KvWTyDmEZgzY+yJgX+7+dkVBS2iKKpbg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nCzebmH+MqKAkix45OChST4tAg7mG2BpEqpUV/W25FgH7JlabPxpmZO3f60ErwbmNfAYFSwzZnr3khi+JVlEQITOwuiXWoJlji5V6uyRuHMPNdTFwCpJHy6yzBc6LO0p7JhNqBS+oisNrXjbIY6gr9YRUI8kgyFyBuONdJxL7T4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=OxuXNRoZ; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="OxuXNRoZ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1788227000; x=1819763000; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RtYKfymBNp9KvWTyDmEZgzY+yJgX+7+dkVBS2iKKpbg=; b=OxuXNRoZbeMhHzlxYC81ZkjH9pDwzsc8K4NekhGfKXAgP24SJrAxjKA8 1Gm9o1qt/0TKLTOv0i+FtG0TNX5LR0xNQufjqb0BZcNOJ50Gouz3Z2Hc1 cMQl5gbQzelJKzo8vwnjRcuzj3WtdXUqDp7ZbGJI71WJaSqyOHvZSyWEc hFAdZ+Md+n8qclUSIXHfLtreCUxHs6uCF71NnuPo1L4AuMaA+19x6lCtT TVnrrUVfyTZsqnLQNFns4rAn3Lll4CHG+WUmvD8Cy/CHQf/MUxNiHQRS7 2nHec3RxN4YE6Jwk0fQ1ssbjtYn4mn0hBNgMs2kO0XsC6w0P4sMolcYAj A==; X-CSE-ConnectionGUID: VB0LFxPFQxSTGdrDgCBxbA== X-CSE-MsgGUID: HR5wpLpATyav5a8px76fHg== X-IronPort-AV: E=McAfee;i="6800,10657,11892"; a="106164298" X-IronPort-AV: E=Sophos;i="6.25,255,1779174000"; d="scan'208";a="106164298" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2026 18:43:19 -0700 X-CSE-ConnectionGUID: qBb9qxWMQLydzmJilke+1g== X-CSE-MsgGUID: JA2nDKJhT02Nus7N07a2Tg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,255,1779174000"; d="scan'208";a="273136121" Received: from junjie-desk-dev.bj.intel.com ([10.238.152.71]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2026 18:43:11 -0700 From: Junjie Cao To: syzbot+2642f347f7309b4880dc@syzkaller.appspotmail.com Cc: akpm@linux-foundation.org, cgroups@vger.kernel.org, hannes@cmpxchg.org, jackmanb@google.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, mhocko@kernel.org, mhocko@suse.com, muchun.song@linux.dev, netdev@vger.kernel.org, roman.gushchin@linux.dev, shakeel.butt@linux.dev, surenb@google.com, syzkaller-bugs@googlegroups.com, vbabka@suse.cz, ziy@nvidia.com, hdanton@sina.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, jhs@mojatatu.com, jiri@resnulli.us, vinicius.gomes@intel.com Subject: Re: [syzbot] [mm?] INFO: rcu detected stall in exit_to_user_mode_loop Date: Tue, 1 Sep 2026 09:43:03 +0800 Message-ID: <20260901014303.417027-1-junjie.cao@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <6887ebf4.a00a0220.b12ec.00ae.GAE@google.com> References: <6887ebf4.a00a0220.b12ec.00ae.GAE@google.com> Precedence: bulk X-Mailing-List: cgroups@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git abdf623ddb75b24659018d3952d8f61937306ae5 diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index 39ac5b97aa3a..901dfd2484e1 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -83,6 +83,10 @@ struct sched_gate_list { s64 cycle_time; s64 cycle_time_extension; s64 base_time; + /* min(cycle_time, sum of intervals): the software schedule restarts + * the list after the last entry even when cycle_time is not up yet. + */ + s64 period; }; struct taprio_sched { @@ -871,12 +875,13 @@ static struct sk_buff *taprio_dequeue(struct Qdisc *sch) } static bool should_restart_cycle(const struct sched_gate_list *oper, - const struct sched_entry *entry) + const struct sched_entry *entry, + ktime_t end_time) { if (list_is_last(&entry->list, &oper->entries)) return true; - if (ktime_compare(entry->end_time, oper->cycle_end_time) == 0) + if (ktime_compare(end_time, oper->cycle_end_time) == 0) return true; return false; @@ -925,8 +930,9 @@ static enum hrtimer_restart advance_sched(struct hrtimer *timer) int num_tc = netdev_get_num_tc(dev); struct sched_entry *entry, *next; struct Qdisc *sch = q->root; - ktime_t end_time; - int tc; + ktime_t end_time, next_start, now; + int budget, tc; + s64 behind; spin_lock(&q->current_entry_lock); entry = rcu_dereference_protected(q->current_entry, @@ -952,23 +958,49 @@ static enum hrtimer_restart advance_sched(struct hrtimer *timer) goto first_run; } - if (should_restart_cycle(oper, entry)) { - next = list_first_entry(&oper->entries, struct sched_entry, - list); - oper->cycle_end_time = ktime_add_ns(oper->cycle_end_time, - oper->cycle_time); - } else { - next = list_next_entry(entry, list); + now = hrtimer_cb_get_time(timer); + end_time = entry->end_time; + behind = ktime_sub(now, end_time); + + /* Behind, e.g. delayed timer or stepped clock: skip whole periods + * arithmetically and walk at most one more to the entry covering + * now, instead of replaying the backlog one expiry at a time. The + * cap bounds the walk; a leftover is picked up by the next expiry. + */ + if (unlikely(behind >= oper->period)) { + s64 jump = div64_s64(behind, oper->period) * oper->period; + + end_time = ktime_add_ns(end_time, jump); + oper->cycle_end_time = ktime_add_ns(oper->cycle_end_time, jump); } - end_time = ktime_add_ns(entry->end_time, next->interval); - end_time = min_t(ktime_t, end_time, oper->cycle_end_time); + budget = 2 * oper->num_entries; + do { + if (should_restart_cycle(oper, entry, end_time)) { + next = list_first_entry(&oper->entries, + struct sched_entry, list); + oper->cycle_end_time = ktime_add_ns(oper->cycle_end_time, + oper->period); + } else { + next = list_next_entry(entry, list); + } + + next_start = end_time; + end_time = ktime_add_ns(next_start, next->interval); + end_time = min_t(ktime_t, end_time, oper->cycle_end_time); + entry = next; + } while (unlikely(ktime_compare(end_time, now) <= 0) && budget--); + /* next can be the entry already published as q->current_entry (a + * single-entry schedule, or a catch-up of whole periods), so the + * close times and budgets below are rewritten in place while + * taprio_dequeue_from_txq() may be reading them. + */ for (tc = 0; tc < num_tc; tc++) { if (next->gate_duration[tc] == oper->cycle_time) next->gate_close_time[tc] = KTIME_MAX; else - next->gate_close_time[tc] = ktime_add_ns(entry->end_time, + next->gate_close_time[tc] = ktime_add_ns(next_start, next->gate_duration[tc]); } @@ -1130,6 +1162,8 @@ static int parse_taprio_schedule(struct taprio_sched *q, struct nlattr **tb, struct sched_gate_list *new, struct netlink_ext_ack *extack) { + struct sched_entry *entry; + ktime_t cycle = 0; int err = 0; if (tb[TCA_TAPRIO_ATTR_SCHED_SINGLE_ENTRY]) { @@ -1152,13 +1186,10 @@ static int parse_taprio_schedule(struct taprio_sched *q, struct nlattr **tb, if (err < 0) return err; - if (!new->cycle_time) { - struct sched_entry *entry; - ktime_t cycle = 0; - - list_for_each_entry(entry, &new->entries, list) - cycle = ktime_add_ns(cycle, entry->interval); + list_for_each_entry(entry, &new->entries, list) + cycle = ktime_add_ns(cycle, entry->interval); + if (!new->cycle_time) { if (cycle < 0 || cycle > INT_MAX) { NL_SET_ERR_MSG(extack, "'cycle_time' is too big"); return -EINVAL; @@ -1172,6 +1203,7 @@ static int parse_taprio_schedule(struct taprio_sched *q, struct nlattr **tb, return -EINVAL; } + new->period = min(new->cycle_time, cycle); taprio_calculate_gate_durations(q, new); return 0;