linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luca Barbieri <ldb@ldb.ods.org>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Pavel Machek <pavel@suse.cz>,
	Linux-Kernel ML <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@transmeta.com>
Subject: Re: [PATCH 1 / ...] i386 dynamic fixup/self modifying code
Date: 30 Aug 2002 02:10:56 +0200	[thread overview]
Message-ID: <1030666256.1491.143.camel@ldb> (raw)
In-Reply-To: <1030663955.1327.27.camel@irongate.swansea.linux.org.uk>

[-- Attachment #1: Type: text/plain, Size: 1927 bytes --]

On Fri, 2002-08-30 at 01:32, Alan Cox wrote:
> On Fri, 2002-08-30 at 00:29, Luca Barbieri wrote:
> > Worked around by making sure all other processors are stopped (iret is
> > serializing) sending IPIs if they are not already spinning on the fixup
> > lock. See patch #2.
> 
> what happens we you do a fixup and the fixup occurs in an IPI handler
> (eg a cross CPU tlb flush).
Why should something bad happen in this case? (unless it happens in the
IPI handler for the SMP lock vector, but I've duplicated the spinlock
and apic-ack code to avoid using the fixups).

I've just noticed another problem instead: we might have a CPU waiting
with interrupts disabled for the CPU executing the fixup.
This could be fixed by waiting for a limited amount of iterations and
then emulating the instruction, but it makes the code even uglier.

We might get deadlocks on NMIs but that would also happen if we e.g. get
a memory parity NMI inside printk (deadlock on logbuf_lock). Should both
bugs be fixed?

> > > For the other fixups though you -have- to do them before you
> > > run the code. That isnt hard (eg sparc btfixup). You generate a list of
> > > the addresses in a segment, patch them all and let the init freeup blow 
> > > the table away
> > Is doing them at runtime with the aforementioned workaround fine?
> 
> Is doing them all in the beginning not somewhat saner and more
> debuggable.
That wouldn't work for compiler-generated prefetches (unless you
preprocess the compiler output) and would enlarge the kernel.
However, it would be significantly cleaner.

> The only reason to do it at runtime is hotplugging a less
> capable CPU. I have a suggestion for that case which is that we don't
> bother about it 8)
Even if we fixup at runtime this won't work since we the fixed up
instructions won't fault.
To handle this, we would need to keep the table around, stop CPUs and
fixup.
Anyway this scenario is quite unlikely.


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2002-08-30  0:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-28  3:41 [PATCH 1 / ...] i386 dynamic fixup/self modifying code Luca Barbieri
2002-08-28 12:11 ` Pavel Machek
2002-08-29 22:57   ` Luca Barbieri
2002-08-29 23:19   ` Alan Cox
2002-08-29 23:22     ` Pavel Machek
2002-08-30  0:05       ` David S. Miller
2002-08-30  0:21         ` Luca Barbieri
2002-08-29 23:29     ` Luca Barbieri
2002-08-29 23:32       ` Alan Cox
2002-08-30  0:10         ` Luca Barbieri [this message]
2002-08-30 11:17           ` Alan Cox
2002-09-03 21:31             ` Jamie Lokier
2002-09-03 21:35       ` Jamie Lokier
2002-08-30  0:08     ` David S. Miller
2002-08-28 15:53 ` Mikael Pettersson
2002-08-28 16:16   ` Luca Barbieri
2002-08-28 19:48     ` Mikael Pettersson

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=1030666256.1491.143.camel@ldb \
    --to=ldb@ldb.ods.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@suse.cz \
    --cc=torvalds@transmeta.com \
    /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).