Aravind Menon
2005-Feb-01 02:06 UTC
[Xen-devel] Saving segment registers on interrupt / lost NMI
I was looking at the interrupt entry code in Xen, and noticed that segment registers get saved depending on the CPU level which was interrupted. Specifically, the ds, es, fs and gs registers are saved only if ring 1, 2 or 3 was interrupted, and not if ring 0 was interrupted. What is the motivation for this? It appears to me that this is responsible for sometimes causing "lost" NMI interrupts. Basically, if an NMI occurs when a Xen activation was saving or restoring these registers, the handler just returns without calling the NMI watchdog. Is this because it may not be possible to restore the segments otherwise? Can this be fixed by making the NMI handler always save all segment registers? "Losing" an NMI is problematic in the following scenario which I am considering: I want to use the NMI interrupt in conjunction with the hardware performance counters for statistical profiling. The hardware counters are programmed to generate an NMI at regular intervals, and the NMI handler collects PC samples for statistical profiling. Unfortunately, if the NMI is "lost", the profiling comes to a halt, because the hardware counters need to be restarted on each NMI. Thus, I need to make sure that no NMIs are lost. I would like to know if this problem can be solved by making sure that all interrupt handlers and the NMI handler save all segment registers on entry, and restore them on exit. Thanks. Aravind Menon Doctoral School EPFL, Switzerland ------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ Xen-devel mailing list Xen-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xen-devel
Ian Pratt
2005-Feb-01 16:24 UTC
RE: [Xen-devel] Saving segment registers on interrupt / lost NMI
This is fixed in the latest unstable tree. Best, Ian> I was looking at the interrupt entry code in Xen, and noticed > that segment > registers get saved depending on the CPU level which was interrupted. > Specifically, the ds, es, fs and gs registers are saved only > if ring 1, 2 or 3 > was interrupted, and not if ring 0 was interrupted. > > What is the motivation for this? > > It appears to me that this is responsible for sometimes > causing "lost" NMI > interrupts. Basically, if an NMI occurs when a Xen activation > was saving or > restoring these registers, the handler just returns without > calling the NMI > watchdog. Is this because it may not be possible to restore > the segments > otherwise? Can this be fixed by making the NMI handler always > save all segment > registers? > > "Losing" an NMI is problematic in the following scenario > which I am considering: > I want to use the NMI interrupt in conjunction with the > hardware performance > counters for statistical profiling. The hardware counters are > programmed to > generate an NMI at regular intervals, and the NMI handler > collects PC samples > for statistical profiling. > > Unfortunately, if the NMI is "lost", the profiling comes to a > halt, because the > hardware counters need to be restarted on each NMI. Thus, I > need to make sure > that no NMIs are lost. > > I would like to know if this problem can be solved by making > sure that all > interrupt handlers and the NMI handler save all segment > registers on entry, and > restore them on exit. > > Thanks. > > Aravind Menon > > Doctoral School > EPFL, Switzerland > > > > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IntelliVIEW -- Interactive > Reporting > Tool for open source databases. Create drag-&-drop reports. Save time > by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. > Download a FREE copy at http://www.intelliview.com/go/osdn_nl > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/xen-devel >------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ Xen-devel mailing list Xen-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xen-devel