linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Russell King <rmk@arm.linux.org.uk>
To: "David S. Miller" <davem@redhat.com>
Cc: andrea@suse.de, shrybman@sympatico.ca, quintela@fi.udc.es,
	gandalf@wlug.westbo.se, joerg.stroettchen@arcormail.de,
	linux-kernel@vger.rutgers.edu, axboe@suse.de, linux-mm@kvack.org
Subject: Re: classzone-VM + mapped pages out of lru_cache
Date: Fri, 5 May 2000 09:43:26 +0100 (BST)	[thread overview]
Message-ID: <200005050843.JAA25160@flint.arm.linux.org.uk> (raw)
In-Reply-To: <200005050304.UAA03317@pizda.ninka.net> from "David S. Miller" at May 04, 2000 08:04:09 PM

David S. Miller writes:
> Andrea, please do not pass IRQ state "flags" to another function
> and try to restore them in this way, it breaks Sparc and any other
> cpu which keeps "stack frame" state in the flags value.  "flags" must
> be obtained and restored in the same function.

On some of the older (obsolete) ARMs, this is also not possible - the
IRQ state is restored each time a function exits in kernel mode.
(I'm not too concerned with these today).

I've seen this done somewhere else in the kernel as well.  How about
changing flags to an architecture-defined struct, and doing something
like:

extern inline void save_flags(struct flags *flg)
{
#ifdef CATCH_BAD_FLAGS
	flg->ret = __builtin_return_address(0);
#endif
	__save_flags(flg->flag);
}

extern inline void restore_flags(struct flags *flg)
{
#ifdef CATCH_BAD_FLAGS
	if (flg->ret != __builtin_return_address(0))
		BUG();
#endif
	__restore_flags(flg->flag);
}

Of course, CATCH_BAD_FLAGS would be turned off for the stable series to
reduce the impact of the check, but at least we could catch bad usage on
development kernels easily.

Of course, the above is dependent on __builtin_return_address() returning
the return address of the function that these were inlined into.

I'm just wondering - what about spinlocks?  There are a couple of instances
where a spinlock is taken in a parent function and temporarily released in
one of its child functions.  I'm not happy with this usage, but if this is
a legal usage of the spinlocks, then the above may bite when it shouldn't.
   _____
  |_____| ------------------------------------------------- ---+---+-
  |   |         Russell King        rmk@arm.linux.org.uk      --- ---
  | | | |   http://www.arm.linux.org.uk/~rmk/aboutme.html    /  /  |
  | +-+-+                                                     --- -+-
  /   |               THE developer of ARM Linux              |+| /|\
 /  | | |                                                     ---  |
    +-+-+ -------------------------------------------------  /\\\  |
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/

  reply	other threads:[~2000-05-05  8:43 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3911ECCD.BA1BB24E@arcormail.de>
2000-05-04 23:44 ` Andrea Arcangeli
2000-05-05  0:03   ` Jens Axboe
2000-05-05  3:04   ` David S. Miller
2000-05-05  8:43     ` Russell King [this message]
2000-05-05 14:56     ` Andrea Arcangeli
2000-05-06 13:37   ` Andrea Arcangeli
2000-05-03 16:26 Andrea Arcangeli
2000-05-04  0:42 ` David S. Miller
2000-05-04 10:00   ` Andrea Arcangeli
2000-05-04 14:40 ` Juan J. Quintela
2000-05-04 15:19   ` Andrea Arcangeli
2000-05-04 15:23     ` Andrea Arcangeli
2000-05-04 15:38     ` Rik van Riel
2000-05-04 17:59       ` Andrea Arcangeli
2000-05-04 19:24         ` Rik van Riel
2000-05-04 16:34     ` Manfred Spraul, Andrea Arcangeli
2000-05-04 16:48     ` Trond Myklebust
2000-05-04 18:43       ` Andrea Arcangeli
2000-05-04 19:32         ` Trond Myklebust
2000-05-04 20:15           ` Andrea Arcangeli
2000-05-05  7:01             ` Trond Myklebust
2000-05-04 16:34   ` Juan J. Quintela
2000-05-04 18:27     ` Chris Evans

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=200005050843.JAA25160@flint.arm.linux.org.uk \
    --to=rmk@arm.linux.org.uk \
    --cc=andrea@suse.de \
    --cc=axboe@suse.de \
    --cc=davem@redhat.com \
    --cc=gandalf@wlug.westbo.se \
    --cc=joerg.stroettchen@arcormail.de \
    --cc=linux-kernel@vger.rutgers.edu \
    --cc=linux-mm@kvack.org \
    --cc=quintela@fi.udc.es \
    --cc=shrybman@sympatico.ca \
    /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