Re: [PATCH v2 10/39] x86/mm: Introduce _PAGE_COW

Edgecombe, Rick P
2022-10-05T23:07:17Z

On Wed, 2022-10-05 at 07:08 -0700, Dave Hansen wrote:
> On 10/4/22 19:17, Andrew Cooper wrote:
> > On 29/09/2022 23:29, Rick Edgecombe wrote:
> > > From: Yu-cheng Yu <yu-cheng.yu@intel.com>
> > >
> > > There is essentially no room left in the x86 hardware PTEs on
> > > some OSes
> > > (not Linux). That left the hardware architects looking for a way
> > > to
> > > represent a new memory type (shadow stack) within the existing
> > > bits.
> > > They chose to repurpose a lightly-used state: Write=0,Dirty=1.
> >
> > How does "Some OSes have a greater dependence on software available
> > bits
> > in PTEs than Linux" sound?
> >
> > > The reason it's lightly used is that Dirty=1 is normally set
> > > _before_ a
> > > write. A write with a Write=0 PTE would typically only generate a
> > > fault,
> > > not set Dirty=1. Hardware can (rarely) both set Write=1 *and*
> > > generate the
> > > fault, resulting in a Dirty=0,Write=1 PTE. Hardware which
> > > supports shadow
> > > stacks will no longer exhibit this oddity.
> >
> > Again, an interesting anecdote but not salient information here.
>
> As much as I like the sound of my own voice (and anecdotes), I agree
> that this is a bit oblique for the patch. Maybe this anecdote should
> get banished elsewhere.
>
> The changelog here could definitely get to the point faster.

Although this text was inherited, I thought it was useful to disperse
any "huh, I wonder why" thoughts that may be lingering in the readers
head as they try to grok the rest of the text. I'll shorten it as
suggested. Thanks all.