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

Re: [PATCH 1/5] x86: support cache-writeback in flush_area_local() et al


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 20 Apr 2023 10:50:59 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qO8/eQLcgTZIMyAY7w3qZMCAYlF3MYJ1N65RvbhwuNE=; b=cSW3F3DcRRKo5Pc2/z1NRSZHFLucFQvwifaioJcjGFfQTESsDnw5urgdCf6uctJ/sLGVf9ZHHVuLFH7cr1zj5DFieu4rS58F3G4R+novPTe4VuEJazMcCFj5eNpnbvPm55AsgT2/fT943OMnkEY2VmbXZKx/NXprYK9pv1hITWA+/4Koq2T9qwn805bM+3xpzs4PyB7fMbq9D/zmdoYobNuAJp4uXN93pF4am8LAqv3eXIZR4XPqSibql3bs963GT3EHD5FujBJItq2xbn964f9+WrWjdP6SeQ3mKrHKx3BCKkVzhdel3l3O9aZK3XSMelLR6Dq7Ve+WXZPiAIe86g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b2VhjiFsMchVBz5OEfG3kC8G3o4r2nWQ44b88stn9DvEiU77qGNoo7W8TJHmSTvBQWOnERNxyiM+BUYrLO+CV3eZfLVeHrZKFhhN0biAQlItIiKagU7AkX0W6GZB/SDQ57Gx1KXniJcfSeGiMY6/YrUL+lH77qBeht9vv6fbGKN5Qe3p5v/SKR6m4DctUPzItBGMksbDBd7CHnYK4oRogGxlnHsDah/GSCcJc+PhqhdWPlvK26lVc8n0zzIKRkRR5CNPA1NEJneKx2RtDcSHVqRg89/Z3OymK4/yjrCA/aYV8B6tIuCJgfFNc6rk+GGMKTa2knoubPOUCEI7Np6wIw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 20 Apr 2023 08:51:07 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 19.04.2023 21:56, Andrew Cooper wrote:
> On 19/04/2023 11:44 am, Jan Beulich wrote:
>> --- a/xen/arch/x86/flushtlb.c
>> +++ b/xen/arch/x86/flushtlb.c
>> @@ -232,7 +232,7 @@ unsigned int flush_area_local(const void
>>      if ( flags & FLUSH_HVM_ASID_CORE )
>>          hvm_flush_guest_tlbs();
>>  
>> -    if ( flags & FLUSH_CACHE )
>> +    if ( flags & (FLUSH_CACHE | FLUSH_WRITEBACK) )
> 
> Given that we already have FLUSH_CACHE, then adding writeback also seems
> fine, but we need to get the naming corrected first.
> 
> We've got a file called flushtlb.c which flushes more than the TLBs now,
> and various APIs in it.
> 
> We have a bunch of ARM specific APIs which AFAICT exist purely to prop
> up the ARM-specific gnttab_cache_flush().  That needs to go and live
> behind an ifdef and stop polluting other architectures with an
> incredibly short sighted hypercall interface decision.
> 
> The "area" in the low level calls isn't good.  Range might be better,
> but I'm not sure.  The "mask" part of the name would be better as "some"
> or perhaps "others", to be a better counterpoint to "local".  Some of
> the wrappers too really ought to be dropped - there are lots of them,
> and too few users to justify.
> 
> But on to the main thing which caught my eye...
> 
> The FLUSH in FLUSH_CACHE means the flush infrastructure, not "cache
> flushing", and FLUSH_WRITEBACK is nonsensical next to this.

I agree; I chose the name simply to avoid further changes, while still
fitting the naming scheme (i.e. the FLUSH_ prefix). I'm okay to change
to ...

>  All other
> things we flush have a qualification that makes them clear in context.
> (other than the assist one which I'm going to time out objections to and
> revert back to name which made more sense.)
> 
> At an absolutely minimum, FLUSH_CACHE first needs renaming to
> FLUSH_CACHE_EVICT and then this new one you're adding needs to be
> FLUSH_CACHE_WRITEBACK.

... these, but I don't think they're much better (still primarily
because of the FLUSH_ prefixes).

FTAOD - while I'm going to make these adjustments (adding a single
prereq patch to carry out the initial rename), I don't really see me
doing any of there other adjustments you were outlining above (at
least not within this series).

> Except...
> 
> Is there any credible reason to have EVICT as an option by the end of
> this cleanup?

Yes: map_pages_to_xen(), hvm_shadow_handle_cd(), memory_type_changed(),
and hvm_set_mem_pinned_cacheattr(), all mean to evict caches aiui.

clean_and_invalidate_dcache_va_range(), as you say, really shouldn't
be required, but I'm unconvinced we can easily drop support for a
gnttab sub-op that's been around for a number of years. (The more with
there (still) not being any support for GNTTAB_CACHE_SOURCE_GREF, I'm
(still) thinking this shouldn't have been a gnttab sub-op in the first
place, but something truly arch-specific [a platform-op, or a memory
one, or ...].)

Jan

> CLDEMOTE does exist for a reason (reducing coherency traffic overhead
> when you know the consumer is on a different CPU), but it would be
> totally bogus to use this in an all or mask form, and you wouldn't want
> to use it in local form either, simply from an overhead point of view.
> 
> We have evict behaviour simply because `clflush` was the only game in
> town for decades, not because evicting the cacheline is what you want
> actually want to do.
> 
> ~Andrew




 


Rackspace

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