All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gustavo Franco <stratus@legolas.alternex.com.br>
To: kernel-janitors@vger.kernel.org
Subject: Re: [Kernel-janitors] [PATCH] - Replaces yield() with
Date: Fri, 16 Apr 2004 02:13:30 +0000	[thread overview]
Message-ID: <407F414A.70708@legolas.alternex.com.br> (raw)
In-Reply-To: <407C9AEE.5020808@legolas.alternex.com.br>

Randy.Dunlap wrote:

>On Tue, 13 Apr 2004 22:59:10 -0300 Gustavo Franco wrote:
>
>| Hi,
>| 
>| I'm new here, and this is my first patch, following the issue described by
>| Matthew Wilcox: "Calling yield() Considered Harmful" on TODO list.
>| 
>| There is no doubt that isn't necessary replace all yield() calls, but i'm
>| planning to check each case on the tree.Comments?
>| 
>| Hope that helps,
>| Gustavo Franco
>| p.s: This e-mail on the "from" is only for ML traffic, my main e-mail is
>| stratus at acm.dot org.
>| 
>| 
>| --- drivers/cdrom/cdu31a.c.orig 2004-04-13 22:43:55.000000000 -0300
>| +++ drivers/cdrom/cdu31a.c      2004-04-13 22:44:17.000000000 -0300
>| @@ -386,7 +386,7 @@ static inline void sony_sleep(void)
>|         unsigned long flags;
>|                                                                                          
>| 
>|         if (cdu31a_irq <= 0) {
>| -               yield();
>| +               schedule_timeout(1);
>|         } else {                /* Interrupt driven */
>| 
>|                 save_flags(flags);
>
>Makes sense, except that the comment above the function bothers me:
>
>/*
> * Wait a little while (used for polling the drive).  If in initialization,
> * setting a timeout doesn't work, so just loop for a while.
> */
>
>I expect that cdu31a_irq <= 0 means "in initializatgion," so is
>using schedule_timeout() safe here?  anyone checked this?
>
>  
>

Good question. Read this bit from comments on the source.

[...]
 * This interface is (unfortunately) a polled interface.  This is
 * because most Sony interfaces are set up with DMA and interrupts
 * disables.  Some (like mine) do not even have the capability to
 * handle interrupts or DMA.  For this reason you will see a lot of
 * the following:
 *
 *   retry_count = jiffies+ SONY_JIFFIES_TIMEOUT;
 *   while (time_before(jiffies, retry_count) && (! <some condition to 
wait for))
 *   {
 *      while (handle_sony_cd_attention())
 *         ;
 *
 *      sony_sleep();
 *   }
 *   if (the condition not met)
 *   {
 *      return an error;
 *   }
 *
 * This ugly hack waits for something to happen, sleeping a little
 * between every try.  it also handles attentions, which are
 * asynchronous events from the drive informing the driver that a disk
 * has been inserted, removed, etc.
[...]

If it's related with initialization why it isn't being called from 
cdu31a_setup() ?
sony_sleep() is called from other functions as described above on the 
comments.


Hope that helps,
Gustavo Franco





_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

  parent reply	other threads:[~2004-04-16  2:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-14  1:59 [Kernel-janitors] [PATCH] - Replaces yield() with Gustavo Franco
2004-04-15 23:09 ` Randy.Dunlap
2004-04-16  2:13 ` Gustavo Franco [this message]
2004-04-16  2:27 ` Randy.Dunlap
2004-04-25 19:44 ` Domen Puncer
2004-04-25 22:13 ` Gustavo Franco
2004-04-25 22:46 ` Domen Puncer

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=407F414A.70708@legolas.alternex.com.br \
    --to=stratus@legolas.alternex.com.br \
    --cc=kernel-janitors@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.