€•߇Œsphinx.addnodes”Œdocument”“”)�”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)�”}”(hhh]”(hŒ pending_xref”“”)�”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…”�”}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ&/translations/zh_CN/userspace-api/rseq”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)�”}”(hhh]”hŒChinese (Traditional)”…”�”}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ&/translations/zh_TW/userspace-api/rseq”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒItalian”…”�”}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ&/translations/it_IT/userspace-api/rseq”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒJapanese”…”�”}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ&/translations/ja_JP/userspace-api/rseq”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒKorean”…”�”}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ&/translations/ko_KR/userspace-api/rseq”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒPortuguese (Brazilian)”…”�”}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ&/translations/pt_BR/userspace-api/rseq”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒSpanish”…”�”}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ&/translations/sp_SP/userspace-api/rseq”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒsection”“”)�”}”(hhh]”(hŒtitle”“”)�”}”(hŒRestartable Sequences”h]”hŒRestartable Sequences”…”�”}”(hh¼h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhh·h²hh³Œ@/var/lib/git/docbuild/linux/Documentation/userspace-api/rseq.rst”h´KubhŒ paragraph”“”)�”}”(hŒ�Restartable Sequences allow to register a per thread userspace memory area to be used as an ABI between kernel and userspace for three purposes:”h]”hŒ�Restartable Sequences allow to register a per thread userspace memory area to be used as an ABI between kernel and userspace for three purposes:”…”�”}”(hhÍh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khh·h²hubhŒ block_quote”“”)�”}”(hŒŒ* userspace restartable sequences * quick access to read the current CPU number, node ID from userspace * scheduler time slice extensions ”h]”hŒ bullet_list”“”)�”}”(hhh]”(hŒ list_item”“”)�”}”(hŒ userspace restartable sequences ”h]”hÌ)�”}”(hŒuserspace restartable sequences”h]”hŒuserspace restartable sequences”…”�”}”(hhìh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khhèubah}”(h]”h ]”h"]”h$]”h&]”uh1hæhhãubhç)�”}”(hŒDquick access to read the current CPU number, node ID from userspace ”h]”hÌ)�”}”(hŒCquick access to read the current CPU number, node ID from userspace”h]”hŒCquick access to read the current CPU number, node ID from userspace”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K hjubah}”(h]”h ]”h"]”h$]”h&]”uh1hæhhãubhç)�”}”(hŒ scheduler time slice extensions ”h]”hÌ)�”}”(hŒscheduler time slice extensions”h]”hŒscheduler time slice extensions”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K hjubah}”(h]”h ]”h"]”h$]”h&]”uh1hæhhãubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ*”uh1háh³hÊh´KhhÝubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛh³hÊh´Khh·h²hubh¶)�”}”(hhh]”(h»)�”}”(hŒ'Restartable sequences (per-cpu atomics)”h]”hŒ'Restartable sequences (per-cpu atomics)”…”�”}”(hjAh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj>h²hh³hÊh´KubhÌ)�”}”(hŒÍRestartable sequences allow userspace to perform update operations on per-cpu data without requiring heavyweight atomic operations. The actual ABI is unfortunately only available in the code and selftests.”h]”hŒÍRestartable sequences allow userspace to perform update operations on per-cpu data without requiring heavyweight atomic operations. The actual ABI is unfortunately only available in the code and selftests.”…”�”}”(hjOh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khj>h²hubeh}”(h]”Œ%restartable-sequences-per-cpu-atomics”ah ]”h"]”Œ'restartable sequences (per-cpu atomics)”ah$]”h&]”uh1hµhh·h²hh³hÊh´Kubh¶)�”}”(hhh]”(h»)�”}”(hŒ#Quick access to CPU number, node ID”h]”hŒ#Quick access to CPU number, node ID”…”�”}”(hjhh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjeh²hh³hÊh´KubhÌ)�”}”(hŒXAllows to implement per CPU data efficiently. Documentation is in code and selftests. :(”h]”hŒXAllows to implement per CPU data efficiently. Documentation is in code and selftests. :(”…”�”}”(hjvh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khjeh²hubeh}”(h]”Œ"quick-access-to-cpu-number-node-id”ah ]”h"]”Œ#quick access to cpu number, node id”ah$]”h&]”uh1hµhh·h²hh³hÊh´Kubh¶)�”}”(hhh]”(h»)�”}”(hŒOptimized RSEQ V2”h]”hŒOptimized RSEQ V2”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjŒh²hh³hÊh´KubhÌ)�”}”(hŒÈOn architectures which utilize the generic entry code and generic TIF bits the kernel supports runtime optimizations for RSEQ, which also enable enhanced features like scheduler time slice extensions.”h]”hŒÈOn architectures which utilize the generic entry code and generic TIF bits the kernel supports runtime optimizations for RSEQ, which also enable enhanced features like scheduler time slice extensions.”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KhjŒh²hubhÌ)�”}”(hŒ}To enable them a task has to register the RSEQ region with at least the length advertised by getauxval(AT_RSEQ_FEATURE_SIZE).”h]”hŒ}To enable them a task has to register the RSEQ region with at least the length advertised by getauxval(AT_RSEQ_FEATURE_SIZE).”…”�”}”(hj«h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K"hjŒh²hubhÌ)�”}”(hŒÙIf existing binaries register with RSEQ_ORIG_SIZE (32 bytes), the kernel keeps the legacy low performance mode enabled to fulfil the expectations of existing users regarding the original RSEQ implementation behaviour.”h]”hŒÙIf existing binaries register with RSEQ_ORIG_SIZE (32 bytes), the kernel keeps the legacy low performance mode enabled to fulfil the expectations of existing users regarding the original RSEQ implementation behaviour.”…”�”}”(hj¹h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K%hjŒh²hubhÌ)�”}”(hŒhThe following table documents the ABI and behavioral guarantees of the legacy and the optimized V2 mode.”h]”hŒhThe following table documents the ABI and behavioral guarantees of the legacy and the optimized V2 mode.”…”�”}”(hjÇh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K)hjŒh²hubhŒtable”“”)�”}”(hhh]”(h»)�”}”(hŒ RSEQ modes”h]”hŒ RSEQ modes”…”�”}”(hjÚh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºh³hÊh´K,hj×ubhŒtgroup”“”)�”}”(hhh]”(hŒcolspec”“”)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jíhjêubjî)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”jøKuh1jíhjêubjî)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”jøKuh1jíhjêubjî)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”jøKuh1jíhjêubhŒthead”“”)�”}”(hhh]”hŒrow”“”)�”}”(hhh]”(hŒentry”“”)�”}”(hhh]”hÌ)�”}”(hŒNr”h]”hŒNr”…”�”}”(hj#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K/hj ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjubj)�”}”(hhh]”hÌ)�”}”(hŒWhat”h]”hŒWhat”…”�”}”(hj:h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K0hj7ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjubj)�”}”(hhh]”hÌ)�”}”(hŒLegacy”h]”hŒLegacy”…”�”}”(hjQh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K2hjNubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjubj)�”}”(hhh]”hÌ)�”}”(hŒ Optimized V2”h]”hŒ Optimized V2”…”�”}”(hjhh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K3hjeubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjêubhŒtbody”“”)�”}”(hhh]”(j)�”}”(hhh]”(j)�”}”(hhh]”hÌ)�”}”(hŒ1”h]”hŒ1”…”�”}”(hj“h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K5hj�ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj�ubj)�”}”(hhh]”hÌ)�”}”(hŒSThe cpu_id_start, cpu_id, node_id and mm_cid fields (User mode read only) .. Legacy”h]”hŒSThe cpu_id_start, cpu_id, node_id and mm_cid fields (User mode read only) .. Legacy”…”�”}”(hjªh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K6hj§ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj�ubj)�”}”(hhh]”hÌ)�”}”(hŒjUpdated by the kernel unconditionally after each context switch and before signal delivery .. Optimized V2”h]”hŒjUpdated by the kernel unconditionally after each context switch and before signal delivery .. Optimized V2”…”�”}”(hjÁh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K9hj¾ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj�ubj)�”}”(hhh]”hÌ)�”}”(hŒ`Updated by the kernel if and only if they change, i.e. if the task is migrated or mm_cid changes”h]”hŒ`Updated by the kernel if and only if they change, i.e. if the task is migrated or mm_cid changes”…”�”}”(hjØh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Kh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K_hj;ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj!ubj)�”}”(hhh]”hÌ)�”}”(hŒNot supported .. Optimized V2”h]”hŒNot supported .. Optimized V2”…”�”}”(hjUh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KahjRubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj!ubj)�”}”(hhh]”hÌ)�”}”(hŒ Supported”h]”hŒ Supported”…”�”}”(hjlh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Kchjiubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj!ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhjŠubeh}”(h]”h ]”h"]”h$]”h&]”uh1jˆhjêubeh}”(h]”h ]”h"]”h$]”h&]”Œcols”Kuh1jèhj×ubeh}”(h]”Œid1”ah ]”h"]”h$]”h&]”uh1jÕhjŒh²hh³Nh´NubhÌ)�”}”(hXòThe legacy mode is obviously less performant as it does unconditional updates and critical section checks even if not strictly required by the ABI contract. That can't be changed anymore as some users depend on that observed behavior, which in turn enables them to violate the ABI and overwrite the cpu_id_start field for their own purposes. This is obviously discouraged as it renders RSEQ incompatible with the intended usage and breaks the expectation of other libraries in the same application.”h]”hXôThe legacy mode is obviously less performant as it does unconditional updates and critical section checks even if not strictly required by the ABI contract. That can’t be changed anymore as some users depend on that observed behavior, which in turn enables them to violate the ABI and overwrite the cpu_id_start field for their own purposes. This is obviously discouraged as it renders RSEQ incompatible with the intended usage and breaks the expectation of other libraries in the same application.”…”�”}”(hjšh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KehjŒh²hubhÌ)�”}”(hXðThe ABI compliant optimized v2 mode, which respects the read only fields, does not require unconditional updates and therefore is way more performant. The kernel validates the read only fields for compliance. If user space modifies them, the process is killed. Compliant usage allows multiple libraries in the same application to benefit from the RSEQ functionality without disturbing each other. The ABI compliant optimized v2 mode also enables extended RSEQ features like time slice extensions.”h]”hXðThe ABI compliant optimized v2 mode, which respects the read only fields, does not require unconditional updates and therefore is way more performant. The kernel validates the read only fields for compliance. If user space modifies them, the process is killed. Compliant usage allows multiple libraries in the same application to benefit from the RSEQ functionality without disturbing each other. The ABI compliant optimized v2 mode also enables extended RSEQ features like time slice extensions.”…”�”}”(hj¨h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KmhjŒh²hubeh}”(h]”Œoptimized-rseq-v2”ah ]”h"]”Œoptimized rseq v2”ah$]”h&]”uh1hµhh·h²hh³hÊh´Kubh¶)�”}”(hhh]”(h»)�”}”(hŒScheduler time slice extensions”h]”hŒScheduler time slice extensions”…”�”}”(hjÁh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj¾h²hh³hÊh´KwubhÌ)�”}”(hŒ»This allows a thread to request a time slice extension when it enters a critical section to avoid contention on a resource when the thread is scheduled out inside of the critical section.”h]”hŒ»This allows a thread to request a time slice extension when it enters a critical section to avoid contention on a resource when the thread is scheduled out inside of the critical section.”…”�”}”(hjÏh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Kyhj¾h²hubhÌ)�”}”(hŒ-The prerequisites for this functionality are:”h]”hŒ-The prerequisites for this functionality are:”…”�”}”(hjÝh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K}hj¾h²hubhÜ)�”}”(hŒ˜* Enabled in Kconfig * Enabled at boot time (default is enabled) * A rseq userspace pointer has been registered for the thread in optimized V2 mode ”h]”hâ)�”}”(hhh]”(hç)�”}”(hŒEnabled in Kconfig ”h]”hÌ)�”}”(hŒEnabled in Kconfig”h]”hŒEnabled in Kconfig”…”�”}”(hjöh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khjòubah}”(h]”h ]”h"]”h$]”h&]”uh1hæhjïubhç)�”}”(hŒ*Enabled at boot time (default is enabled) ”h]”hÌ)�”}”(hŒ)Enabled at boot time (default is enabled)”h]”hŒ)Enabled at boot time (default is enabled)”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K�hj ubah}”(h]”h ]”h"]”h$]”h&]”uh1hæhjïubhç)�”}”(hŒQA rseq userspace pointer has been registered for the thread in optimized V2 mode ”h]”hÌ)�”}”(hŒPA rseq userspace pointer has been registered for the thread in optimized V2 mode”h]”hŒPA rseq userspace pointer has been registered for the thread in optimized V2 mode”…”�”}”(hj&h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Kƒhj"ubah}”(h]”h ]”h"]”h$]”h&]”uh1hæhjïubeh}”(h]”h ]”h"]”h$]”h&]”j6j7uh1háh³hÊh´Khjëubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛh³hÊh´Khj¾h²hubhÌ)�”}”(hŒ9The thread has to enable the functionality via prctl(2)::”h]”hŒ8The thread has to enable the functionality via prctl(2):”…”�”}”(hjFh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K†hj¾h²hubhŒ literal_block”“”)�”}”(hŒbprctl(PR_RSEQ_SLICE_EXTENSION, PR_RSEQ_SLICE_EXTENSION_SET, PR_RSEQ_SLICE_EXT_ENABLE, 0, 0);”h]”hŒbprctl(PR_RSEQ_SLICE_EXTENSION, PR_RSEQ_SLICE_EXTENSION_SET, PR_RSEQ_SLICE_EXT_ENABLE, 0, 0);”…”�”}”hjVsbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1jTh³hÊh´Kˆhj¾h²hubhÌ)�”}”(hŒIprctl() returns 0 on success or otherwise with the following error codes:”h]”hŒIprctl() returns 0 on success or otherwise with the following error codes:”…”�”}”(hjfh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K‹hj¾h²hubjÖ)�”}”(hhh]”jé)�”}”(hhh]”(jî)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”K uh1jíhjwubjî)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”K>uh1jíhjwubj)�”}”(hhh]”j)�”}”(hhh]”(j)�”}”(hhh]”hÌ)�”}”(hŒ Errorcode”h]”hŒ Errorcode”…”�”}”(hj—h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KŽhj”ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj‘ubj)�”}”(hhh]”hÌ)�”}”(hŒMeaning”h]”hŒMeaning”…”�”}”(hj®h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KŽhj«ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj‘ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhjŽubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjwubj‰)�”}”(hhh]”(j)�”}”(hhh]”(j)�”}”(hhh]”hÌ)�”}”(hŒEINVAL”h]”hŒEINVAL”…”�”}”(hj×h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K�hjÔubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÑubj)�”}”(hhh]”hÌ)�”}”(hŒ[Functionality not available or invalid function arguments. Note: arg4 and arg5 must be zero”h]”hŒ[Functionality not available or invalid function arguments. Note: arg4 and arg5 must be zero”…”�”}”(hjîh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K�hjëubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÑubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhjÎubj)�”}”(hhh]”(j)�”}”(hhh]”hÌ)�”}”(hŒENOTSUPP”h]”hŒENOTSUPP”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K’hj ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjubj)�”}”(hhh]”hÌ)�”}”(hŒ5Functionality was disabled on the kernel command line”h]”hŒ5Functionality was disabled on the kernel command line”…”�”}”(hj%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K’hj"ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhjÎubj)�”}”(hhh]”(j)�”}”(hhh]”hÌ)�”}”(hŒENXIO”h]”hŒENXIO”…”�”}”(hjEh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K“hjBubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj?ubj)�”}”(hhh]”hÌ)�”}”(hŒ-Available, but no rseq user struct registered”h]”hŒ-Available, but no rseq user struct registered”…”�”}”(hj\h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K“hjYubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj?ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhjÎubeh}”(h]”h ]”h"]”h$]”h&]”uh1jˆhjwubeh}”(h]”h ]”h"]”h$]”h&]”Œcols”Kuh1jèhjtubah}”(h]”h ]”h"]”h$]”h&]”uh1jÕhj¾h²hh³hÊh´NubhÌ)�”}”(hŒ,The state can be also queried via prctl(2)::”h]”hŒ+The state can be also queried via prctl(2):”…”�”}”(hj‰h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K–hj¾h²hubjU)�”}”(hŒEprctl(PR_RSEQ_SLICE_EXTENSION, PR_RSEQ_SLICE_EXTENSION_GET, 0, 0, 0);”h]”hŒEprctl(PR_RSEQ_SLICE_EXTENSION, PR_RSEQ_SLICE_EXTENSION_GET, 0, 0, 0);”…”�”}”hj—sbah}”(h]”h ]”h"]”h$]”h&]”jdjeuh1jTh³hÊh´K˜hj¾h²hubhÌ)�”}”(hŒ†prctl() returns ``PR_RSEQ_SLICE_EXT_ENABLE`` when it is enabled or 0 if disabled. Otherwise it returns with the following error codes:”h]”(hŒprctl() returns ”…”�”}”(hj¥h²hh³Nh´NubhŒliteral”“”)�”}”(hŒ``PR_RSEQ_SLICE_EXT_ENABLE``”h]”hŒPR_RSEQ_SLICE_EXT_ENABLE”…”�”}”(hj¯h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j­hj¥ubhŒZ when it is enabled or 0 if disabled. Otherwise it returns with the following error codes:”…”�”}”(hj¥h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Kšhj¾h²hubjÖ)�”}”(hhh]”jé)�”}”(hhh]”(jî)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”K uh1jíhjÊubjî)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”K>uh1jíhjÊubj)�”}”(hhh]”j)�”}”(hhh]”(j)�”}”(hhh]”hÌ)�”}”(hŒ Errorcode”h]”hŒ Errorcode”…”�”}”(hjêh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Kžhjçubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjäubj)�”}”(hhh]”hÌ)�”}”(hŒMeaning”h]”hŒMeaning”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Kžhjþubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjäubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhjáubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÊubj‰)�”}”(hhh]”j)�”}”(hhh]”(j)�”}”(hhh]”hÌ)�”}”(hŒEINVAL”h]”hŒEINVAL”…”�”}”(hj*h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K hj'ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj$ubj)�”}”(hhh]”hÌ)�”}”(hŒdFunctionality not available or invalid function arguments. Note: arg3 and arg4 and arg5 must be zero”h]”hŒdFunctionality not available or invalid function arguments. Note: arg3 and arg4 and arg5 must be zero”…”�”}”(hjAh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K hj>ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj$ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhj!ubah}”(h]”h ]”h"]”h$]”h&]”uh1jˆhjÊubeh}”(h]”h ]”h"]”h$]”h&]”Œcols”Kuh1jèhjÇubah}”(h]”h ]”h"]”h$]”h&]”uh1jÕhj¾h²hh³hÊh´NubhÌ)�”}”(hŒýThe availability and status is also exposed via the rseq ABI struct flags field via the ``RSEQ_CS_FLAG_SLICE_EXT_AVAILABLE_BIT`` and the ``RSEQ_CS_FLAG_SLICE_EXT_ENABLED_BIT``. These bits are read-only for user space and only for informational purposes.”h]”(hŒXThe availability and status is also exposed via the rseq ABI struct flags field via the ”…”�”}”(hjnh²hh³Nh´Nubj®)�”}”(hŒ(``RSEQ_CS_FLAG_SLICE_EXT_AVAILABLE_BIT``”h]”hŒ$RSEQ_CS_FLAG_SLICE_EXT_AVAILABLE_BIT”…”�”}”(hjvh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j­hjnubhŒ and the ”…”�”}”(hjnh²hh³Nh´Nubj®)�”}”(hŒ&``RSEQ_CS_FLAG_SLICE_EXT_ENABLED_BIT``”h]”hŒ"RSEQ_CS_FLAG_SLICE_EXT_ENABLED_BIT”…”�”}”(hjˆh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j­hjnubhŒN. These bits are read-only for user space and only for informational purposes.”…”�”}”(hjnh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K¤hj¾h²hubhÌ)�”}”(hX+If the mechanism was enabled via prctl(), the thread can request a time slice extension by setting rseq::slice_ctrl::request to 1. If the thread is interrupted and the interrupt results in a reschedule request in the kernel, then the kernel can grant a time slice extension and return to userspace instead of scheduling out. The length of the extension is determined by debugfs:rseq/slice_ext_nsec. The default value is 5 usec; which is the minimum value. It can be incremented to 50 usecs, however doing so can/will affect the minimum scheduling latency.”h]”hX+If the mechanism was enabled via prctl(), the thread can request a time slice extension by setting rseq::slice_ctrl::request to 1. If the thread is interrupted and the interrupt results in a reschedule request in the kernel, then the kernel can grant a time slice extension and return to userspace instead of scheduling out. The length of the extension is determined by debugfs:rseq/slice_ext_nsec. The default value is 5 usec; which is the minimum value. It can be incremented to 50 usecs, however doing so can/will affect the minimum scheduling latency.”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K©hj¾h²hubhÌ)�”}”(hŒ‰Any proposed changes to this default will have to come with a selftest and rseq-slice-hist.py output that shows the new value has merrit.”h]”hŒ‰Any proposed changes to this default will have to come with a selftest and rseq-slice-hist.py output that shows the new value has merrit.”…”�”}”(hj®h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K²hj¾h²hubhÌ)�”}”(hŒöThe kernel indicates the grant by clearing rseq::slice_ctrl::request and setting rseq::slice_ctrl::granted to 1. If there is a reschedule of the thread after granting the extension, the kernel clears the granted bit to indicate that to userspace.”h]”hŒöThe kernel indicates the grant by clearing rseq::slice_ctrl::request and setting rseq::slice_ctrl::granted to 1. If there is a reschedule of the thread after granting the extension, the kernel clears the granted bit to indicate that to userspace.”…”�”}”(hj¼h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Kµhj¾h²hubhÌ)�”}”(hŒkIf the request bit is still set when the leaving the critical section, userspace can clear it and continue.”h]”hŒkIf the request bit is still set when the leaving the critical section, userspace can clear it and continue.”…”�”}”(hjÊh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Kºhj¾h²hubhÌ)�”}”(hŒçIf the granted bit is set, then userspace invokes rseq_slice_yield(2) when leaving the critical section to relinquish the CPU. The kernel enforces this by arming a timer to prevent misbehaving userspace from abusing this mechanism.”h]”hŒçIf the granted bit is set, then userspace invokes rseq_slice_yield(2) when leaving the critical section to relinquish the CPU. The kernel enforces this by arming a timer to prevent misbehaving userspace from abusing this mechanism.”…”�”}”(hjØh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K½hj¾h²hubhÌ)�”}”(hŒµIf both the request bit and the granted bit are false when leaving the critical section, then this indicates that a grant was revoked and no further action is required by userspace.”h]”hŒµIf both the request bit and the granted bit are false when leaving the critical section, then this indicates that a grant was revoked and no further action is required by userspace.”…”�”}”(hjæh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KÂhj¾h²hubhÌ)�”}”(hŒ&The required code flow is as follows::”h]”hŒ%The required code flow is as follows:”…”�”}”(hjôh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KÆhj¾h²hubjU)�”}”(hŒÛrseq->slice_ctrl.request = 1; barrier(); // Prevent compiler reordering critical_section(); barrier(); // Prevent compiler reordering rseq->slice_ctrl.request = 0; if (rseq->slice_ctrl.granted) rseq_slice_yield();”h]”hŒÛrseq->slice_ctrl.request = 1; barrier(); // Prevent compiler reordering critical_section(); barrier(); // Prevent compiler reordering rseq->slice_ctrl.request = 0; if (rseq->slice_ctrl.granted) rseq_slice_yield();”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”jdjeuh1jTh³hÊh´KÈhj¾h²hubhÌ)�”}”(hŒ’As all of this is strictly CPU local, there are no atomicity requirements. Checking the granted state is racy, but that cannot be avoided at all::”h]”hŒ‘As all of this is strictly CPU local, there are no atomicity requirements. Checking the granted state is racy, but that cannot be avoided at all:”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KÐhj¾h²hubjU)�”}”(hŒmif (rseq->slice_ctrl.granted) -> Interrupt results in schedule and grant revocation rseq_slice_yield();”h]”hŒmif (rseq->slice_ctrl.granted) -> Interrupt results in schedule and grant revocation rseq_slice_yield();”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”jdjeuh1jTh³hÊh´KÓhj¾h²hubhÌ)�”}”(hŒTSo there is no point in pretending that this might be solved by an atomic operation.”h]”hŒTSo there is no point in pretending that this might be solved by an atomic operation.”…”�”}”(hj,h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K×hj¾h²hubhÌ)�”}”(hX†If the thread issues a syscall other than rseq_slice_yield(2) within the granted timeslice extension, the grant is also revoked and the CPU is relinquished immediately when entering the kernel. This is required as syscalls might consume arbitrary CPU time until they reach a scheduling point when the preemption model is either NONE or VOLUNTARY and therefore might exceed the grant by far.”h]”hX†If the thread issues a syscall other than rseq_slice_yield(2) within the granted timeslice extension, the grant is also revoked and the CPU is relinquished immediately when entering the kernel. This is required as syscalls might consume arbitrary CPU time until they reach a scheduling point when the preemption model is either NONE or VOLUNTARY and therefore might exceed the grant by far.”…”�”}”(hj:h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KÚhj¾h²hubhÌ)�”}”(hXOThe preferred solution for user space is to use rseq_slice_yield(2) which is side effect free. The support for arbitrary syscalls is required to support onion layer architectured applications, where the code handling the critical section and requesting the time slice extension has no control over the code within the critical section.”h]”hXOThe preferred solution for user space is to use rseq_slice_yield(2) which is side effect free. The support for arbitrary syscalls is required to support onion layer architectured applications, where the code handling the critical section and requesting the time slice extension has no control over the code within the critical section.”…”�”}”(hjHh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Káhj¾h²hubhÌ)�”}”(hŒfThe kernel enforces flag consistency and terminates the thread with SIGSEGV if it detects a violation.”h]”hŒfThe kernel enforces flag consistency and terminates the thread with SIGSEGV if it detects a violation.”…”�”}”(hjVh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Kçhj¾h²hubeh}”(h]”Œscheduler-time-slice-extensions”ah ]”h"]”Œscheduler time slice extensions”ah$]”h&]”uh1hµhh·h²hh³hÊh´Kwubeh}”(h]”Œrestartable-sequences”ah ]”h"]”Œrestartable sequences”ah$]”h&]”uh1hµhhh²hh³hÊh´Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hÊuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)�”}”(hºNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”jŒfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”j–Œerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hÊŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”(jqjnjbj_j‰j†j»j¸jijfuŒ nametypes”}”(jq‰jb‰j‰‰j»‰ji‰uh}”(jnh·j_j>j†jej¸jŒjfj¾j•j×uŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”j¤Ks…”R”Œparse_messages”]”Œtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nh²hub.