CINXE.COM

LKML: Mark Rutland: Re: [PATCH 17/30] x86/thread_info: define TIF_NEED_RESCHED_LAZY

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>LKML: Mark Rutland: Re: [PATCH 17/30] x86/thread_info: define TIF_NEED_RESCHED_LAZY</title><link href="/css/message.css" rel="stylesheet" type="text/css" /><link href="/css/wrap.css" rel="alternate stylesheet" type="text/css" title="wrap" /><link href="/css/nowrap.css" rel="stylesheet" type="text/css" title="nowrap" /><link href="/favicon.ico" rel="shortcut icon" /><script src="/js/simple-calendar.js" type="text/javascript"></script><script src="/js/styleswitcher.js" type="text/javascript"></script><link rel="alternate" type="application/rss+xml" title="lkml.org : last 100 messages" href="/rss.php" /><link rel="alternate" type="application/rss+xml" title="lkml.org : last messages by Mark Rutland" href="/groupie.php?aid=" /><!--Matomo--><script> var _paq = window._paq = window._paq || []; /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ _paq.push(["setDoNotTrack", true]); _paq.push(["disableCookies"]); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u="//m.lkml.org/"; _paq.push(['setTrackerUrl', u+'matomo.php']); _paq.push(['setSiteId', '1']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); })(); </script><!--End Matomo Code--></head><body onload="es.jasper.simpleCalendar.init();" itemscope="itemscope" itemtype="http://schema.org/BlogPosting"><table border="0" cellpadding="0" cellspacing="0"><tr><td width="180" align="center"><a href="/"><img style="border:0;width:135px;height:32px" src="/images/toprowlk.gif" alt="lkml.org" /></a></td><td width="32">聽</td><td class="nb"><div><a class="nb" href="/lkml"> [lkml]</a> 聽 <a class="nb" href="/lkml/2024"> [2024]</a> 聽 <a class="nb" href="/lkml/2024/2"> [Feb]</a> 聽 <a class="nb" href="/lkml/2024/2/14"> [14]</a> 聽 <a class="nb" href="/lkml/last100"> [last100]</a> 聽 <a href="/rss.php"><img src="/images/rss-or.gif" border="0" alt="RSS Feed" /></a></div><div>Views: <a href="#" class="nowrap" onclick="setActiveStyleSheet('wrap');return false;">[wrap]</a><a href="#" class="wrap" onclick="setActiveStyleSheet('nowrap');return false;">[no wrap]</a> 聽 <a class="nb" href="/lkml/mheaders/2024/2/14/596" onclick="this.href='/lkml/headers'+'/2024/2/14/596';">[headers]</a>聽 <a href="/lkml/bounce/2024/2/14/596">[forward]</a>聽 </div></td><td width="32">聽</td></tr><tr><td valign="top"><div class="es-jasper-simpleCalendar" baseurl="/lkml/"></div><div class="threadlist">Messages in this thread</div><ul class="threadlist"><li class="root"><a href="/lkml/2024/2/12/1709">First message in thread</a></li><li><a href="/lkml/2024/2/12/1709">Ankur Arora</a><ul><li><a href="/lkml/2024/2/12/1710">Ankur Arora</a><ul><li><a href="/lkml/2024/2/19/914">Thomas Gleixner</a><ul><li><a href="/lkml/2024/2/20/1578">Ankur Arora</a></li></ul></li></ul></li><li><a href="/lkml/2024/2/12/1711">Ankur Arora</a><ul><li><a href="/lkml/2024/2/14/641">Mark Rutland</a><ul><li><a href="/lkml/2024/2/14/1466">Ankur Arora</a></li></ul></li></ul></li><li><a href="/lkml/2024/2/12/1712">Ankur Arora</a></li><li><a href="/lkml/2024/2/12/1713">Ankur Arora</a></li><li><a href="/lkml/2024/2/12/1714">Ankur Arora</a></li><li><a href="/lkml/2024/2/12/1715">Ankur Arora</a><ul><li><a href="/lkml/2024/2/19/912">Thomas Gleixner</a><ul><li><a href="/lkml/2024/2/20/1577">Ankur Arora</a><ul><li><a href="/lkml/2024/2/21/1158">Thomas Gleixner</a></li></ul></li></ul></li></ul></li><li><a href="/lkml/2024/2/12/1716">Ankur Arora</a><ul><li><a href="/lkml/2024/2/19/901">Thomas Gleixner</a><ul><li><a href="/lkml/2024/2/20/1584">Ankur Arora</a><ul><li><a href="/lkml/2024/2/21/1149">Thomas Gleixner</a></li></ul></li></ul></li><li><a href="/lkml/2024/2/21/1273">Steven Rostedt</a><ul><li><a href="/lkml/2024/2/21/1420">Thomas Gleixner</a></li></ul></li></ul></li><li><a href="/lkml/2024/2/12/1717">Ankur Arora</a></li><li><a href="/lkml/2024/2/12/1718">Ankur Arora</a></li><li><a href="/lkml/2024/2/12/1719">Ankur Arora</a></li><li><a href="/lkml/2024/2/12/1720">Ankur Arora</a></li><li><a href="/lkml/2024/2/12/1721">Ankur Arora</a><ul><li><a href="/lkml/2024/2/14/638">Mark Rutland</a><ul><li><a href="/lkml/2024/2/14/1479">Ankur Arora</a><ul><li><a href="/lkml/2024/2/19/640">Mark Rutland</a></li></ul></li><li><a href="/lkml/2024/2/19/906">Thomas Gleixner</a><ul><li><a href="/lkml/2024/2/20/1570">Ankur Arora</a></li></ul></li></ul></li></ul></li><li><a href="/lkml/2024/2/12/1722">Ankur Arora</a></li><li><a href="/lkml/2024/2/12/1723">Ankur Arora</a></li><li><a href="/lkml/2024/2/12/1724">Ankur Arora</a></li><li><a href="/lkml/2024/2/12/1725">Ankur Arora</a><ul><li><a href="/lkml/2024/3/10/209">"Paul E. McKenney"</a><ul><li><a href="/lkml/2024/3/10/282">Joel Fernandes</a><ul><li><a href="/lkml/2024/3/10/290">"Paul E. McKenney"</a></li><li><a href="/lkml/2024/3/10/296">Ankur Arora</a></li></ul></li></ul></li></ul></li><li><a href="/lkml/2024/2/12/1726">Ankur Arora</a><ul><li class="origin"><a href="/lkml/2024/2/14/1226">Mark Rutland</a><ul><li><a href="/lkml/2024/2/14/1226">Ankur Arora</a><ul><li><a href="/lkml/2024/2/19/651">Mark Rutland</a></li></ul></li></ul></li></ul></li><li><a href="/lkml/2024/2/12/1727">Ankur Arora</a></li><li><a href="/lkml/2024/2/12/1728">Ankur Arora</a></li><li><a href="/lkml/2024/2/12/1729">Ankur Arora</a></li><li><a href="/lkml/2024/2/12/1730">Ankur Arora</a></li><li><a href="/lkml/2024/2/12/1731">Ankur Arora</a></li><li><a href="/lkml/2024/2/12/1732">Ankur Arora</a><ul><li><a href="/lkml/2024/3/2/362">Joel Fernandes</a><ul><li><a href="/lkml/2024/3/5/390">Ankur Arora</a><ul><li><a href="/lkml/2024/3/6/1358">Joel Fernandes</a></li></ul></li></ul></li></ul></li><li><a href="/lkml/2024/2/12/1733">Ankur Arora</a></li><li><a href="/lkml/2024/2/12/1734">Ankur Arora</a></li><li><a href="/lkml/2024/2/12/1735">Ankur Arora</a></li><li><a href="/lkml/2024/2/12/1736">Ankur Arora</a></li><li><a href="/lkml/2024/2/12/1737">Ankur Arora</a><ul><li><a href="/lkml/2024/2/21/1538">Steven Rostedt</a><ul><li><a href="/lkml/2024/2/21/1618">Ankur Arora</a><ul><li><a href="/lkml/2024/2/21/1648">Steven Rostedt</a></li></ul></li><li><a href="/lkml/2024/3/1/1396">Ankur Arora</a><ul><li><a href="/lkml/2024/3/3/237">Joel Fernandes</a></li></ul></li></ul></li></ul></li><li><a href="/lkml/2024/2/13/336">Geert Uytterhoeven</a><ul><li><a href="/lkml/2024/2/13/1381">Ankur Arora</a></li></ul></li><li><a href="/lkml/2024/2/14/1423">"Paul E. McKenney"</a><ul><li><a href="/lkml/2024/2/14/1465">Ankur Arora</a><ul><li><a href="/lkml/2024/2/15/1266">"Paul E. McKenney"</a><ul><li><a href="/lkml/2024/2/15/1317">Thomas Gleixner</a></li><li><a href="/lkml/2024/2/15/1350">Ankur Arora</a></li><li><a href="/lkml/2024/2/15/1370">Ankur Arora</a></li></ul></li></ul></li></ul></li><li><a href="/lkml/2024/2/21/699">Raghavendra K T</a><ul><li><a href="/lkml/2024/2/21/1164">Thomas Gleixner</a><ul><li><a href="/lkml/2024/2/21/1183">Raghavendra K T</a><ul><li><a href="/lkml/2024/2/21/1489">Ankur Arora</a></li><li><a href="/lkml/2024/2/22/1477">Thomas Gleixner</a></li></ul></li><li><a href="/lkml/2024/2/22/724">Raghavendra K T</a></li></ul></li></ul></li><li><a href="/lkml/2024/2/21/1534">Steven Rostedt</a></li><li><a href="/lkml/2024/2/28/778">Juri Lelli</a><ul><li><a href="/lkml/2024/2/28/1640">Ankur Arora</a><ul><li><a href="/lkml/2024/2/29/403">Juri Lelli</a><ul><li><a href="/lkml/2024/2/29/1618">Ankur Arora</a></li></ul></li></ul></li></ul></li><li><a href="/lkml/2024/4/23/1061">Shrikanth Hegde</a><ul><li><a href="/lkml/2024/4/23/1123">Linus Torvalds</a><ul><li><a href="/lkml/2024/4/26/219">Shrikanth Hegde</a><ul><li><a href="/lkml/2024/4/26/934">Ankur Arora</a></li></ul></li></ul></li></ul></li></ul></li></ul></td><td width="32" rowspan="2" class="c" valign="top"><img src="/images/icornerl.gif" width="32" height="32" alt="/" /></td><td class="c" rowspan="2" valign="top" style="padding-top: 1em"><table><tr><td><table><tr><td class="lp">Date</td><td class="rp" itemprop="datePublished">Wed, 14 Feb 2024 13:25:32 +0000</td></tr><tr><td class="lp">From</td><td class="rp" itemprop="author">Mark Rutland &lt;&gt;</td></tr><tr><td class="lp">Subject</td><td class="rp" itemprop="name">Re: [PATCH 17/30] x86/thread_info: define TIF_NEED_RESCHED_LAZY</td></tr></table></td><td></td></tr></table><pre itemprop="articleBody">Hi Ankur,<br /><br />On Mon, Feb 12, 2024 at 09:55:41PM -0800, Ankur Arora wrote:<br />&gt; Define TIF_NEED_RESCHED_LAZY which, with TIF_NEED_RESCHED provides the<br />&gt; scheduler with two kinds of rescheduling intent: TIF_NEED_RESCHED,<br />&gt; for the usual rescheduling at the next safe preemption point;<br />&gt; TIF_NEED_RESCHED_LAZY expressing an intent to reschedule at some<br />&gt; time in the future while allowing the current task to run to<br />&gt; completion.<br />&gt; <br />&gt; Cc: Ingo Molnar &lt;mingo&#64;redhat.com&gt;<br />&gt; Cc: Borislav Petkov &lt;bp&#64;alien8.de&gt;<br />&gt; Cc: Dave Hansen &lt;dave.hansen&#64;linux.intel.com&gt;<br />&gt; Originally-by: Thomas Gleixner &lt;tglx&#64;linutronix.de&gt;<br />&gt; Link: <a href="https://lore.kernel.org/lkml/87jzshhexi.ffs&#64;tglx/">https://lore.kernel.org/lkml/87jzshhexi.ffs&#64;tglx/</a><br />&gt; Signed-off-by: Ankur Arora &lt;ankur.a.arora&#64;oracle.com&gt;<br />&gt; ---<br />&gt; arch/x86/Kconfig | 1 +<br />&gt; arch/x86/include/asm/thread_info.h | 10 ++++++++--<br />&gt; 2 files changed, 9 insertions(+), 2 deletions(-)<br />&gt; <br />&gt; diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig<br />&gt; index 5edec175b9bf..ab58558068a4 100644<br />&gt; --- a/arch/x86/Kconfig<br />&gt; +++ b/arch/x86/Kconfig<br />&gt; &#64;&#64; -275,6 +275,7 &#64;&#64; config X86<br />&gt; select HAVE_STATIC_CALL<br />&gt; select HAVE_STATIC_CALL_INLINE if HAVE_OBJTOOL<br />&gt; select HAVE_PREEMPT_DYNAMIC_CALL<br />&gt; + select HAVE_PREEMPT_AUTO<br />&gt; select HAVE_RSEQ<br />&gt; select HAVE_RUST if X86_64<br />&gt; select HAVE_SYSCALL_TRACEPOINTS<br />&gt; diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h<br />&gt; index d63b02940747..88c1802185fc 100644<br />&gt; --- a/arch/x86/include/asm/thread_info.h<br />&gt; +++ b/arch/x86/include/asm/thread_info.h<br />&gt; &#64;&#64; -81,8 +81,11 &#64;&#64; struct thread_info {<br />&gt; #define TIF_NOTIFY_RESUME 1 /* callback before returning to user */<br />&gt; #define TIF_SIGPENDING 2 /* signal pending */<br />&gt; #define TIF_NEED_RESCHED 3 /* rescheduling necessary */<br />&gt; -#define TIF_SINGLESTEP 4 /* reenable singlestep on user return*/<br />&gt; -#define TIF_SSBD 5 /* Speculative store bypass disable */<br />&gt; +#ifdef CONFIG_PREEMPT_AUTO<br />&gt; +#define TIF_NEED_RESCHED_LAZY 4 /* Lazy rescheduling */<br />&gt; +#endif<br />&gt; +#define TIF_SINGLESTEP 5 /* reenable singlestep on user return*/<br />&gt; +#define TIF_SSBD 6 /* Speculative store bypass disable */<br /><br />It's a bit awkward/ugly to conditionally define the TIF_* bits in arch code,<br />and we don't do that for other bits that are only used in some configurations<br />(e.g. TIF_UPROBE). That's not just for aesthetics -- for example, on arm64 we<br />try to keep the TIF_WORK_MASK bits contiguous, which is difficult if a bit in<br />the middle doesn't exist in some configurations.<br /><br />Is it painful to organise the common code so that arch code can define<br />TIF_NEED_RESCHED_LAZY regardless of whether CONFIG_PREEMPT_AUTO is selected?<br /><br />Mark.<br /><br />&gt; #define TIF_SPEC_IB 9 /* Indirect branch speculation mitigation */<br />&gt; #define TIF_SPEC_L1D_FLUSH 10 /* Flush L1D on mm switches (processes) */<br />&gt; #define TIF_USER_RETURN_NOTIFY 11 /* notify kernel of userspace return */<br />&gt; &#64;&#64; -104,6 +107,9 &#64;&#64; struct thread_info {<br />&gt; #define _TIF_NOTIFY_RESUME (1 &lt;&lt; TIF_NOTIFY_RESUME)<br />&gt; #define _TIF_SIGPENDING (1 &lt;&lt; TIF_SIGPENDING)<br />&gt; #define _TIF_NEED_RESCHED (1 &lt;&lt; TIF_NEED_RESCHED)<br />&gt; +#ifdef CONFIG_PREEMPT_AUTO<br />&gt; +#define _TIF_NEED_RESCHED_LAZY (1 &lt;&lt; TIF_NEED_RESCHED_LAZY)<br />&gt; +#endif<br />&gt; #define _TIF_SINGLESTEP (1 &lt;&lt; TIF_SINGLESTEP)<br />&gt; #define _TIF_SSBD (1 &lt;&lt; TIF_SSBD)<br />&gt; #define _TIF_SPEC_IB (1 &lt;&lt; TIF_SPEC_IB)<br />&gt; -- <br />&gt; 2.31.1<br />&gt; <br /><br /></pre></td><td width="32" rowspan="2" class="c" valign="top"><img src="/images/icornerr.gif" width="32" height="32" alt="\" /></td></tr><tr><td align="right" valign="bottom"> 聽 </td></tr><tr><td align="right" valign="bottom">聽</td><td class="c" valign="bottom" style="padding-bottom: 0px"><img src="/images/bcornerl.gif" width="32" height="32" alt="\" /></td><td class="c">聽</td><td class="c" valign="bottom" style="padding-bottom: 0px"><img src="/images/bcornerr.gif" width="32" height="32" alt="/" /></td></tr><tr><td align="right" valign="top" colspan="2"> 聽 </td><td class="lm">Last update: 2024-05-27 15:02 聽聽 [from the cache]<br />漏2003-2020 <a href="http://blog.jasper.es/"><span itemprop="editor">Jasper Spaans</span></a>|hosted at <a href="https://www.digitalocean.com/?refcode=9a8e99d24cf9">Digital Ocean</a> and my Meterkast|<a href="http://blog.jasper.es/categories.html#lkml-ref">Read the blog</a></td><td>聽</td></tr></table><script language="javascript" src="/js/styleswitcher.js" type="text/javascript"></script></body></html>

Pages: 1 2 3 4 5 6 7 8 9 10