mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
To: Alan Cox <alan@redhat.com>
Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: PATCH: switch ide-proc to use the ide_key functionality
Date: Tue, 17 Aug 2004 12:48:12 +0200	[thread overview]
Message-ID: <200408171248.12235.bzolnier@elka.pw.edu.pl> (raw)
In-Reply-To: <20040817010533.GB32628@devserv.devel.redhat.com>

On Tuesday 17 August 2004 03:05, Alan Cox wrote:
> BTW this may help if I document the locks and what they cover in case its
> not obvious
>
> drives_lock is the spin lock you must own to update the drive list
>
> ide_cfg_sem is the semaphore you must own to walk or hold loose references
> to the ide_hwif_t array and elements relating to adding/removing/busy
> status
>
> ide_lock is taken when you want to write that array and deal with elements
> that are interrupt walked by other devices. Notably this means the hwgroup
> chains.
>
> ide_settings_sem could be per drive but isnt, it is used when you are
> processing the ioctl/proc objects attached to the driver either by walking
> them or removing them.
>
>
> drivers_lock is the spin lock you must own to update the drivers list
> drivers_sem is the semaphore you must own to walk the list and while
> holding loose references to drivers (ie when the busy/lists are not
> consistent)
>
> The lock order is
>
> 	ide_cfg_sem
> 	drivers_sem
> 	ide_settings_sem
> 	drivers_lock | drives_lock
> 	ide_lock
>
>
> Which means my cunning plan from the previous mail doesn't actually work
> unless we take ide_cfg_sem at the top of the proc code before setting_sem.
> Also looking over it I need to send you the bits to take the sems in each
> proc routine for that case.

Yes, on the other hand we may try to do real refcounting.

Actually I think there are holes in the above locking scheme but need to think 
more about it - i.e. what protects us from removing hwif while it is being 
configured by host driver?

> PS: what do you think about deprecating (but not yet removing)
> ide_write_config and ide_read_config now we have sysfs ? Does anyone

sysfs doesn't help at all as IDE is not ready for full sysfs support
(missed locking, no refcounting and no dynamic objects)

I also can't see how sysfs can help with synchronizing writes to ISA/PCI 
config space with ongoing I/O?

Please also note that PCI writes currently doesn't work because of "... || 
hwif->pci_dev->vendor" instead of "... || !hwif->pci_dev->vendor" - somebody 
(I think you :) broke this back in 2.4.21 kernel.

> actually use its "wait for non busy and then pci config write" - does
> anyone use it at all ?

I'm not aware of any users and I have patch ready to deprecate it.

> Also while looking at proc it would clean up read_imodel and make it a ton
> more useful to stick the string pointers into hwif->chipset_name or
> somesuch so we can report the PCI ones in detail ?

Yes, but reporting PCI ones in detail will brake any users of this /proc entry 
(if there are any of course).

Thanks.

  reply	other threads:[~2004-08-17 10:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-15 15:04 Alan Cox
2004-08-16 15:24 ` Bartlomiej Zolnierkiewicz
2004-08-16 15:30   ` Alan Cox
2004-08-16 23:22     ` Bartlomiej Zolnierkiewicz
2004-08-16 23:35 ` Bartlomiej Zolnierkiewicz
2004-08-17  0:13   ` Alan Cox
2004-08-17  0:31     ` Bartlomiej Zolnierkiewicz
2004-08-17  0:41       ` Alan Cox
2004-08-17  1:05       ` Alan Cox
2004-08-17 10:48         ` Bartlomiej Zolnierkiewicz [this message]
2004-08-17 12:06           ` Alan Cox
2004-08-17 22:15             ` Alan Cox

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=200408171248.12235.bzolnier@elka.pw.edu.pl \
    --to=b.zolnierkiewicz@elka.pw.edu.pl \
    --cc=alan@redhat.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®