Search Results: "matthew"

23 April 2008

Matthew Garrett



Note that by "Enable Touchpad" it also means "Make my touchpad mouse buttons work". For machines that are only equipped with a touchpad (and, indeed, some that are equipped with a trackpoint as well - it depends on how it's wired up), the only option is to figure out that the space bar or enter will save you.

(Ubuntu-specific change, introduced in 8.04)

22 April 2008

Matthew Garrett

Oh, and for the love of christ. Australian cultural norms are the correct standard for determining what's acceptable for posting on a site that has clear guidelines against offensive content? Baby Jesus cries with as much pain as if he'd been suddenly violated in an utterly inappropriate way.

Matthew Garrett

...

Leaving aside the obvious failure (asking women to classify themselves into those who are happy to have their breasts groped and those who aren't - and yes, that is the effective choice, since refusing to participate will result in people making conclusions about which of those categories you fit into), there's the whole "open-source breast" thing.

Creating copyrightable works is a choice. Having breasts is not[1]. Attempting to equate the two is not reasonable. Applying "open-source" to things that are not directly comparable to copyrightable works is like applying "Darwinism" to things that are not directly comparable to natural selection operating upon living things. Discussing Darwinistic politics is likely to result in people concluding that you're either a libertarian fuckloon or blame atheists for the death of your cat. Discussing open-source breasts is likely to result in me stabbing you in the fucking eye. Don't make the baby Jesus cry when he sees your horribly mutilated face. Just accept that open source is a useful licensing model, not an entire way of life.

Or: get your hands off my adjective or you'll find my hands on things you really don't want groping, whether you're wearing a badge or not.

(And yes, I realise that this is not the offensive aspect of things. This says it better than I could)

(Previously)

(Previously previously)

[1] There's a set of basically uninteresting exceptions. And by "uninteresting" I mean "If you are trying to argue over this, then you are missing the fucking point"

19 April 2008

Matthew Garrett: Why Linux claims to be Windows

Section 5.7.2 of the ACPI specification provides for a method called _OSI. Platform firmware can query for various interfaces, which allow it to tweak its behaviour depending on the interfaces that the OS supports. Linux claims to support the following interfaces:which all correspond (unsurprisingly) to different versions of Windows. Linux used to be in there, but was removed for reasons I'll get into later.

The typical way in which this feature is used by a platform is by querying each of the interfaces in turn, starting with the most recent a firmware is aware of. After the first match, a value will be stashed somewhere and used elsewhere in the firmware when making certain decisions. An example of this may be only enabling certain devices (such as the HPET) if the OS claims to support Windows Vista.

As I mentioned, recent versions of Linux no longer claim to support the Linux interface. There's a couple of reasons for this. Firstly, some platforms break if they're told that they're running on Linux. It's usually an entirely untested codepath. Secondly, the whole point of the _OSI method is to provide the platform with information about the interface supported by an OS. "Linux" is too coarse grained - we make no guarantees that the interface between the OS and the platform will remain constant. "Linux 2.6.25" isn't all that much better, since distribution patches may alter the behaviour and BIOSes would become specific to a given kernel version. We could have something like "Linux ABI 1" and then bump that every time we altered the behaviour of the kernel in this respect, but this would become unwieldy fairly quickly (what would count as an ABI breaking change?)

So what kind of interface can we claim to provide? The sad truth of the matter is that most vendors will only test their code against Windows, and that as a result Windows provides the de-facto specification for OS/platform interaction. We could skip claiming to be Windows, but (in the best case) that means that the system will assume it's working with an OS that supports no advanced features. Rather than getting support for brightness changes being handled by the OS, we get stuck with SMM traps and unexpectedly missing time. If we want hardware to work to its full potential, we need to claim to be a recent version of Windows.

Does this mean the entire _OSI mechanism is useless? Not really. It's still useful for providing information about supported functionality. One example used in the spec is whether or not the OS implements the ACPI 3.0 thermal model. Another obvious (but unspecced) example might be whether or not the video opregion spec is implemented in the OS. _OSI strings which explicitly advertise the existence of advanced functionality are something that should be specified and encouraged. What they shouldn't be used for is as a way of advertising lacking functionality, which is effectively the only way that Linux can be usefully interpreted today. We don't want machines to automatically repost their video if they detect they're running Linux. It makes it harder to implement proper kernel-level graphics resume code. We don't want them to suddenly alter their keyboard behaviour, because that probably makes it harder to support older machines that don't have these workarounds.

Message to vendors: If we're not behaving in the same way as Windows does, let us know. We'll fix it. This has the benefit of fixing not only your latest and greatest platform, but also all the older ones that expected the same behaviour. Please don't try to work around our bugs in your BIOS - it just means that we need to special case you forever, and in the long run your hardware won't work as well as it would if we just fixed things properly.

17 April 2008

Matthew Garrett

Another update of my AHCI force quirking patch, somewhat cleaned up to let the existing kernel code do more of the work. The only functional change in this version is that some of the chipset IDs are disabled. The Intel specs state that plain (non-RAID supporting) desktop chipsets don't support AHCI. If you find that enabling one of the disabled IDs works for you, let me know along with the output of lspci -vxn -s 1f.2 . Patch is here. Success and failure reports welcome.

Note: I've had one report of SCSI errors associated with a previous version of the patch. I'm not quite sure what's going on there, but if you're paranoid about data corruption then you probably shouldn't play with this right now.

Matthew Garrett

This week I'm in Mountain View for the X Developers' Conference, where I gave a presentation on things graphics drivers have to care about in order to make suspend/resume work reliably. Various people suggested that I write up an explanation of the current situation, along with some best practices for manufacturers.

One of the major differences between the ACPI specification and the older APM specification is that saving and restoring hardware state is generally left up to the operating system, with the firmware playing a much more passive role. Linux is now able to handle this state restoration for the majority of hardware, but we still have issues with graphics. Modern graphics hardware can be hugely complicated, which to a large extent we've been able to ignore because the platform will initialise it on boot. Many X drivers know how to switch a card from text mode to graphics mode (and vice-versa), but that's not adequate.

What can make this situation even more awkward is that the ACPI specification makes no guarantees about what state the hardware comes up in. It may still be in PCI D3. It may be powered up, but the registers may all be zeroed. It's even valid for the hardware to come up in text mode. A driver has to be able to deal with all of these situations.

So far, we've mostly tried to deal with this situation by running chunks of the video BIOS with applications like vbetool. This is hacky and often works badly - in some cases, it won't work at all (nvidia rewrite the entry point to their video BIOS after boot, in order to prevent situations where someone attempts to POST the card and it tries to jump to bits of the system BIOS that no longer exist). The only long-term option is for the kernel to handle the graphics suspend/resume. There's several levels at which this can be supported:
Since 2.6.25, i915 and later Intel hardware can manage basic mode reprogramming without requiring any external assistance. The radeon kernel modesetting code is also heading in this direction, and we ought to be able to manage something there before too long. The nouveau developers are heading towards the stage of being able to do native mode programming, so there's some hope of progress there as well.

It's not all plain sailing, though. Vendors can wire up hardware in different ways. AMD and Nvidia hardware provides scripts in the ROM that, in theory, abstract this away. The downside to this is that we'll have to put the interpreters for these scripts in kernel space, though this is probably needed for kernel modesetting work anyway. Even then, it's possible that we'll need workarounds for specific pieces of hardware that don't quite behave as we expect them to.

As far as making graphics work over suspend/resume, we have a pretty good idea where we are now (failing on anything other than modern Intel hardware), where we need to be in the future (triumph, huge success, cake) and how to get there (?). However, hardware manufacturers can still help.
Chipset vendors:Tell us how to reinitialise your hardware. If that involves parsing BIOS tables, then please let us know how to do that. Expecting us to jump into your ROM and execute x86 code is ok if that's genuinely the only way to do it, but for any modern hardware that's clearly not the case.
System vendors:Try not to alter your system behaviour too wildly. Requiring magic register writes in order to light up the VGA output does not classify as value add. Please don't have your firmware program text mode directly - we're trying to get away from that. And do not attempt to detect that you're running on Linux and alter your system behaviour. If it's possible for you to tell that you're not running on Windows, that's a bug in Linux. If you rely on that bug, you will break. I'm not joking here in the slightest. The closest thing to a "standard" interface between an OS and the hardware is whatever Windows does, and we're basically aiming for bug-for-bug compatibility there.

16 April 2008

Matthew Palmer: When you think you're good...

It's stories like the following that make you realise just how puny your talents are... (Reposted from a place not to be named, by the legendary Al Viro)
Give them what I got yesterday. As in, box that got
        a) Linux kernel running.
        b) init and bash running.
        c) serial and floppy - built as modules. And not loaded.
        d) no sash.
        e) no ethernet.
        f) bloody large number-crunching that Should Not Be Aborted(tm).
        g) libc and ld-linux.so - unlinked (self-LART by owner).
