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

Re: [PATCH v3] page_alloc: assert IRQs are enabled in heap alloc/free


  • To: Julien Grall <julien@xxxxxxx>, David Vrabel <dvrabel@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 25 Apr 2022 09:56:21 +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=iK6dgsjGKDgplw9d1zD27UYyxD/H5pBjgMUJG558ock=; b=TbBpT9W6bsqqo8EGecGwJyaTwwzj7GqYgD5mmzx5QvBiv9ltUI20XW0P6vSyn7Kw4J8SR6DfjwKs2mC/y1dZOY0pd3WqRLt9WRDLGXbPzfvynn6dNNraoOjwp+V/dauicvHRlhp/NPvYylzpGSYwzYh41GMVXc2DktHB6fyzBO2jjHiv4wZW4T59J8VKqcTtmFHVMLTJMW5OchpDa4J9xHR/FoHxKTwOaA+65qnUwtDQEXwzML2ghtrY24TUOiLhOIGlCHabf0xahCwRogJyxX/Bbg/y5qN6/YvvAY1zeP13GT0/jGtemhbMWDW4mbORsydOZGb4NYwKOk7KbkCFOg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JlPrF/bMRMzE0OkyxKnVWe7kLjtV5U9AisVUEzD6bq5MGrcmlkws0OQsNHNGOolIU0FZ9vK51GCwjEfjs0XQDeR+5kkJTZCmRoP6NjgBveDbbiLzs/pyc6quuphLy/MUMgYleZZWpmKQif4FCDUXi+HSBhviW3AIzc4rbgOIrwy/GwP0mCilLWwJHNKR0YWNzCm0NClEGkke605dRdbFbsd+ZX20xiZDOT+hYUYCBeZKxxSTUKjKTrCwj+Uz0Bq2cKrfFenlWmiTvRK24YMugVZSS23p+X1RPcBQ++PEll8CXkjsj3+WHbFlHMoYDO0jBN+cWqEkgJlz6R9TQR+C5w==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, David Vrabel <dvrabel@xxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 25 Apr 2022 07:56:33 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 24.04.2022 17:52, Julien Grall wrote:
>> Changes in v3:
>> - Use num_online_cpus() in assert.

With this ...

>> --- a/xen/common/page_alloc.c
>> +++ b/xen/common/page_alloc.c
>> @@ -162,6 +162,13 @@
>>   static char __initdata opt_badpage[100] = "";
>>   string_param("badpage", opt_badpage);
>>   
>> +/*
>> + * Heap allocations may need TLB flushes which require IRQs to be
>> + * enabled (except during early boot when only 1 PCPU is online).
> 
> Same remark as above. Also, I think there are other cases where 
> num_online_cpus() == 1:
>    - Xen is only using one core (it will not be a useful system but 
> technically supported)
>    - During suspend/resume
> 
> So I think we should either relax the comment or restrict the assert 
> below. I don't have any preference.

... I think it is the comment which wants bringing back in sync.

> + */ > +#define ASSERT_ALLOC_CONTEXT() \
> +    ASSERT(!in_irq() && (local_irq_is_enabled() || num_online_cpus() == 1))

While by the time calls here can legitimately occur the online map
should be initialized, I wonder whether it wouldn't be better to use
"<= 1" here nevertheless.

Jan




 


Rackspace

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