[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: x86: memset() / clear_page() / page scrubbing



On 09.04.2021 23:01, Ankur Arora wrote:
> On 2021-04-08 11:38 p.m., Jan Beulich wrote:
>> On 09.04.2021 08:08, Ankur Arora wrote:
>>> On 4/8/2021 6:58 AM, Jan Beulich wrote:
>>>> The present copy_page() is the way it is because of the desire to
>>>> avoid disturbing the cache. The effect of REP STOS on the L1 cache
>>>> (compared to the present use of MOVNTI) is more or less noticable on
>>>> all hardware, and at least on Intel hardware more noticable when the
>>>> cache starts out clean. For L2 the results are more mixed when
>>>> comparing cache-clean and cache-filled cases, but the difference
>>>> between MOVNTI and REP STOS remains or (at least on Zen2 and older
>>>> Intel hardware) becomes more prominent.
>>>
>>> Could you give me any pointers on the cache-effects on this? This
>>> obviously makes sense but I couldn't come up with any benchmarks
>>> which would show this in a straight-forward fashion.
>>
>> No benchmarks in that sense, but a local debugging patch measuring
>> things before bringing up APs, to have a reasonably predictable
>> environment. I have attached it for your reference.
> 
> Thanks, that does look like a pretty good predictable test.
> (Btw, there might be an oversight in the clear_page_clzero() logic.
> I believe that also needs an sfence.)

Oh, good point.

> Just curious: you had commented out the local irq disable/enable clauses.
> Is that because you decided that it the code ran at an early enough
> point that they were not required or some other reason?

It's not so much "early enough to not be required" but "too early to
be valid to enable interrupts". And then I didn't want to switch to
save/restore, so left them just as comments.

> Would you have any intuition on, if the power consumption of
> the non-temporal primitives is meaningfully different from
> REP STOS and friends?

If power can be saved when caches don't get modified (no idea if
that's possible, as the cached data still requires keeping intact),
then non-temporal stores might be better.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.