Now, I could tell the guy to piss off, but... WTF? He had decent beer and
was properly scared. Oh, well... So we have no exec() for anything
dynamically
linked. And we have no chance to access any external stuff - insmod is
linked
dynamically, so no insmod floppy for you. Shutting the system down was not
an
option due to (f) (aside of dealing with fsck later - umount(8) is
dynamically
linked too). Now, I knew that both /lib/libc.so-2.1.2 and
/lib/ld-linux.so-2.1.2 were still alive - mmaped by init, for one. And
/proc/1/maps would even contain their inumbers. So the plan of attack was
to create a file in root and then cannibalize the entry (change inumber in
the directory). Alas - not enough. In-core inode got zero i_nlink and
if I would just create a link by hands it would not become positive. I.e.
still remove-upon-close. But. But if we will manage to call link() on the
hand-made link we will get i_nlink raised to 1 - iget() will find the same
in-core inode, so we are OK. We'll have to revert the phony link to avoid
PO'd fsck, but that's not a problem...
        So there we go: assuming that we got static ln
echo >foo
ln foo bar
flip inumber in foo entry to point to libc
ln foo /lib/libc.so-2.1.2
flip inumber.......................... bar
repeat for ld-linux.so
rm foo bar
begin recovering other damage (self-LART was a bit larger).
        But... we don't have this flip stuff and we don't have (aaarrgh)
