Re: [PATCH] Provide better printk() support for SMP machines

From: Andrew Morton (akpm_at_osdl.org)
Date: 07/05/05

  • Next message: Robert Love: "[patch] updated inotify."
    Date:	Tue, 5 Jul 2005 14:29:58 -0700
    To: David Howells <dhowells@redhat.com>
    
    

    David Howells <dhowells@redhat.com> wrote:
    >
    > The attached patch prevents oopses interleaving with characters from other
    > printks on other machines by only zapping the locks if the oops is happening
    > on the machine holding the lock.

    (s/machine/CPU/)

    hm, I guess it adds a theoretical deadlock if some other CPU is in the
    middle of printk and is trying to take some_lock and this CPU takes an oops
    while holding some_lock. Probably that's an acceptable tradeoff though.

    > --- linux-2.6.12-mm1/kernel/printk.c 2005-06-22 13:54:08.000000000 +0100
    > +++ linux-2.6.12-mm1-cachefs-wander/kernel/printk.c 2005-06-22 13:57:02.000000000 +0100
    > @@ -514,6 +514,9 @@ asmlinkage int printk(const char *fmt, .
    > return r;
    > }
    >
    > +/* cpu currently holding logbuf_lock */
    > +static volatile int printk_cpu = -1;
    > +

    Does this guy really need to be volatile? Coud we use atomic_t and lose
    that wmb()?

    > asmlinkage int vprintk(const char *fmt, va_list args)
    > {
    > unsigned long flags;
    > @@ -522,11 +525,15 @@ asmlinkage int vprintk(const char *fmt,
    > static char printk_buf[1024];
    > static int log_level_unknown = 1;
    >
    > - if (unlikely(oops_in_progress))
    > + if (unlikely(oops_in_progress) && printk_cpu == smp_processor_id())
    > + /* If a crash is occurring during printk() on this CPU,
    > + * make sure we can't deadlock */

    Methinks this should be raw_smp_processor_id().
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Robert Love: "[patch] updated inotify."

    Relevant Pages

    • Re: Problem with FileLock
      ... it writes to the file while the other machines wait, ... file locks are mandatory, meaning that if one program locks a region of a ... file locks are advisory or mandatory is configurable on a per-file basis. ... closing a channel releases all locks held by the Java ...
      (comp.lang.java.programmer)
    • Re: http://www.samair.ru/proxy/
      ... >many countries to access such machines without consent, ... including locks on the house is necessary. ... situation with ActiveX and File/Print Sharing. ...
      (comp.security.firewalls)
    • Re: http://www.samair.ru/proxy/
      ... >many countries to access such machines without consent, ... including locks on the house is necessary. ... situation with ActiveX and File/Print Sharing. ...
      (alt.computer.security)
    • Re: http://www.samair.ru/proxy/
      ... >many countries to access such machines without consent, ... including locks on the house is necessary. ... situation with ActiveX and File/Print Sharing. ...
      (microsoft.public.security)
    • Regarding locks and global variables
      ... Since it is a global linked list should I be using locks ?? ... Would I have a problem only on multiprocesor machines or would the problem also ... occur if I have multiple processes calling func_aand func_brandomly. ... All this is done in the driver code. ...
      (comp.sys.hp.hpux)