linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ondrej Zary <linux@zary.sk>
To: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Cc: Christoph Hellwig <hch@lst.de>,
	Sergey Shtylyov <s.shtylyov@omp.ru>, Jens Axboe <axboe@kernel.dk>,
	Tim Waugh <tim@cyberelk.net>,
	linux-block@vger.kernel.org, linux-parport@lists.infradead.org,
	linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] pata_parport: add driver (PARIDE replacement)
Date: Mon, 12 Dec 2022 23:55:30 +0100	[thread overview]
Message-ID: <202212122355.30988.linux@zary.sk> (raw)
In-Reply-To: <bfc49618-dbc3-8ffb-f536-3b4486e1980e@opensource.wdc.com>

On Wednesday 16 November 2022 02:30:46 Damien Le Moal wrote:
> On 2022/11/15 23:56, Ondrej Zary wrote:
> > On Tuesday 15 November 2022, Damien Le Moal wrote:
> >> On 11/15/22 04:25, Ondrej Zary wrote:
> >>> On Monday 14 November 2022 09:03:28 Damien Le Moal wrote:
> >>>> On 11/14/22 16:53, Ondrej Zary wrote:
> >>>>> On Monday 14 November 2022, Damien Le Moal wrote:
> >>>>>> On 11/12/22 20:17, Ondrej Zary wrote:
> >>>>>>> On Wednesday 19 October 2022 09:34:31 Christoph Hellwig wrote:
> >>>>>>>> It's been a while - did you get a chance to make some progress on
> >>>>>>>> this?  Do you need any help to unblock you?
> >>>>>>>>
> >>>>>>>
> >>>>>>> Sorry again, I'm back now. Trying to fix locking problems.
> >>>>>>> Added this to each function for analysis how the functions are called wrt.
> >>>>>>> locking:
> >>>>>>>
> >>>>>>> 	printk("%s, locked=%d\n", __FUNCTION__, spin_is_locked(ap->lock));
> >>>>>>
> >>>>>> Do you have your code somewhere that we can look at ?
> >>>>>
> >>>>> This is the current version with debug printks. I've also added dump_stack()
> >>>>> to find out the code path but haven't analyzed the output yet.
> >>>>
> >>>> Can you send a proper patch ? Or a link to a git tree ? That is easier to
> >>>> handle than pasted code in an email...
> >>>
> >>> Patch against what? I don't have a git server.
> >>
> >> patch against current 6.1-rc, or against an older kernel should be OK too.
> >> But please "git send-email" a patch, or push your dev tree to github ?
> >>
> >>> I've done some call trace analysis. These code paths are calling
> >>> pata_parport functions with ap->lock locked during init.
> >>>
> >>> Comm: kworker, Workqueue: ata_sff ata_sff_pio_task
> >>> ata_sff_hsm_move -> ata_pio_sectors-> ata_sff_altstatus -> pata_parport_tf_read -> pata_parport_check_altstatus
> >>> ata_sff_hsm_move -> ata_sff_altstatus -> pata_parport_tf_read -> pata_parport_check_altstatus
> >>> ata_sff_pio_task -> ata_sff_busy_wait -> pata_parport_check_status
> >>> ata_sff_hsm_move -> ata_wait_idle -> ata_sff_busy_wait -> pata_parport_check_status
> >>> ata_sff_hsm_move -> ata_hsm_qc_complete -> ata_sff_irq_on -> ata_wait_idle -> ata_sff_busy_wait -> pata_parport_check_status
> >>> ata_sff_pio_task -> ata_sff_hsm_move -> ata_pio_sectors -> ata_pio_sector -> ata_pio_xfer -> pata_parport_data_xfer
> >>> ata_sff_pio_task -> ata_sff_hsm_move -> pata_parport_data_xfer
> >>> ata_sff_pio_task -> ata_sff_hsm_move -> pata_parport_tf_read
> >>> ata_sff_hsm_move -> ata_hsm_qc_complete -> ata_qc_complete -> fill_result_tf -> ata_sff_qc_fill_rtf -> pata_parport_tf_read
> >>> ata_sff_hsm_move -> ata_pio_sectors -> ata_sff_altstatus -> pata_parport_check_altstatus
> >>> ata_sff_hsm_move -> ata_sff_altstatus -> pata_parport_check_altstatus
> >>>
> >>> Comm: modprobe
> >>> ata_host_start -> ata_eh_freeze_port -> ata_sff_freeze -> pata_parport_check_status
> >>>
> >>> Comm: scsi_eh_4
> >>> ata_eh_recover -> ata_eh_reset -> ata_eh_thaw_port -> ata_sff_thaw -> ata_sff_irq_on -> ata_wait_idle -> ata_sff_busy_wait -> pata_parport_check_status
> >>> ata_eh_reset -> ata_eh_freeze_port -> ata_sff_freeze -> pata_parport_check_status
> >>> ata_scsi_error -> ata_scsi_port_error_handler -> ata_port_freeze -> ata_sff_freeze -> pata_parport_check_status
> >>> ata_sff_error_handler -> pata_parport_drain_fifo -> pata_parport_check_status
> >>
> >> What exactly are the issues you are having with ap->lock ? It looks like
> >> you have done a lot of analysis of the code, but without any context about
> >> the problem, I do not understand what I am looking at.
> >>
> > 
> > The problem is that pi_connect() can sleep because it calls
> > parport_claim_or_block(). And any access (even reading ATA status register)
> > requires pi_connect.
> 
> OK. Let me have a look.
> 