static
ln. Oh, shit... OK, but all we really need is a couple of syscalls, right?
There we go:
        eax=__NR_link;
        ebx=s1;
        ecx=s2;
        int 0x80;
        eax=__NR_exit;
        ebx=0;
        int 0x80;
s1:     "foo"
s2:     "bar"
The next step was getting the syscall numbers. grep? We don't need no
stinkin'
grep.
# while read i; do case $i in *__NR_link*) echo $i;; esac;
done </usr/include/asm/unistd.h
#define __NR_link 9
# while read i; do case $i in *__NR_exit*) echo $i;; esac;
done </usr/include/asm/unistd.h
#define __NR_exit 1
#define __NR__exit __NR_exit
Now, scratching the head and recalling intel code...
start:  b8 09 00 00 00
        bb (address of s1)
        b9 (address of s2)
        cd 80
        b8 01 00 00 00
        bb 00 00 00 00
        cd 80
s1:     66 6f 6f 00
s2:     62 61 72 00
Fine, but... a.out support is compiled... you guessed it, as module and not
currently loaded. So we are in for crufting up an ELF binary. OK, we don't
actually need 100%-correct ELF, just something that will pass for the
exec(). Now, we don't have shell scripts, but . will work. So the next
step was rolling more(1) in shell and reading through the relevant code
(surprisingly small - binfmt_elf.c and two headers). After much swearing
the following abortion was created:
7f 45 4c 46 00 00 00 00 00 00 00 00 00 00 00 00
02 00 03 00 01 00 00 00 start______ 34 00 00 00
00 00 00 00 00 00 00 00 34 00 20 00 01 00 28 00
00 00 00 00 01 00 00 00 00 00 00 00 base_______
base_______ size_______ size_______ 05 00 00 00
00 10 00 00
start:
b8 09 00 00 00 bb start+1d___ b9 start+21___ cd
80 b8 01 00 00 00 bb 00 00 00 00 cd 80 66 6f 6f
00 62 61 72 00
OK, set base to something page-aligned, start=base+54, size=79. There we go:
7f 45 4c 46 00 00 00 00 00 00 00 00 00 00 00 00
02 00 03 00 01 00 00 00 54 00 00 80 34 00 00 00
00 00 00 00 00 00 00 00 34 00 20 00 01 00 28 00
00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 80
00 00 00 80 79 00 00 00 79 00 00 00 05 00 00 00
00 10 00 00 b8 09 00 00 00 bb 71 00 00 80 b9 75
00 00 80 cd 80 b8 01 00 00 00 bb 00 00 00 00 cd
80 66 6f 6f 00 62 61 72 00
well, while read l; do for i in  echo $l ; do echo -ne "\\$i"; done; done
made for oct2bin, overwriting /usr/bin/emacs with the output of that gave
us static equivalent of ln foo bar. And it worked. The rest was essentially
the same - the only tricky part was to find the location of directory entry.
Which was done with (lseek, read byte, exit(said_byte)) and shell wrapper
around that. So we had a way to read a block and dump it on the console.
The rest was obvious - start from relevant block in inode table and walk
through the references... Once we got that, it was an easy ride - trick
with inumber flipping brought libc and dynamic linker back and after that
we had 99% of system back into the working state. Amazing how little you
actually need to bring the system back to life...
Hot damn that's some deep hackery...

