<?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>topic Or maybe implement the NMI in Software Tuning, Performance Optimization &amp; Platform Monitoring</title>
    <link>https://community.intel.com/t5/Software-Tuning-Performance/Generate-NMI-from-PMI/m-p/1156208#M6940</link>
    <description>&lt;BLOCKQUOTE&gt;
	&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;Or maybe implement the NMI handler (vector 2) as my handler, put a bogus 16 &amp;lt; value &amp;lt; 255 into the vector field and set delivery method to NMI?&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;I got this option to work, but value can even be in the &amp;lt; 16 range and still trigger the NMI. This doesn't make sense to me because&amp;nbsp;(vol. 3A 10-15) clearly says:&lt;/SPAN&gt;&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
	&lt;P&gt;&lt;SPAN style="font-family: Verdana; font-size: 9pt;"&gt;Bit 6: Receive Illegal Vector.&lt;/SPAN&gt;&lt;/P&gt;

	&lt;P&gt;&lt;SPAN style="font-family: Verdana; font-size: 9pt;"&gt;Set when the local APIC detects an illegal vector (one in the range 0 to 15) in an interrupt message it receives or in an interrupt generated locally from the local vector table or via a self IPI. Such interrupts are not delivered to the processor; the local APIC will never set an IRR bit in the range 0 to 15.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;&lt;FONT face="Verdana"&gt;&lt;SPAN style="font-size: 12px;"&gt;Which, since the APIC is generating the vector from it's LVT, I would think would prevent delivering the interrupt to the processor. If anyone can shed light on this, or if I missed some technique that allows the programmer to run an arbitrary handler while being delivered as a NMI, I would appreciate any input.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;FONT face="Verdana"&gt;&lt;SPAN style="font-size: 12px;"&gt;Best&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;

&lt;DIV class="page" title="Page 3035"&gt;
	&lt;DIV class="layoutArea"&gt;
		&lt;DIV class="column"&gt;
			&lt;UL style="list-style-type: none"&gt;
				&lt;LI&gt;&amp;nbsp;&lt;/LI&gt;
			&lt;/UL&gt;
		&lt;/DIV&gt;
	&lt;/DIV&gt;
&lt;/DIV&gt;</description>
    <pubDate>Tue, 14 Nov 2017 02:22:08 GMT</pubDate>
    <dc:creator>Tommy_U_</dc:creator>
    <dc:date>2017-11-14T02:22:08Z</dc:date>
    <item>
      <title>Generate NMI from PMI</title>
      <link>https://community.intel.com/t5/Software-Tuning-Performance/Generate-NMI-from-PMI/m-p/1156207#M6939</link>
      <description>&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;I wonder if you can help this novice reconcile a few threads and get PMIs firing.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 1em;"&gt;I'm trying to generate an interrupt after retiring N instructions in an experimental operating system where maskable interrupts are masked off (EFLAGS.IF = 0). It looks like the way to do this is by overflowing a PMC which generates a PMI which can be used to trigger a NMI depending on how the LVT is configured. I found a number of posts helpful including this one:&amp;nbsp;&lt;A href="https://software.intel.com/en-us/forums/software-tuning-performance-optimization-platform-monitoring/topic/606352"&gt;https://software.intel.com/en-us/forums/software-tuning-performance-optimization-platform-monitoring/topic/606352&lt;/A&gt;.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;What I've been reading:&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;A PMI is delivered via the local APIC (vol. 3a 10-1 &amp;amp; vol. 3b 18.15.5.8), which is considered an external hardware interrupt (vol. 3a 6.3.1). Maskable hardware interrupts include interrupts delivered to the processor via the local APIC(vol 3a 6.3.2). Specifically, the local APIC can ONLY send interrupt request vectors in the range 16-255 (&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.008px;"&gt;vol. 3A 10-15)&lt;/SPAN&gt;&lt;SPAN style="font-size: 1em;"&gt;.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P style="font-size: 13.008px;"&gt;But this is refined by the NMI (vol. 3a 6.8.1):&lt;/P&gt;

