xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Tim Deegan <tim@xen.org>, Keir Fraser <keir@xen.org>,
	Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH RFC 2/9] x86/traps: Make panic and reboot paths safe during early boot
Date: Thu, 15 May 2014 11:53:37 +0100	[thread overview]
Message-ID: <53749CB1.3010008@citrix.com> (raw)
In-Reply-To: <5374B0D00200007800012889@mail.emea.novell.com>

On 15/05/14 11:19, Jan Beulich wrote:
>>>> On 15.05.14 at 11:48, <andrew.cooper3@citrix.com> wrote:
>> Make use of SYS_STATE_smp_boot to help machine_{halt,restart}() know if/when
>> it is safe to enable interrupts and access the local apic to send IPIs.
>> Before system_state == SYS_STATE_smp_boot, we can be certain that only the BSP
>> is running.
> Hmm, tying SMP boot and IRQ enabling together seems a little
> problematic, even if on x86 the former happens soon after the latter
> right now. Perhaps these ought to be distinct states?

Which states would you suggest then?

The key problems I encountered were pagefaults before the LAPIC has its
mmio region mapped, and x2apic_enabled isn't correct until apic_init(),
risking a pagefault for the MMIO region and protection fault from the MSRs.

>
>> --- a/xen/arch/x86/mm.c
>> +++ b/xen/arch/x86/mm.c
>> @@ -5246,7 +5246,7 @@ static l3_pgentry_t *virt_to_xen_l3e(unsigned long v)
>>      pl4e = &idle_pg_table[l4_table_offset(v)];
>>      if ( !(l4e_get_flags(*pl4e) & _PAGE_PRESENT) )
>>      {
>> -        bool_t locking = system_state > SYS_STATE_boot;
>> +        bool_t locking = system_state >= SYS_STATE_active;
> Did you just mechanically adjust occurrences like this one, to (as the
> description says) have their semantics remain identical? I ask because
> it would seem to me that here you'd likely better change the semantics
> by keeping the code unchanged.
>
>> --- a/xen/common/symbols.c
>> +++ b/xen/common/symbols.c
>> @@ -96,7 +96,7 @@ static unsigned int get_symbol_offset(unsigned long pos)
>>  bool_t is_active_kernel_text(unsigned long addr)
>>  {
>>      return (is_kernel_text(addr) ||
>> -            (system_state == SYS_STATE_boot && is_kernel_inittext(addr)));
>> +            (system_state < SYS_STATE_active && is_kernel_inittext(addr)));
> And here, contrary to the description, you actually do a semantic
> (but correct!) change.
>
> Jan
>

I attempted to change each of them such that SYS_STATE_boot and
SYS_STATE_smp_boot acted the same, and that further insertions of new
states wouldn't require changes quite this wide.

~Andrew

  reply	other threads:[~2014-05-15 10:53 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-15  9:48 [PATCH RFC 0/9] x86: Improvements to trap handling Andrew Cooper
2014-05-15  9:48 ` [PATCH RFC 1/9] x86/traps: Names for system descriptor types Andrew Cooper
2014-05-15  9:56   ` Andrew Cooper
2014-05-15 10:08   ` Jan Beulich
2014-05-15 10:26     ` Andrew Cooper
2014-05-15 12:10       ` Jan Beulich
2014-05-15  9:48 ` [PATCH RFC 2/9] x86/traps: Make panic and reboot paths safe during early boot Andrew Cooper
2014-05-15 10:19   ` Jan Beulich
2014-05-15 10:53     ` Andrew Cooper [this message]
2014-05-15 12:12       ` Jan Beulich
2014-05-15 15:46         ` Andrew Cooper
2014-05-15 15:59           ` Jan Beulich
2014-05-15  9:48 ` [PATCH RFC 3/9] x86/traps: Make the main trap handlers safe for use early during Xen boot Andrew Cooper
2014-05-15 10:20   ` Jan Beulich
2014-05-15  9:48 ` [PATCH RFC 4/9] x86/misc: Early cleanup Andrew Cooper
2014-05-15 10:32   ` Jan Beulich
2014-05-15 10:38     ` Andrew Cooper
2014-05-15  9:48 ` [PATCH RFC 5/9] x86/traps: Functional prep work Andrew Cooper
2014-05-15 10:36   ` Jan Beulich
2014-05-15 10:45     ` Andrew Cooper
2014-05-15 12:15       ` Jan Beulich
2014-05-15 12:42         ` Andrew Cooper
2014-05-15  9:48 ` [PATCH RFC 6/9] x86/boot: Install trap handlers much earlier on boot Andrew Cooper
2014-05-15 10:53   ` Jan Beulich
2014-05-15 11:05     ` Andrew Cooper
2014-05-15 12:21       ` Jan Beulich
2014-05-15  9:48 ` [PATCH RFC 7/9] x86/boot: Drop pre-C IDT patching Andrew Cooper
2014-05-15  9:48 ` [PATCH RFC 8/9] x86/irqs: Move interrupt-stub generation out of C Andrew Cooper
2014-05-15 13:06   ` Jan Beulich
2014-05-15  9:48 ` [PATCH RFC 9/9] x86/misc: Post cleanup Andrew Cooper
2014-05-15 13:14   ` Jan Beulich
2014-05-15 13:17     ` Andrew Cooper
2014-05-16  8:49 ` [PATCH RFC 0/9] x86: Improvements to trap handling Wu, Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53749CB1.3010008@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=keir@xen.org \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).