The locking problems seem not to be easily solvable. Maybe a hack that grabs
the parport before registering ata interface (and keeps it until the
interface is disabled) will help? That will prevent multiple chained devices
on one parport from working but can get pata_parport moving.


-- 
Ondrej Zary

  reply	other threads:[~2022-12-12 22:55 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-12 14:44 [PATCH] pata_parport: add driver (PARIDE replacement) Ondrej Zary
2022-03-13 19:15 ` Ondrej Zary
2022-03-13 23:19   ` Jens Axboe
2022-03-14 20:25     ` Ondrej Zary
2022-03-14 20:29       ` Jens Axboe
2022-03-15  4:22         ` Damien Le Moal
2022-03-15 18:44           ` Ondrej Zary
2022-03-15 18:47             ` Jens Axboe
2022-03-15 21:17               ` Ondrej Zary
2022-03-16  0:19                 ` Damien Le Moal
2022-03-15  8:24         ` Christoph Hellwig
2022-03-13 20:38 ` Sergey Shtylyov
2022-03-13 21:19   ` Ondrej Zary
2022-03-16  8:50     ` Sergey Shtylyov
2022-03-16 11:28       ` Ondrej Zary
2022-03-16 11:44         ` Damien Le Moal
2022-03-16 12:58           ` Ondrej Zary
2022-10-19  7:34             ` Christoph Hellwig
2022-10-19 18:58               ` Ondrej Zary
2022-11-12 11:17               ` Ondrej Zary
2022-11-13 23:23                 ` Damien Le Moal
2022-11-14  7:53                   ` Ondrej Zary
2022-11-14  8:03                     ` Damien Le Moal
2022-11-14 19:25                       ` Ondrej Zary
2022-11-15  3:06                         ` Damien Le Moal
2022-11-15  8:04                           ` Hannes Reinecke
2022-11-15 14:56                           ` Ondrej Zary
2022-11-16  1:30                             ` Damien Le Moal
2022-12-12 22:55                               ` Ondrej Zary [this message]
2022-12-12 23:07                                 ` Damien Le Moal
2022-12-13  6:22                                 ` Christoph Hellwig

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=202212122355.30988.linux@zary.sk \
    --to=linux@zary.sk \
    --cc=axboe@kernel.dk \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parport@lists.infradead.org \
    --cc=s.shtylyov@omp.ru \
    --cc=tim@cyberelk.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).