<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>sujet Determining wake up reason for MWAIT dans Intel® ISA Extensions</title>
    <link>https://community.intel.com/t5/Intel-ISA-Extensions/Determining-wake-up-reason-for-MWAIT/m-p/1128203#M6253</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I'm trying to figure out how can one check what is the reason for the MWAIT to wakeup.&lt;/P&gt;

&lt;P&gt;I know there are several reasons for MWAIT to wakeup, including a write to the monitored address (of course, and to rule out this specific reason is obvious), interrupts, faults and signals.&lt;/P&gt;

&lt;P&gt;What I'm trying to figure out exactly is how can you know which FAULT/INTERRUPT/SIGNAL woke you up?&lt;/P&gt;

&lt;P&gt;It is not written in the manuals or anything.&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Thu, 13 Sep 2018 09:21:33 GMT</pubDate>
    <dc:creator>AG__Phillip</dc:creator>
    <dc:date>2018-09-13T09:21:33Z</dc:date>
    <item>
      <title>Determining wake up reason for MWAIT</title>
      <link>https://community.intel.com/t5/Intel-ISA-Extensions/Determining-wake-up-reason-for-MWAIT/m-p/1128203#M6253</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I'm trying to figure out how can one check what is the reason for the MWAIT to wakeup.&lt;/P&gt;

&lt;P&gt;I know there are several reasons for MWAIT to wakeup, including a write to the monitored address (of course, and to rule out this specific reason is obvious), interrupts, faults and signals.&lt;/P&gt;

&lt;P&gt;What I'm trying to figure out exactly is how can you know which FAULT/INTERRUPT/SIGNAL woke you up?&lt;/P&gt;

&lt;P&gt;It is not written in the manuals or anything.&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2018 09:21:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-ISA-Extensions/Determining-wake-up-reason-for-MWAIT/m-p/1128203#M6253</guid>
      <dc:creator>AG__Phillip</dc:creator>
      <dc:date>2018-09-13T09:21:33Z</dc:date>
    </item>
    <item>
      <title>What I'm trying to figure out</title>
      <link>https://community.intel.com/t5/Intel-ISA-Extensions/Determining-wake-up-reason-for-MWAIT/m-p/1128204#M6254</link>
      <description>&lt;BLOCKQUOTE&gt;
	&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;What I'm trying to figure out exactly is how can you know which FAULT/INTERRUPT/SIGNAL woke you up?&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;There is no way to discover this. I&amp;nbsp;&lt;EM&gt;think&amp;nbsp;&lt;/EM&gt;the problem here is that your mental model of how mwait is used is wrong. Mwait is not a communication mechanism, it doesn't ever tell you that some condition on which you wanted to wait has occurred. Rather, it is a way of sleeping efficiently that will wake up at a time when it's likely that it's worth checking the condition. So you should think of mwait finishing as a suggestion that you should check the condition your're waiting for, not as a guarantee that the condition is true.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;Therefore code using mwait looks something like this&lt;/SPAN&gt;&lt;/P&gt;

&lt;DIV&gt;
	&lt;PRE class="brush:cpp; class-name:dark;"&gt;// Wait for *target to be non-zero
static void mwaitForNonZero(uint32_t volatile * target)
{
    while (*target == 0)
    {
	_mm_monitor ((void *)target, 0, 0);
	if (*target != 0)  /* Avoid race if *target changes after the while but before the monitor */
	    break;
	_mm_mwait (0, 0);
    }
}
&lt;/PRE&gt;
&lt;/DIV&gt;

&lt;BLOCKQUOTE&gt;
	&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Fri, 14 Sep 2018 08:44:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-ISA-Extensions/Determining-wake-up-reason-for-MWAIT/m-p/1128204#M6254</guid>
      <dc:creator>James_C_Intel2</dc:creator>
      <dc:date>2018-09-14T08:44:35Z</dc:date>
    </item>
  </channel>
</rss>

