Re: [PATCH] x86/mm/fault: Streamline the fault error_code decoder some more

From: Ingo Molnar
Date: Thu Dec 06 2018 - 11:47:20 EST



* Andy Lutomirski <luto@xxxxxxxxxxxxxx> wrote:

> > vs. (with SGX added as 'G' for testing purposes)
> >
> > [ 0.158849] #PF error code(0001): +P !W !U !S !I !K !G
> > [ 0.159292] #PF error code(0003): +P +W !U !S !I !K !G
> > [ 0.159742] #PF error code(0007): +P +W +U !S !I !K !G
> > [ 0.160190] #PF error code(0025): +P !W +U !S !I +K !G
> > [ 0.160638] #PF error code(0002): !P +W !U !S !I !K !G
> > [ 0.161087] #PF error code(0004): !P !W +U !S !I !K !G
> > [ 0.161538] #PF error code(0006): !P +W +U !S !I !K !G
> > [ 0.161992] #PF error code(0014): !P !W +U !S +I !K !G
> > [ 0.162450] #PF error code(0011): +P !W !U !S +I !K !G
> > [ 0.162667] #PF error code(8001): +P !W !U !S !I !K +G
> > [ 0.162667] #PF error code(8003): +P +W !U !S !I !K +G
> > [ 0.162667] #PF error code(8007): +P +W +U !S !I !K +G
> > [ 0.162667] #PF error code(8025): +P !W +U !S !I +K +G
> > [ 0.162667] #PF error code(8002): !P +W !U !S !I !K +G
> > [ 0.162667] #PF error code(8004): !P !W +U !S !I !K +G
> > [ 0.162667] #PF error code(8006): !P +W +U !S !I !K +G
> > [ 0.162667] #PF error code(8014): !P !W +U !S +I !K +G
> > [ 0.162667] #PF error code(8011): +P !W !U !S +I !K +G
> > [ 0.162667] #PF error code(0000): !P !W !U !S !I !K !G
> >
>
> Please donât. The whole reason I added the decoding was to make it easy
> to read without a cheat sheet. This is incomprehensible without
> reference to the code, and Iâm familiar with it to begin with.

Dunno, I can deduct the meaning from the above abbreviations without a
cheat sheet and I'm sure you'll be able to too from now on. All the
letters are very obvious references - to me at least, and brevity and
predictable, fixed-length output matters.

> How about:
>
> #PF error code: 0001 [PROT read kernel]
>
> #PF error code: 0001 [PROT WRITE kernel]
>
> #PF error code: 0001 [PROT read kernel]
>
> #PF error code: 8011 [PROT INSTR kernel SGX]
>
> This has no noise from unset bits except that we add lowercase âreadâ
> or âkernelâ as appropriate. Even âkernelâ seems barely necessary.

The thing is, the 'noise' from unset bits is actually important
information as well - at least for the major bits: it was a mostly random
choice that Intel defined '1' for write access and not for read access.

Thanks,

Ingo