Re: IDE HPA

Alan Cox
2005-09-02T23:41:25Z

On Gwe, 2005-09-02 at 17:14 -0400, Peter Jones wrote:
> > You installed it on Red Hat 7 ? I think 7, may have been 6.x or earlier.
>
> You may be right -- it's likely that I shrank my windows partition on
> some other OS or Distro that wasn't designed with to screw up the disk.

If you shrink existing partitions it won't ever screw you up. The
geometry data for the partition table spans only the non HPA area.

> Yes, it did have a partition table -- but the partition table did (and
> still does) not include partitions which overlap the HPA. Right now it
> still appears as unused space.

But they are also on the IBM I looked at are obvious because the
geometry in the partition table does not span the HPA so the problem
doesn't arise as confusion.

> > Not really practical. You'd have to list most older PC systems.
>
> Most older PC systems use HPA? Really?

Many of those "magic windows drive/bios fixup" type programs work by
having the jumper on the drive set the HPA and the drive report a
smaller size, then the windows magic driver undoes this.

> Both of these suck. Have I missed something?

I fear not.

> So where would you envision this code to check the partition table, the
> HPA/host default disk size, and guess how things should be set up?

fdisk and friends already have to parse and process the existing
partition tables.

> they'll be screwing themselves by partitioning the entire disk, so we
> really should be leaving HPA enabled if the protected area is indeed not
> for consumption.

Define "not for consumption". It should be *hard* to use it, and it
should not occur by accident. Deliberately is a different matter. And
that should be a run time not boot time action.

> (as a side note, I know one user who, at OLS, noticed we fail to
> re-initialize HPA after unsuspend, so on at least t40 the disk gets
> smaller when you suspend. This may or may not be fixed, I haven't
> checked. But it's one more sort of pain we get into by disabling it,
> whether justified or not.)

Known problem. ACPI provides the correct infrastructure for much of this
but the IDE layer doesn't support it. Send patches to Bartlomiej. The
core infrastructure is there because Andre saw the need for the ACPI
taskfile support coming. The HPA restore is just another step in the
state machine for resume and quite doable. Good little project for
someone wanting to play with the IDE layer.

> I think if we go the heuristic route, then the *safest* option is to
> leave it enabled by default and let userland installers/initrd do fixups
> by telling the kernel to change the state.

Assuming we are talking about hda1/2/... then the partitions are already
clipped by the OS to the volume size. We could conceivably make the size
of the disk itself writable. We don't need to get into programming drive
HPA when we can do it ourselves, and we can clip non HPA capable drives
too should someone find a cause for it.