From: "Jan Beulich" Subject: Re: [PATCH RFC v2 1/4] x86/mm: Shadow and p2m changes for PV mem_access Date: Tue, 26 Aug 2014 08:12:08 +0100 Message-ID: <53FC4F68020000780002D74B@mail.emea.novell.com> References: <1404787805-4540-1-git-send-email-aravindp@cisco.com> <53D60EA002000078000265FC@mail.emea.novell.com> <97A500D504438F4ABC02EBA81613CC633188EC46@xmb-aln-x02.cisco.com> <53D8B6AC0200007800027844@mail.emea.novell.com> <97A500D504438F4ABC02EBA81613CC633188EF44@xmb-aln-x02.cisco.com> <53DB52380200007800028448@mail.emea.novell.com> <97A500D504438F4ABC02EBA81613CC633188FBD7@xmb-aln-x02.cisco.com> <53DF4C6B0200007800028CA5@mail.emea.novell.com> <97A500D504438F4ABC02EBA81613CC63318A2DBD@xmb-rcd-x02.cisco.com> <53E096C902000078000294A2@mail.emea.novell.com> <97A500D504438F4ABC02EBA81613CC63318E00F6@xmb-aln-x02.cisco.com> <53F77EEC020000780002CC3E@mail.emea.novell.com> <97A500D504438F4ABC02EBA81613CC63318E04E7@xmb-aln-x02.cisco.com> <53F798D9.9090800@citrix.com> <97A500D504438F4ABC02EBA81613CC63318E057E@xmb-aln-x02.cisco.com> <53F7A1C3.3060007@citrix.com> <53FB02E8020000780002D09B@mail.emea.novell.com> <53FB30D0.1010906@citrix.com> <53FB5196020000780002D3F7@mail.emea.novell.com> <53FB75EE.4070904@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XMAvL-0000ne-KV for xen-devel@lists.xenproject.org; Tue, 26 Aug 2014 07:12:11 +0000 In-Reply-To: <53FB75EE.4070904@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: Keir Fraser , Ian Campbell , Ian Jackson , Tim Deegan , "Aravindh Puthiyaparambil (aravindp)" , "xen-devel@lists.xenproject.org" List-Id: xen-devel@lists.xenproject.org >>> On 25.08.14 at 19:44, wrote: > On 25/08/14 14:09, Jan Beulich wrote: >>>>> On 25.08.14 at 14:49, wrote: >>> On 25/08/14 08:33, Jan Beulich wrote: >>>>>>> On 22.08.14 at 22:02, wrote: >>>>> On 22/08/14 20:48, Aravindh Puthiyaparambil (aravindp) wrote: >>>>>> Sigh, if only I could bound the CR0.WP solution :-( >>>>> I wonder whether, in the case that mem_access is enabled, it would be >>>>> reasonable to perform the CR0.WP sections with interrupts disabled? >>>> Which still wouldn't cover NMIs (albeit we might be able to live with >>>> that). >>> NMIs and MCEs are short, possibly raise softirqs, or call panic(). We >>> have much larger problems in general if the lack of CR0.WP would >>> adversely affect the NMI or MCE paths. >> I agree for MCEs, but NMIs don't necessarily mean severe problems. > > Indeed - NMIs are not necessarily severe problems, but the handlers are > very specifically short and touch very little. There is no reason for > the NMI handler to ever touch data which might be mapped read-only. > > Furthermore, as soon as you take a fault in the NMI handler, we are back > into re-entrant NMI territory (which I still havn't gotten around to > fixing) which will certainly cause irreparable problems for Xen. And possibly isn't even worth fixing: We should just make sure NMIs are what they're supposed to be - non-reentrant. >>>> But what's worse - taking faults with interrupts disabled >>>> requires extra care, and annotating code normally run with >>>> interrupts enabled with the special .ex_table.pre annotations >>>> doesn't seem like a very nice route, as that could easily hide other >>>> problems in the future. >>> Does it? In exception_with_ints_disabled, if the .ex_table.pre search >>> fails, we jump back into the regular handler after the sti label and >>> continue with the regular handler. >>> >>> This requires no more careful handling than existing constructs such as >>> wrmsr_safe() inside a spinlock_irq{,save}() region. >> Oh, indeed. Which points out that one shouldn't >> - use the same numeric label twice in a row, and even inside the >> same function >> - jump to a numeric label across one or more non-numeric ones > > I am sorry, but I don't follow this train of logic. Has it got > something to do with the subsections used to generate the .ex_table > redirection information? No, simply with the confusion such use of numeric labels causes. They should - afaic - be limited to strictly local code regions (not crossing non-numeric labels), and be strictly distinct (not using the same number twice within the same local code region). Jan