linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kasper Dupont <kasperd@daimi.au.dk>
To: Robert Love <rml@tech9.net>
Cc: marcelo@conectiva.com.br, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] 2.4: introduce get_cpu() and put_cpu()
Date: Sun, 06 Oct 2002 22:36:14 +0200	[thread overview]
Message-ID: <3DA09EBE.D9E2E148@daimi.au.dk> (raw)
In-Reply-To: 1033933547.743.4472.camel@phantasy

Robert Love wrote:
> 
> diff -urN linux-2.4.20-pre9/arch/i386/kernel/ioport.c linux/arch/i386/kernel/ioport.c
> --- linux-2.4.20-pre9/arch/i386/kernel/ioport.c 2002-10-06 14:58:01.000000000 -0400
> +++ linux/arch/i386/kernel/ioport.c     2002-10-06 15:21:04.000000000 -0400
> @@ -55,12 +55,15 @@
>  asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int turn_on)
>  {
>         struct thread_struct * t = &current->thread;
> -       struct tss_struct * tss = init_tss + smp_processor_id();
> +       struct tss_struct * tss;
> 
>         if ((from + num <= from) || (from + num > IO_BITMAP_SIZE*32))
>                 return -EINVAL;
>         if (turn_on && !capable(CAP_SYS_RAWIO))
>                 return -EPERM;
> +
> +       tss = init_tss + get_cpu();
> +
>         /*
>          * If it's the first ioperm() call in this thread's lifetime, set the
>          * IO bitmap up. ioperm() is much less timing critical than clone(),

To me it really looks like you are missing a put_cpu() call somewhere.
I know it is a no-op, but since you intend to show how to use it, I
it really ought to be there.

Does this look right?

diff -Nur linux.old/arch/i386/kernel/ioport.c linux.new/arch/i386/kernel/ioport.c
--- linux.old/arch/i386/kernel/ioport.c	Sun Oct  6 22:33:22 2002
+++ linux.new/arch/i386/kernel/ioport.c	Sun Oct  6 22:33:53 2002
@@ -87,6 +87,8 @@
 	set_bitmap(t->io_bitmap, from, num, !turn_on);
 	set_bitmap(tss->io_bitmap, from, num, !turn_on);
 
+	put_cpu();
+
 	return 0;
 }
 

-- 
Kasper Dupont -- der bruger for meget tid på usenet.
For sending spam use mailto:aaarep@daimi.au.dk
or mailto:mcxumhvenwblvtl@skrammel.yaboo.dk

  reply	other threads:[~2002-10-06 20:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-06 19:45 [PATCH] 2.4: introduce get_cpu() and put_cpu() Robert Love
2002-10-06 20:36 ` Kasper Dupont [this message]
2002-10-06 21:08   ` Robert Love

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=3DA09EBE.D9E2E148@daimi.au.dk \
    --to=kasperd@daimi.au.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    --cc=rml@tech9.net \
    /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).