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

Re: [PATCH v2 2/2] xen/common: Use enhanced ASSERT_ALLOC_CONTEXT in xmalloc()


  • To: Henry Wang <Henry.Wang@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 6 May 2022 12:32:40 +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=FBQaB2sZPb208sBnZSPd/XKVkSsfPTM0ag6+UNZh5TM=; b=akcWXf7K0r/ZHmGdpK2r41KWlP/asRT1QBn4wUMINHmcHYMfcwEToHoXcwpEaQkZ5Bit/qOhY5FoqvOOHH0VNh6JMSba5nCOIsWPVO8HS3beipYbGywEqFgdjbpOOhqujk5n7d62QGGpOJ1Urfsh3FW9PaSE+7pegeV/iYSi1Kews+Kah+KKW9lS3ZPaE9bPD1PCpaq7b4G55EbMLTztLUe5pYZQggYoHVs02qiLPR4fMHOt9kYLTQKDJ3/7/hnt8RnjWLgepGnmqwJeUKut6X8VYl5S7OeCVQgKYHifK2uC/PRGLe+Uc706bZA3e3B3cRJ7pkmQJKKWzga4p/i0wQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pw0B3evi2UOinBV+dqtVJWmb6CMYS/Xa9R4KKNF4MStljy7msSF4tQtY4GDbEj8Kdc/EWQ6bZIx2AYKTgvOr8ZccO+tIpST0mcNxbBLGW3L+EpkHnMoYsny6usvRAcbXxUARJvuiI4JNGKjEgt/MzFKHKi5iRvNI+coVsq5IQwbgu2u4M2oZWModkFMSys7s5aGgl0E9VPHtOF8+c5fIVzhKLNMw42PUTXZQJoNvWLCrIT81E+me1f1wujHOQzKU7pviNgPzTbLgD9j3vQC02pMyIvFtU1Ugsifc6Ogy+yE0FsxEXaodHWPGRd8EFwiQ8Q+ZVndw19yFLw7vW3zrrA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Wei Chen <wei.chen@xxxxxxx>, Julien Grall <jgrall@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 06 May 2022 10:32:51 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 06.05.2022 07:52, Henry Wang wrote:
> --- a/xen/common/xmalloc_tlsf.c
> +++ b/xen/common/xmalloc_tlsf.c
> @@ -594,7 +594,7 @@ void *_xmalloc(unsigned long size, unsigned long align)
>  {
>      void *p = NULL;
>  
> -    ASSERT(!in_irq());
> +    ASSERT_ALLOC_CONTEXT();

For one - what about xfree()?

And then did you consider taking the opportunity and moving both to
the respective pool alloc functions, thus giving even better coverage?
Granted there's one downside to moving it to xmem_pool_alloc(): Then
the early zero-size and error returns won't be covered, so maybe we
actually want checks in both places. In xfree() I think the check
would then also want to move ahead of the early return.

Jan




 


Rackspace

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