public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Manoj Sontakke <manojs@sasken.com>
To: "Hen, Shmulik" <shmulik.hen@intel.com>
Cc: "'nigel@nrg.org'" <nigel@nrg.org>,
	Manoj Sontakke <manojs@sasken.com>,
	linux-kernel@vger.kernel.org
Subject: Re: spinlock help
Date: Wed, 07 Mar 2001 15:56:54 +0530	[thread overview]
Message-ID: <3AA60CEE.AD9F2102@sasken.com> (raw)
In-Reply-To: <07E6E3B8C072D211AC4100A0C9C5758302B27152@hasmsx52.iil.intel.com>

hi

spin_lock_irq()   and    spin_lock_bh() 

can they be of any use to u? 

"Hen, Shmulik" wrote:
> 
> How about if the same sequence occurred, but from two different drivers ?
> 
> We've had some bad experience with this stuff. Our driver, which acts as an
> intermediate net driver, would call the hard_start_xmit in the base driver.
> The base driver, wanting to block receive interrupts would issue a
> 'spin_lock_irqsave(a,b)' and process the packet. If the TX queue is full, it
> could call an indication entry point in our intermediate driver to signal it
> to stop sending more packets. Since our indication function handles many
> types of indications but can process them only one at a time, we wanted to
> block other indications while queuing the request.
> 
> The whole sequence would look like that:
> 
> [our driver]
>         ans_send() {
>                 .
>                 .
>                 e100_hard_start_xmit(dev, skb);
>                 .
>                 .
>         }
> 
> [e100.o]
>         e100_hard_start_xmit() {
>                 .
>                 .
>                 spin_lock_irqsave(a,b);
>                 .
>                 .
>                 if(tx_queue_full)
>                         ans_notify(TX_QUEUE_FULL);      <--
>                 .
>                 .
>                 spin_unlock_irqrestore(a,b);
>         }
> 
> [our driver]
>         ans_notify() {
>                 .
>                 .
>                 spin_lock_irqsave(c,d);
>                 queue_request(req_type);
>                 spin_unlock_irqrestore(c,d);    <--
>                 .
>                 .
>         }
> 
> At that point, for some reason, interrupts were back and the e100.o would
> hang in an infinite loop (we verified it on kernel 2.4.0-test10 +kdb that
> the processor was enabling interrupts and that the e100_isr was called for
> processing an Rx int.).
> 
> How is that possible that a 'spin_unlock_irqrestore(c,d)' would also restore
> what should have been restored only with a 'spin_unlock_irqrestore(a,b)' ?
> 
>         Thanks in advance,
>         Shmulik Hen
>       Software Engineer
>         Linux Advanced Networking Services
>         Intel Network Communications Group
>         Jerusalem, Israel.
> 
> -----Original Message-----
> From: Nigel Gamble [mailto:nigel@nrg.org]
> Sent: Wednesday, March 07, 2001 1:54 AM
> To: Manoj Sontakke
> Cc: linux-kernel@vger.kernel.org
> Subject: Re: spinlock help
> 
> On Tue, 6 Mar 2001, Manoj Sontakke wrote:
> > 1. when spin_lock_irqsave() function is called the subsequent code is
> > executed untill spin_unloc_irqrestore()is called. is this right?
> 
> Yes.  The protected code will not be interrupted, or simultaneously
> executed by another CPU.
> 
> > 2. is this sequence valid?
> >       spin_lock_irqsave(a,b);
> >       spin_lock_irqsave(c,d);
> 
> Yes, as long as it is followed by:
> 
>         spin_unlock_irqrestore(c, d);
>         spin_unlock_irqrestore(a, b);
> 
> Nigel Gamble                                    nigel@nrg.org
> Mountain View, CA, USA.                         http://www.nrg.org/
> 
> -
> 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/
> 
> -
> 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/

-- 
Regards,
Manoj Sontakke

  reply	other threads:[~2001-03-07 10:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-07  9:21 spinlock help Hen, Shmulik
2001-03-07 10:26 ` Manoj Sontakke [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-03-08 11:07 Hen, Shmulik
2001-03-08 11:34 ` Andrew Morton
2001-03-07 16:54 Ofer Fryman
2001-03-07 12:26 Hen, Shmulik
2001-03-07 12:53 ` Andrew Morton
2001-03-07 10:46 Hen, Shmulik
2001-03-07 10:44 Hen, Shmulik
2001-03-07 13:19 ` Alan Cox
2001-03-07 10:31 Ofer Fryman
2001-03-06 14:05 Manoj Sontakke
2001-03-06 23:53 ` Nigel Gamble

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=3AA60CEE.AD9F2102@sasken.com \
    --to=manojs@sasken.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nigel@nrg.org \
    --cc=shmulik.hen@intel.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