From: Tejun Heo <htejun@gmail.com>
To: Tejun Heo <htejun@gmail.com>, linux-ide@vger.kernel.org
Subject: Re: Current qc_defer implementation may lead to infinite recursion
Date: Tue, 12 Feb 2008 10:14:08 +0900 [thread overview]
Message-ID: <47B0F2E0.9020204@gmail.com> (raw)
In-Reply-To: <87r6fj2lsx.fsf@denkblock.local>
Elias Oltmanns wrote:
> +static int piix_qc_defer(struct ata_queued_cmd *qc)
> +{
> + static struct ata_port *ap = NULL;
> + struct ata_queued_cmd qcmd[ATA_MAX_QUEUE];
missing static?
> + static int count = 0;
> +#define PIIX_QC_DEFER_THRESHOLD 5000
> +
> + if (!ap)
> + ap = qc->ap;
> + else if (ap != qc->ap)
> + return 0;
> +
> + if (count > PIIX_QC_DEFER_THRESHOLD + 100)
> + return 0;
> +
> + count++;
> + if (count < PIIX_QC_DEFER_THRESHOLD)
> + return 0;
> + else if (count == PIIX_QC_DEFER_THRESHOLD) {
> + int i;
> + if (ap->qc_allocated) {
> + for (i = 0; i < ATA_MAX_QUEUE; i++)
> + qcmd[i] = ap->qcmd[i];
> + printk(KERN_DEBUG "piix_qc_defer(): saved current state\n");
> + msleep(5000);
> + } else
> + count--;
> + } else if (count == PIIX_QC_DEFER_THRESHOLD + 100) {
> + dump_stack();
> + count++;
> + } else if (memcmp(qcmd, ap->qcmd, sizeof(qcmd[0]) * ATA_MAX_QUEUE))
memcmp() will always mismatch. qcmd contains garbage.
> + return ATA_DEFER_LINK;
> + else
> + count = 0;
> + return 0;
> +}
> +
> static const struct piix_map_db ich5_map_db = {
> .mask = 0x7,
> .port_enable = 0x3,
> ---
>
>
> ====================================================================
> Feb 11 20:33:05 denkblock kernel: piix_qc_defer(): saved current state
> Feb 11 20:33:11 denkblock kernel: BUG: scheduling while atomic: swapper/0/0x00000100
You can't call msleep(5000) there.
Thanks.
--
tejun
next prev parent reply other threads:[~2008-02-12 1:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-10 17:54 Current qc_defer implementation may lead to infinite recursion Elias Oltmanns
2008-02-11 5:06 ` Tejun Heo
2008-02-11 7:57 ` Elias Oltmanns
2008-02-11 8:43 ` Tejun Heo
2008-02-11 22:03 ` Elias Oltmanns
2008-02-12 1:14 ` Tejun Heo [this message]
2008-02-12 8:57 ` Elias Oltmanns
2008-02-12 9:05 ` Tejun Heo
2008-02-12 9:43 ` Elias Oltmanns
2008-02-12 12:56 ` Tejun Heo
2008-02-18 20:03 ` Elias Oltmanns
2008-04-12 8:02 ` Elias Oltmanns
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=47B0F2E0.9020204@gmail.com \
--to=htejun@gmail.com \
--cc=linux-ide@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.