]> xenbits.xensource.com Git - xen.git/commit
x86/mm: Separate out partial_pte tristate into individual flags
authorGeorge Dunlap <george.dunlap@citrix.com>
Thu, 10 Oct 2019 16:57:49 +0000 (17:57 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 31 Oct 2019 15:12:14 +0000 (16:12 +0100)
commit1b6fa638d21006d3c0a3038132c6cb326d8bba08
tree56522094aeeb180173b62ed1abd77cf786d24fec
parentbf656e02d8e7f49b484e2587aef4f18deda6e2ab
x86/mm: Separate out partial_pte tristate into individual flags

At the moment, partial_pte is a tri-state that contains two distinct bits
of information:

1. If zero, the pte at index [nr_validated_ptes] is un-validated.  If
   non-zero, the pte was last seen with PGT_partial set.

2. If positive, the pte at index [nr_validated_ptes] does not hold a
   general reference count.  If negative, it does.

To make future patches more clear, separate out this functionality
into two distinct, named bits: PTF_partial_set (for #1) and
PTF_partial_general_ref (for #2).

Additionally, a number of functions which need this information also
take other flags to control behavior (such as `preemptible` and
`defer`).  These are hard to read in the caller (since you only see
'true' or 'false'), and ugly when many are added together.  In
preparation for adding yet another flag in a future patch, collapse
all of these into a single `flag` variable.

NB that this does mean checking for what was previously the '-1'
condition a bit more ugly in the put_page_from_lNe functions (since
you have to check for both partial_set and general ref); but this
clause will go away in a future patch.

Also note that the original comment had an off-by-one error:
partial_flags (like partial_pte before it) concerns
plNe[nr_validated_ptes], not plNe[nr_validated_ptes+1].

No functional change intended.

This is part of XSA-299.

Reported-by: George Dunlap <george.dunlap@citrix.com>
Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/mm.c
xen/include/asm-x86/mm.h