&lt;DIV class="page" style="font-size: 13.008px;" title="Page 2852"&gt;
	&lt;DIV class="layoutArea"&gt;
		&lt;DIV class="column"&gt;
			&lt;BLOCKQUOTE&gt;
				&lt;P&gt;&lt;SPAN style="font-size: 9pt; font-family: Verdana;"&gt;The IF flag does not affect non-maskable interrupts (NMIs) delivered to the NMI pin or delivery mode NMI messages delivered through the local APIC, nor does it affect processor generated exceptions.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
			&lt;/BLOCKQUOTE&gt;

			&lt;P&gt;I'm struggling to understand the note here that "&lt;SPAN style="font-size: 13.008px;"&gt;The PMI is always non-maskable.&lt;/SPAN&gt;"&amp;nbsp;&lt;A href="https://software.intel.com/en-us/forums/software-tuning-performance-optimization-platform-monitoring/topic/746157" style="font-size: 13.008px;"&gt;https://software.intel.com/en-us/forums/software-tuning-performance-optimization-platform-monitoring/topic/746157&lt;/A&gt;&lt;SPAN style="font-size: 13.008px;"&gt;. It seems to me that the PMI is only maskable if the local vector table entry (vol. 3a 10.5.1) chooses NMI as the delivery mode.&lt;/SPAN&gt;&lt;/P&gt;

			&lt;P&gt;&lt;SPAN style="font-size: 13.008px;"&gt;Assuming I configured the fixed PMC for retired instructions correctly (I am seeing bit 32 set in the IA32_PERF_GLOBAL_STATUS flip on), and that I'm using x2APIC mode, would if be correct to simply: &lt;/SPAN&gt;&lt;/P&gt;

			&lt;P&gt;&lt;SPAN style="font-size: 13.008px;"&gt;1) write a handler and insert it in the IDT (as element 32 - 255), &lt;/SPAN&gt;&lt;/P&gt;

			&lt;P&gt;&lt;SPAN style="font-size: 13.008px;"&gt;2) set the LVT entry corresponding to a performance monitoring overflow (0x834 in MSR space) to that vector established in 1) then set the delivery mode to NMI?&lt;/SPAN&gt;&lt;/P&gt;

			&lt;P&gt;&amp;nbsp;&lt;/P&gt;

			&lt;P&gt;&lt;SPAN style="font-size: 13.008px;"&gt;Or maybe implement the NMI handler (vector 2) as my handler, put a bogus 16 &amp;lt; value &amp;lt; 255 into the vector field and set delivery method to NMI?&lt;/SPAN&gt;&lt;/P&gt;

			&lt;P&gt;I hope this question makes sense; I'm happy to clarify any part. Thanks.&lt;/P&gt;
		&lt;/DIV&gt;
	&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 13 Nov 2017 22:54:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Tuning-Performance/Generate-NMI-from-PMI/m-p/1156207#M6939</guid>
      <dc:creator>Tommy_U_</dc:creator>
      <dc:date>2017-11-13T22:54:50Z</dc:date>
    </item>
    <item>
      <title>Or maybe implement the NMI</title>
      <link>https://community.intel.com/t5/Software-Tuning-Performance/Generate-NMI-from-PMI/m-p/1156208#M6940</link>
      <description>&lt;BLOCKQUOTE&gt;
	&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;Or maybe implement the NMI handler (vector 2) as my handler, put a bogus 16 &amp;lt; value &amp;lt; 255 into the vector field and set delivery method to NMI?&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;I got this option to work, but value can even be in the &amp;lt; 16 range and still trigger the NMI. This doesn't make sense to me because&amp;nbsp;(vol. 3A 10-15) clearly says:&lt;/SPAN&gt;&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
	&lt;P&gt;&lt;SPAN style="font-family: Verdana; font-size: 9pt;"&gt;Bit 6: Receive Illegal Vector.&lt;/SPAN&gt;&lt;/P&gt;

	&lt;P&gt;&lt;SPAN style="font-family: Verdana; font-size: 9pt;"&gt;Set when the local APIC detects an illegal vector (one in the range 0 to 15) in an interrupt message it receives or in an interrupt generated locally from the local vector table or via a self IPI. Such interrupts are not delivered to the processor; the local APIC will never set an IRR bit in the range 0 to 15.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;&lt;FONT face="Verdana"&gt;&lt;SPAN style="font-size: 12px;"&gt;Which, since the APIC is generating the vector from it's LVT, I would think would prevent delivering the interrupt to the processor. If anyone can shed light on this, or if I missed some technique that allows the programmer to run an arbitrary handler while being delivered as a NMI, I would appreciate any input.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;FONT face="Verdana"&gt;&lt;SPAN style="font-size: 12px;"&gt;Best&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;

&lt;DIV class="page" title="Page 3035"&gt;
	&lt;DIV class="layoutArea"&gt;
		&lt;DIV class="column"&gt;
			&lt;UL style="list-style-type: none"&gt;
				&lt;LI&gt;&amp;nbsp;&lt;/LI&gt;
			&lt;/UL&gt;
		&lt;/DIV&gt;
	&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 14 Nov 2017 02:22:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Tuning-Performance/Generate-NMI-from-PMI/m-p/1156208#M6940</guid>
      <dc:creator>Tommy_U_</dc:creator>
      <dc:date>2017-11-14T02:22:08Z</dc:date>
    </item>
  </channel>
</rss>