15 April 2008

Matthew Palmer: Blahsagne

Blahsagne, n.: A tasteless pile of pasta sheets and nominally tomato-based sauce, usually found in the cold store section of supermarkets.

13 April 2008

Matthew Garrett

Dear RSA,

Turing Lives? Leaving aside the fact that your biography entirely fails to mention the manner of his death (security through prejudice? Wait, hang on...), this bit really seems excessive:

There s no telling what Turing would do if he were around today, but one thing is certain, he would attend RSA Conference to gather and share new ideas and inspiration


Speaking for the dead in order to further commercial concerns? The dead baby Jesus weeps bitter tears, so buy my t-shirts.

6 April 2008

Matthew Garrett

Now that I've got a little more time on my hands, I've updated and done some bugfixing on my patch to quirk ICH devices over from PIIX-compatibility mode to AHCI mode. It turns out that ICH8 is a little different to ICH7, and needs an extra bit to be set. Without that being done, the AHCI BAR would still be programmed as i/o ports. Interpreting this as mmio space let to unsurprising crashes. With a bit of luck, this should also fix the "My CD drive is no longer there" issue - you'll still need to load ata_piix in order to access it, but make sure you do it after ahci has bound to the sata controller.

Patch against 2.6.24 is here - let me know if it works for you.

(Context: AHCI provides support for various features that the PIIX compatible mode doesn't, including link-level power saving. This is potentially beneficial for mobile users)

28 March 2008

Matthew Garrett

Ext JS is some sort of Javascript framework stuff. I know nothing whatsoever about Javascript, but what interested me was the slightly odd license. If you're a non-profit you can have it under the LGPL 3.0, but if you want to use it in a library then you have to buy a commercial license for them. This seems at odds with my understanding of the LGPL, but anyway. I'm a non-profit, so I've downloaded it under the LGPL. Under my LGPL rights, I've put it up for download here. If you want to use it in a library, feel free to do so as long as you abide by version 3.0 of the LGPL.

Thanks to Decklin for pointing this out.

22 March 2008

Matthew Garrett

Because you all love me and deeply want to know what on Earth I'm doing with my life/want to hire me, I'll put you out of your misery and let you know that I've just accepted an offer from Red Hat to save the universe work on kernel and userspace power management. With luck, it'll go some way to making up for the ridiculous amount of flying I'm still due to do this year.

21 March 2008

Matthew Garrett

I'm moving to London in a bit over a week, which means disposing of some quantity of junk, moving some more to London and hiding the rest (anyone got any recommendations for storage? I don't need regular access, but life would be immeasurably easier if they can pick stuff up and take it away). It also means the end of almost 10 years of living in Cambridge, and as a consequence there will be a party in the usual location on Friday the 28th. And possibly also on Saturday the 29th, depending on how much alcohol there still is lying around.

Also, if anyone in the Cambridge area wants some junk, the current list is here. I'll update stuff here as necessary.

14 March 2008

Matthew Garrett

Wednesday:


Today:


Hurrah for the open source development model!

(One of these taken by someone who can take pictures, and one taken by me)

13 March 2008

Matthew Garrett

