mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Robert Love <rml@tech9.net>
To: Zwane Mwaikambo <zwane@linuxpower.ca>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@transmeta.com>
Subject: Re: [PATCH] small fixes in brlock.h
Date: 09 Mar 2003 19:00:01 -0500	[thread overview]
Message-ID: <1047254400.680.10.camel@phantasy.awol.org> (raw)
In-Reply-To: <Pine.LNX.4.50.0303091843250.1464-100000@montezuma.mastecende.com>

On Sun, 2003-03-09 at 18:44, Zwane Mwaikambo wrote:

> --- linux-2.5.64-unwashed/include/linux/brlock.h	5 Mar 2003 05:07:54 -0000	1.1.1.1
> +++ linux-2.5.64-unwashed/include/linux/brlock.h	9 Mar 2003 23:42:26 -0000
> @@ -85,8 +85,7 @@
>  	if (idx >= __BR_END)
>  		__br_lock_usage_bug();
>  
> -	preempt_disable();
> -	_raw_read_lock(&__brlock_array[smp_processor_id()][idx]);
> +	read_lock(&__brlock_array[smp_processor_id()][idx]);
>  }

This is wrong.

We have to disable preemption prior to reading smp_processor_id(). 
Otherwise we may lock/unlock the wrong processor's brlock.  The above as
you changed it is equivalent to:

	cpu = smp_processor_id();
	/* do not want to preempt here, but we can! */
	preempt_disable();
	_raw_read_lock(&__brlock_array[cpu][idx]);

And what we had, and what we need, is:

	preempt_disable();
	cpu = smp_processor_id();
	_raw_read_lock(&__brlock_array[cpu][idx]);

In other words, we need to ensure preemption is disabled prior to
calling smp_processor_id().

We also do something similar with the write patch in lib/brlock.c, but
for different reason: to disable preemption once and not NR_CPUS times.

The rest of the patch looks fine. :)

	Robert Love


  reply	other threads:[~2003-03-09 23:49 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-09 23:44 Zwane Mwaikambo
2003-03-10  0:00 ` Robert Love [this message]
2003-03-10  0:03   ` Zwane Mwaikambo
2003-03-10  0:10     ` Robert Love
2003-03-10  1:11       ` Zwane Mwaikambo
2003-03-10  0:15 ` Robert Love
2003-03-10  2:33   ` Linus Torvalds
2003-03-10 21:54     ` Roman Zippel
2003-03-12  0:13     ` [PATCH] (0/8) replace brlock with RCU Stephen Hemminger
2003-03-12  0:23       ` Linus Torvalds
2003-03-12  0:28         ` David S. Miller
2003-03-12  1:36           ` Roman Zippel
2003-03-12  0:14     ` [PATCH] (1/8) Eliminate brlock in psnap Stephen Hemminger
2003-03-12  1:03       ` Roman Zippel
2003-03-12  1:13       ` Zwane Mwaikambo
2003-03-12  0:14     ` [PATCH] (2/8) Eliminate brlock for packet_type Stephen Hemminger
2003-03-12  0:20       ` David S. Miller
2003-03-12  0:25         ` Stephen Hemminger
2003-03-12  0:14     ` [PATCH] (3/8) Eliminate brlock from vlan Stephen Hemminger
2003-03-12  0:14     ` [PATCH] (4/8) Eliminate brlock in net/bridge Stephen Hemminger
2003-03-12  0:14     ` [PATCH] (5/8) Eliminate brlock from netfilter Stephen Hemminger
2003-03-12  1:25       ` Zwane Mwaikambo
2003-03-12  0:15     ` [PATCH] (6/8) Eliminate brlock from ipv4 Stephen Hemminger
2003-03-12  0:15     ` [PATCH] (7/8) Eliminate brlock from IPV6 Stephen Hemminger
2003-03-12  0:15     ` [PATCH] (8/8) Kill brlock Stephen Hemminger
2003-03-12  0:23       ` David S. Miller
2003-03-12  0:31         ` Stephen Hemminger
2003-03-12  0:34           ` David S. Miller
2003-03-12  0:44             ` Linus Torvalds
2003-03-12  0:48               ` Stephen Hemminger
2003-03-12  2:31               ` Alan Cox

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=1047254400.680.10.camel@phantasy.awol.org \
    --to=rml@tech9.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    --cc=zwane@linuxpower.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

all inboxes | Powered by JetHome®