lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-Id: <20250519091826.19752-41-byungchul@sk.com> Date: Mon, 19 May 2025 18:18:24 +0900 From: Byungchul Park <byungchul@...com> To: linux-kernel@...r.kernel.org Cc: kernel_team@...ynix.com, torvalds@...ux-foundation.org, damien.lemoal@...nsource.wdc.com, linux-ide@...r.kernel.org, adilger.kernel@...ger.ca, linux-ext4@...r.kernel.org, mingo@...hat.com, peterz@...radead.org, will@...nel.org, tglx@...utronix.de, rostedt@...dmis.org, joel@...lfernandes.org, sashal@...nel.org, daniel.vetter@...ll.ch, duyuyang@...il.com, johannes.berg@...el.com, tj@...nel.org, tytso@....edu, willy@...radead.org, david@...morbit.com, amir73il@...il.com, gregkh@...uxfoundation.org, kernel-team@....com, linux-mm@...ck.org, akpm@...ux-foundation.org, mhocko@...nel.org, minchan@...nel.org, hannes@...xchg.org, vdavydov.dev@...il.com, sj@...nel.org, jglisse@...hat.com, dennis@...nel.org, cl@...ux.com, penberg@...nel.org, rientjes@...gle.com, vbabka@...e.cz, ngupta@...are.org, linux-block@...r.kernel.org, josef@...icpanda.com, linux-fsdevel@...r.kernel.org, jack@...e.cz, jlayton@...nel.org, dan.j.williams@...el.com, hch@...radead.org, djwong@...nel.org, dri-devel@...ts.freedesktop.org, rodrigosiqueiramelo@...il.com, melissa.srw@...il.com, hamohammed.sa@...il.com, harry.yoo@...cle.com, chris.p.wilson@...el.com, gwan-gyeong.mun@...el.com, max.byungchul.park@...il.com, boqun.feng@...il.com, longman@...hat.com, yskelg@...il.com, yunseong.kim@...csson.com, yeoreum.yun@....com, netdev@...r.kernel.org, matthew.brost@...el.com, her0gyugyu@...il.com Subject: [PATCH v16 40/42] dept: introduce event_site() to disable event tracking if it's recoverable With multi event sites for a single wait, dept allows to skip tracking an event that is recoverable by other recover paths. Introduce an API, event_site(), to skip tracking the event in the case. Signed-off-by: Byungchul Park <byungchul@...com> --- include/linux/dept.h | 30 ++++++++++++++++++++++++++++++ include/linux/sched.h | 6 ++++++ kernel/dependency/dept.c | 20 ++++++++++++++++++++ 3 files changed, 56 insertions(+) diff --git a/include/linux/dept.h b/include/linux/dept.h index 25fdd324614a..0ac13129f308 100644 --- a/include/linux/dept.h +++ b/include/linux/dept.h @@ -487,6 +487,31 @@ extern void dept_task_exit(struct task_struct *t); extern void dept_free_range(void *start, unsigned int sz); extern void dept_mark_event_site_used(void *start, void *end); +extern void disable_event_track(void); +extern void enable_event_track(void); + +#define event_site(es, evt_func, ...) \ +do { \ + unsigned long _flags; \ + bool _disable; \ + \ + local_irq_save(_flags); \ + dept_event_site_used(es); \ + /* \ + * If !list_empty(&(es)->dept_head), the event site can be \ + * recovered by others. Do not track event dependency if so. \ + */ \ + _disable = !list_empty(&(es)->dep_head); \ + if (_disable) \ + disable_event_track(); \ + \ + evt_func(__VA_ARGS__); \ + \ + if (_disable) \ + enable_event_track(); \ + local_irq_restore(_flags); \ +} while (0) + extern void dept_map_init(struct dept_map *m, struct dept_key *k, int sub_u, const char *n); extern void dept_map_reinit(struct dept_map *m, struct dept_key *k, int sub_u, const char *n); extern void dept_ext_wgen_init(struct dept_ext_wgen *ewg); @@ -550,6 +575,11 @@ struct dept_event_site { }; #define dept_task_exit(t) do { } while (0) #define dept_free_range(s, sz) do { } while (0) #define dept_mark_event_site_used(s, e) do { } while (0) +#define event_site(es, evt_func, ...) \ +do { \ + (void)(es); \ + evt_func(__VA_ARGS__); \ +} while (0) #define dept_map_init(m, k, su, n) do { (void)(n); (void)(k); } while (0) #define dept_map_reinit(m, k, su, n) do { (void)(n); (void)(k); } while (0) diff --git a/include/linux/sched.h b/include/linux/sched.h index 43927e61921b..44a77b7116b7 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -873,6 +873,11 @@ struct dept_task { */ int missing_ecxt; + /* + * not to track events + */ + int disable_event_track_cnt; + /* * for tracking IRQ-enable state */ @@ -910,6 +915,7 @@ struct dept_task { .stage_wait_stack = NULL, \ .stage_lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED,\ .missing_ecxt = 0, \ + .disable_event_track_cnt = 0, \ .hardirqs_enabled = false, \ .softirqs_enabled = false, \ .task_exit = false, \ diff --git a/kernel/dependency/dept.c b/kernel/dependency/dept.c index baa60bd0fb93..c65bb0c6dad2 100644 --- a/kernel/dependency/dept.c +++ b/kernel/dependency/dept.c @@ -2573,6 +2573,23 @@ static void __dept_wait(struct dept_map *m, unsigned long w_f, } } +void disable_event_track(void) +{ + dept_task()->disable_event_track_cnt++; +} +EXPORT_SYMBOL_GPL(disable_event_track); + +void enable_event_track(void) +{ + dept_task()->disable_event_track_cnt--; +} +EXPORT_SYMBOL_GPL(enable_event_track); + +static bool event_track_disabled(void) +{ + return !!dept_task()->disable_event_track_cnt; +} + /* * Called between dept_enter() and dept_exit(). */ @@ -2585,6 +2602,9 @@ static void __dept_event(struct dept_map *m, struct dept_map *real_m, struct dept_key *k; int e; + if (event_track_disabled()) + return; + e = find_first_bit(&e_f, DEPT_MAX_SUBCLASSES_EVT); if (DEPT_WARN_ON(e >= DEPT_MAX_SUBCLASSES_EVT)) -- 2.17.1
Powered by blists - more mailing lists