Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#245 closed defect (wontfix)

Incorrectly displayed values ​​SCT ERC (5734.5 second)

Reported by: k-nike Owned by: somebody
Priority: minor Milestone:
Component: smartctl Version:
Keywords: freebsd Cc: Alex Samorukov

Description

I have:

  1. FreeBSD gate.domain.com 9.0-RELEASE-p3 FreeBSD 9.0-RELEASE-p3 #0: Tue Jun 12 02:52:29 UTC 2012 root@…:/usr/obj/usr/src/sys/GENERIC amd64
  2. smartmontools-6.0 installed from ports.

Problem:
This problem was in the earlier version of the smartctl too for any values in smartctl -l scterc,*,* /dev/sde

[gate:~]# smartctl -l scterc /dev/ad6
smartctl 6.0 2012-10-10 r3643 [FreeBSD 9.0-RELEASE-p3 amd64] (local build)
...

SCT Error Recovery Control:

Read: 57345 (5734.5 seconds)

Write: 57345 (5734.5 seconds)

Attachments (1)

ata.patch (3.7 KB) - added by Alex Samorukov 8 years ago.
patch to return ATA registers for ATACAM layer in FreeBSD

Download all attachments as: .zip

Change History (13)

comment:1 Changed 8 years ago by Christian Franke

Cc: Alex Samorukov added
Keywords: freebsd added; 5734.5 57345 SCT Error Recovery Control removed

Read of SCT ERC is special because it requires that the ATA output registers LBA_LOW and SECTOR_COUNT returned by SMART WRITE LOG command are properly passed back to smartctl. This is often not supported by ATA pass-through I/O-controls.

The value 57354 (0xe001) means that this specific I/O-control returned LBA_LOW = 0xe0 and SECTOR_COUNT = 0x01. These are identical to ATA input register values for this command: SMART WRITE LOG 0x01 sector to log address 0xe0 (SCT COMMAND/STATUS). The kernel code probably does not update the ATA register parameter block before returning to smartctl.

comment:2 Changed 8 years ago by Alex Samorukov

I would like to close this big. I think this is limitation of the driver you are using. You can submit PR to the FreeBSD. Also i am recommending to use ACPI mode and adaX driver - it usually works better and supports all features.

comment:3 Changed 8 years ago by Christian Franke

Is the missing output register support a general problem of the old IOCATAREQUEST? This would also break SMART RETURN STATUS: A failed status would NEVER be detected.

If this is the case, I would suggest to block all ATA commands requiring ATA output registers if CAM is not used. Could easily be done with the new function added in r3663:

  bool freebsd_ata_device::ata_pass_through(...)
  {
    if (strcmp("atacam", get_dev_type())) {
      if (!ata_cmd_is_supported(in, 
        ata_device::supports_data_out | 
        ata_device::supports_multi_sector,
        "IOCATAREQUEST")
      )
        return false;
    }
    else {
      if (!ata_cmd_is_supported(in, 
        ata_device::supports_data_out | 
        ata_device::supports_output_regs | 
        ata_device::supports_multi_sector |
        ata_device::supports_48bit,
        "CAM")
      )
        return false;
    }
    ...
  }

comment:4 Changed 8 years ago by Alex Samorukov

No, it is not. Some of the drivers/chipsets are working perfectly. On hardware i own it works fine with both interfaces. I think we should leave it as is.

Anyway - /dev/ad* is depricated interface, all new hardware is supported by /dev/adaX. Most of the old cards also supported via adaX using compatibility (ATACAM) API.

comment:5 Changed 8 years ago by Christian Franke

Resolution: wontfix
Status: newclosed

This is likely a broken pass-through implementation that can only be fixed in FreeBSD itself.

This kind of driver bug is not uncommon. In r3666 I added a platform independent heuristic check that returns an error instead of this bogus ERC value.

comment:6 Changed 8 years ago by k-nike

So sorry. Possible information about hardware is useful. Maybe someone has like hardware.

Intel 82801G (ICH7)

ada0 at ata3 bus 0 scbus2 target 0 lun 0
ada0: <ST320LT020-9YG142 0003LVM1> ATA-8 SATA 2.x device
ada0: 150.000MB/s transfers (SATA, UDMA5, PIO 8192bytes)
ada0: 305245MB (625142448 512 byte sectors: 16H 63S/T 16383C)
ada0: Previously was known as ad6

#smartctl -l scterc /dev/ada0
smartctl 6.0 2012-10-10 r3643 [FreeBSD 9.0-RELEASE-p3 amd64] (local build)
Copyright (C) 2002-12, Bruce Allen, Christian Franke, www.smartmontools.org

SCT Error Recovery Control:

Read: 57345 (5734.5 seconds)

Write: 57345 (5734.5 seconds)

Coming soon freebsd 9.1. I'll try to report the results.

comment:7 Changed 8 years ago by Alex Samorukov

Could you please clarify:

  1. In first message you are using /dev/adX device and in next /dev/adaX. What was changed?
  2. Some of ICH7 chipsets, according to Wikipedia, do have AHCI support. I am recommending to enable it if possible. Please share results.

I will now check if i do have such hardware - ICH7 was very popular, so may be i have one.

I don`t think that there is anything to do with smartmontools, but we can try to report this bug to the upstream as kernel bug.

comment:8 Changed 8 years ago by k-nike

  1. I don't have find menu AHCI in BIOS. But AHCI enabled in the kernel by default.

# grep ahci /usr/src/sys/amd64/conf/GENERIC
device ahci # AHCI-compatible SATA controllers

Probably my motherboard does not support AHCI:
# dmesg | grep ada
ada0 at ata3 bus 0 scbus2 target 0 lun 0
ada0: <ST320LT020-9YG142 0003LVM1> ATA-8 SATA 2.x device
ada0: 150.000MB/s transfers (SATA, UDMA5, PIO 8192bytes)
ada0: 305245MB (625142448 512 byte sectors: 16H 63S/T 16383C)
ada0: Previously was known as ad6
ada1 at ata3 bus 0 scbus2 target 1 lun 0
ada1: <ST3250410AS 3.AAC> ATA-7 SATA 1.x device
ada1: 150.000MB/s transfers (SATA, UDMA5, PIO 8192bytes)
ada1: 238475MB (488397168 512 byte sectors: 16H 63S/T 16383C)
ada1: Previously was known as ad7

  1. /dev/adX is a hardlink on /dev/adaY in FreeBSD 9.0

# ls -l /dev/
...
lrwxr-xr-x 1 root wheel 4 Oct 26 00:25 ad6 -> ada0
...
crw-r----- 1 root operator 0, 89 Oct 26 00:25 ada0
...

comment:9 Changed 8 years ago by Alex Samorukov

I reported this bug to upstream (Alexander Motin) and it was found that problem is in ATACAM layer. AHCI supported devices are not affected, but old ATA are. He also provided the fix which works for me. You may find fix in the r242156/HEAD. I tested it on STABLE and it fixing the issue. Patch will be attached to this report, you can test it as well.

Changed 8 years ago by Alex Samorukov

Attachment: ata.patch added

patch to return ATA registers for ATACAM layer in FreeBSD

comment:10 Changed 8 years ago by k-nike

Thank you!
Do I understand that I must apply the patch and recompile the kernel?

comment:11 Changed 8 years ago by Alex Samorukov

Yes, correct.

comment:12 Changed 8 years ago by k-nike

Wow! It works! It's a magic :)

Note: See TracTickets for help on using tickets.