linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: Robert Hancock <hancockrwd@gmail.com>
Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [git patch] atang tree: make SATA Asynchronous Notification work
Date: Sun, 28 Feb 2010 19:55:47 +0100	[thread overview]
Message-ID: <201002281955.47766.bzolnier@gmail.com> (raw)
In-Reply-To: <51f3faa71002280952p479dd795ue6a4e4a06b67e6f8@mail.gmail.com>

On Sunday 28 February 2010 06:52:23 pm Robert Hancock wrote:
> On Sun, Feb 28, 2010 at 8:31 AM, Bartlomiej Zolnierkiewicz
> <bzolnier@gmail.com> wrote:
> > DISCLAIMER: the fact of getting patches merged into atang tree means
> > that from now on they will be getting updates for changes happening
> > in atang tree and it should not be treated as an indication regarding
> > decisions taken by 'upstream' kernel trees
> >
> >
> > Fix Asynchronous Notification (AN) support for SATA ATAPI devices
> > (drives which support this feature will send a notification when new
> > media is inserted and removed, preventing the need for user space to
> > poll for new media needlessly consuming energy and CPU resources).
> >
> > Originally AN support was added to kernel in 2007, unfortunately some
> > relevant bits were lost in the merge process and the feature remains
> > non-functional in modern Linux distributions.  Lets fix it by adding
> > kernel patch by Robert Hancock (from Oct 2009) addressing the issue.
> >
> > User-space part (HAL daemon in particular) still won't automatically
> > disable media polling but it can be done manually by executing:
> >
> >  hal-disable-polling --device /dev/sr0
> >
> > command as root.
> >
> > [ To check if your ATAPI device supports AN:
> >  # hdparm -I /dev/sr0|grep "Asynchronous notification"
> >
> >  To check if it is properly recognized by kernel & user-space:
> >  $ lshal|grep support_async_notification ]
> >
> >
> > PS1 if you have PLDS DS-8A3S drive in your laptop (like me) you may
> > need to update the drive's firmware to the one containing AN support
> > (HA28 for Asus' OEM drives and HD52 for Dell's ones)
> >
> > PS2 I will be rebasing atang on top of 2.6.33 in the near future
> >
> >
> > The following changes since commit cad2f21db052f21beafd44d3396a565d9a485073:
> >  Bartlomiej Zolnierkiewicz (1):
> >        block: fix SSD performance regression
> >
> > are available in the git repository at:
> >
> >  git://git.kernel.org/pub/scm/linux/kernel/git/bart/misc.git atang-v4.9
> >
> > Robert Hancock (1):
> >      scsi: properly export media change notification capability in block device flags
> >
> >  drivers/scsi/sd.c |    2 ++
> >  drivers/scsi/sr.c |    2 ++
> >  2 files changed, 4 insertions(+), 0 deletions(-)
> 
> I think that patch is still applicable, but as you noted it doesn't
> really have much effect on HAL by itself other than reporting the
> "supports asynchronous notification" flag, there's nothing in HAL that
> automatically stops polling when that's detected (at least last I
> checked).

The real issue is that without the said flag being set media change
notification will stop working after you manually disable polling,
see the code in hald/linux/blockdev.c:

void
hotplug_event_refresh_blockdev (gchar *sysfs_path, HalDevice *d, void *end_token)
{
        HAL_INFO (("block_change: sysfs_path=%s", sysfs_path));

        if (hal_device_property_get_bool (d, "storage.removable.support_async_notification")) {
                blockdev_rescan_device (d);
        }

        /* done with change event */
        hotplug_event_end (end_token);
}

> As I recall the new HAL replacement (DeviceKit-disks I believe)
> doesn't depend on that particular flag to detect AN support.

Well, current distributions (i.e. openSUSE 11.2) still use HAL and I want
AN now, not in another 'x' years...  but I also took a look at udisks now
(which is a newer/re-branded DeviceKit-disks), src/device.c:

/* device_is_media_change_detected, device_is_media_change_detection_* properties */
static gboolean
update_info_media_detection (Device *device)
{
  gboolean detected;
  gboolean polling;
  gboolean inhibitable;
  gboolean inhibited;

  detected = FALSE;
  polling = FALSE;
  inhibitable = FALSE;
  inhibited = FALSE;

  if (device->priv->device_is_removable)
    {
      guint64 evt_media_change;
      GUdevDevice *parent;

      evt_media_change = sysfs_get_uint64 (device->priv->native_path, "../../evt_media_change");
      if (evt_media_change & 1)
        {
          /* SATA AN capabable drive */

          polling = FALSE;
          detected = TRUE;
          goto determined;
...

so DeviceKit should work fine but at the cost of relying on SCSI interfaces
instead of more generic block ones..

--
Bartlomiej Zolnierkiewicz

      reply	other threads:[~2010-02-28 18:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-28 14:31 [git patch] atang tree: make SATA Asynchronous Notification work Bartlomiej Zolnierkiewicz
2010-02-28 17:52 ` Robert Hancock
2010-02-28 18:55   ` Bartlomiej Zolnierkiewicz [this message]

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=201002281955.47766.bzolnier@gmail.com \
    --to=bzolnier@gmail.com \
    --cc=hancockrwd@gmail.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;
as well as URLs for NNTP newsgroup(s).