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

Re: [PATCH v5 03/15] IOMMU/x86: support freeing of pagetables


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 1 Jun 2022 09:32:44 +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=ICqHSupe+g2orTcf3YUEr+7It+/wynk6o0K/KG5vsyY=; b=CFU4XCHVwOvffLkFmRSH+OjnPDahLuoE/c7ITUMD8f1gcazkpQDKVYo1dHpqtI4eUhQIBpMJmniCiUKCewdt5MzMrPl91TfVhvTKaWf+h4RpS+O7SDX4R4+xFHjP/vLlLNb2MdjjYLelq21I2YWBtm928WHvTgoMaO8OPWlwri+XlQnMAdOhEmDPHM0weCnaZUavVO8ILt5YrX45a0gHrsWbECPacUrtYFLE9jnnoMMluQwhmwf98hkuugJGzSOymtuMcPBh2xYaKUT1sEVKQoku3rFPIufJnRkDGgmnd2N59nGKgiVYfgBCA0PjDBql122xw2io773wmZOxmpTsuw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y7oovN/VM8jEsbRYPDHXRaZ4ps5UU37B4YGWuqLFb5gQ4rTL2wQ+4rRA2IH9bu+mtrDg1egorJFXGDdGFS7jmmcliBgThruXMLGb72sKpBX+3DRsUPiKfaLOCBfPtNjnfDcydiN3R/s7Jiq0jRbrT80w3qjgE2Mze9U4iyym398H2M/zPfpateYAxRO23G6dDz1sCK59KfAeCxp+11zt1rbc4lokmiUkZTXwDNexLHnCZHo6N9eskRpc9QgGilFG/spFOV5x/d4sU7zTYe4DLolbh9hUVhYvplZiL5JRHfUUXbLruYdV7VeCwm+u0A+1PW4Uep2TKDL80DKdhTStNw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>
  • Delivery-date: Wed, 01 Jun 2022 07:32:54 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 31.05.2022 18:25, Roger Pau Monné wrote:
> On Fri, May 27, 2022 at 01:13:09PM +0200, Jan Beulich wrote:
>> @@ -566,6 +567,98 @@ struct page_info *iommu_alloc_pgtable(st
>>      return pg;
>>  }
>>  
>> +/*
>> + * Intermediate page tables which get replaced by large pages may only be
>> + * freed after a suitable IOTLB flush. Hence such pages get queued on a
>> + * per-CPU list, with a per-CPU tasklet processing the list on the 
>> assumption
>> + * that the necessary IOTLB flush will have occurred by the time tasklets 
>> get
>> + * to run. (List and tasklet being per-CPU has the benefit of accesses not
>> + * requiring any locking.)
>> + */
>> +static DEFINE_PER_CPU(struct page_list_head, free_pgt_list);
>> +static DEFINE_PER_CPU(struct tasklet, free_pgt_tasklet);
>> +
>> +static void free_queued_pgtables(void *arg)
>> +{
>> +    struct page_list_head *list = arg;
>> +    struct page_info *pg;
>> +    unsigned int done = 0;
>> +
>> +    while ( (pg = page_list_remove_head(list)) )
>> +    {
>> +        free_domheap_page(pg);
>> +
>> +        /* Granularity of checking somewhat arbitrary. */
>> +        if ( !(++done & 0x1ff) )
>> +             process_pending_softirqs();
> 
> Hm, I'm wondering whether we really want to process pending softirqs
> here.
> 
> Such processing will prevent the watchdog from triggering, which we
> likely want in production builds.  OTOH in debug builds we should make
> sure that free_queued_pgtables() doesn't take longer than a watchdog
> window, or else it's likely to cause issues to guests scheduled on
> this same pCPU (and calling process_pending_softirqs() will just mask
> it).

Doesn't this consideration apply to about every use of the function we
already have in the code base?

Jan




 


Rackspace

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