Airports visited in the past week: 4 (rising to 6 in 12 hours or so)
Terminals visited in Heathrow: 2
Terminals enjoyed in Heathrow: 0
Vending machines in groundside of Heathrow terminal 2: 2, hidden near the men's toilets
Temperature of "ice cold" Coca Cola from vending machine: 5 C
Currencies currently carried: 4
Passports currently carried: 2
Fuses blown in airports: 1
Belonging to me: 0
Gross vm86-related hacks perpetrated: 1
Number of x86 instructions to emulate in order to achieve the above: 21
Number actually emulated as yet: 0

Those of you who haven't been too busy not paying attention will already know my whereabouts on the 13th of October and why my alibi is weak but that's another story for another time, but also that I'm in Recife from tomorrow afternoon until some time on Sunday and Porto de Galinhas from then until Wednesday in order to present at Bossa to talk about Ubuntu Mobile and the challenges involved in turning a Linux desktop distribution into something suitable for devices that are less large than your face. Sadly, logistical errors on my part mean I won't have any demo hardware with me, but there's always some potential for other synergy. Please don't beat me to death. Ow. Not the face. Please, not the face.

MJ Ray: National Issues / The Budgie 2008... sorry, Budget.

Colourful and pleasing to the eye and ear at first, but fairly useless, expensive to keep and poos on your floor.  Maybe it should be called the budgie and not the budget?

Anyway, here are some comments from around the net:-

7 March 2008

Matthew Garrett

Dear Mountain View,

Why is it so indescribably awkward to get from north of 101 to downtown on foot?

Fucking sort it out,

Matthew

5 March 2008

Matthew Garrett

It seems fashionable for people to finish their doctorates at their moment, and on Monday I (almost) joined the herd. The outcome of my defence was that they'd like a couple of extra experiments done, so it's back to the lab for a fortnight, new credit cards for everyone[1] and cab it to the Gold Club[2].

Tomorrow sees me continuing my one man campaign to destroy the planet's ecosystem by heading to the bay area[3] for a total of just under 48 hours. I then continue to France for a few days of holiday, before reversing and hitting up Recife for Bossa 08. Alarmingly this still all involves less time on planes than LCA did, which makes me conclude that Australia is in a silly location and we should ship it somewhere more convenient, like just off the west coast of Ireland.

[1] Possibly lie
[2] Definite lie
[3] Mostly the south bay. Because I hate life.

4 March 2008

Matthew Palmer: Dear Web 2.0 Application Authors...

If you insist on having several levels of pulldown menu in your application, would you mind not having each one make an AJAX call back to the server to get the contents of the menu? The "click... wait... click... wait..." to navigate where I need to go gets particularly tedious when I have to do it in excess of 100 times today. Stabbity Stab, Matt

25 February 2008

Matthew Palmer: IEEE, Thou Art Clowns

Ever since I started University, I've been a member of the Institution of Electrical and Electronic Engineers. Although I don't really do what you would call "Engineering" any more, I like to read the IEEE Spectrum magazine and some of the Computer society journals are quite relevant to what I do. However, this year the IEEE have produced what is, without a doubt, one of the most shithouse online ordering systems I have ever had the misfortune of trying to use. To start with, if you happen to go to the account login screen with cookies disabled, you get a page that is utterly blank. I've seen a lot of ways to fail to handle cookies, but I think the completely blank page is a first for me. Once you work out what's going on and log in, you're presented with a long and painful journey through a series of "checkout" pages, mostly alike. I think I got presented with my list of journals about four times. After navigating that pest, it comes up with this little gem when you start the credit card processing step: To Back, or Not
  To Back Then, every time you input practically anything into the form, it does a Javascript submit and does things to the form. For example, when you enter your credit card number, you get a form back that has blanked out all but the last four digits of the card number. OK, a little dumb, but not spectacularly so. Although, when you're a quick typist and have filled in the next three fields while the web browser was playing footsie with the slow-as-molasses web server, only to have that data wiped out when the page refreshes, is a bit of a pest. Far more annoying is when you start entering your address "for verification purposes". Here, you get a form resubmit every time, presumably to update the form based on (for example) your selected country, but not a lot changes. Even though I picked Australia, I still got a pull-down with all of the the US states in it. You could short-circuit all this with the "choose existing address" option, except that (despite me being logged in) my existing addresses aren't in a select box, but in a separate pop-up window (which didn't actually display anything after all). In short, the IEEE's online renewal system is a disgrace, and is an embarrassment to what is purportedly a technical organisation.

Next.

Previous.