[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 7/9] xen/arm: take care of concurrency on static memory allocation
- To: Penny Zheng <penny.zheng@xxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Thu, 10 Jun 2021 12:53:26 +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-SenderADCheck; bh=VZMruOKPvUj3F4CifjynfF7FGm3G6uXlbGRQuTBF1xM=; b=I5Y5rq2FQ3EhyaiuK3lC+HLNa1T4qsgsicPoUBg+EfQRYbMbdPIRoae4OTILy+NvAZixxR9JXw1Hscj0zpNq5PazCcyX8AHbvZG5ZPO1KkKdZ+Y5aoTzQ4egMQ+iH2NPm9FRbgF+qswgzhG7Fq06cqoHxvWxFpNrb90n7VFhqH/YJWQTj/o9iZBUP/ZCkaoc0x4RDzV91YqpKwAYV48Kxb5Ni9xQlWUWeOG9iCh+IoYGLjofk74J+hrsaYimGKkMAaCry9NiwcI3cIHvm+1yThWqYj/qElA8MwQ/wTE1qBy3dXl5TyU1UslBdsML5YBnB/WrdFHdKHNLiamC2uLIbw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TevT3BWt7m0I88vvFgVFziEvItLytf3373osQYnoiWhBIoP1oVoQM1APWDqTsSk8juXmOhdOk9RivbcI2KszspG8sOkaF11yTZEXSzIJf9wB/J7tmFjp5u+qxTYkzrsAa9IyZZP0UXDpjyWyZMBNxHPRz59Oi3oJD8RO8CW+1uyYoexipmUeFahhwZjwYBKWA1uvuSXG0g08nSZlHf2xb5VXAUjZn+IBucwPBrVB3JyCR/SOAx6oE9IRkFbjigJdwCrmKKlHnG4DcY3HGYtei1WEdavuqkjUT9gVxx4CZgM1rEwTJTTWIP7Ntbo55nn0BrCJl0F0iOz1WEzgcnCyAA==
- Authentication-results: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=suse.com;
- Cc: Bertrand.Marquis@xxxxxxx, Wei.Chen@xxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, sstabellini@xxxxxxxxxx, julien@xxxxxxx
- Delivery-date: Thu, 10 Jun 2021 10:53:41 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 07.06.2021 04:43, Penny Zheng wrote:
> --- a/xen/common/page_alloc.c
> +++ b/xen/common/page_alloc.c
> @@ -1087,6 +1087,9 @@ static struct page_info *alloc_staticmem_pages(unsigned
> long nr_mfns,
> nr_mfns, mfn_x(smfn));
> return NULL;
> }
> +
> + spin_lock(&heap_lock);
> +
> pg = mfn_to_page(smfn);
>
> for ( i = 0; i < nr_mfns; i++ )
> @@ -1127,6 +1130,8 @@ static struct page_info *alloc_staticmem_pages(unsigned
> long nr_mfns,
> !(memflags & MEMF_no_icache_flush));
> }
>
> + spin_unlock(&heap_lock);
> +
> if ( need_tlbflush )
> filtered_flush_tlb_mask(tlbflush_timestamp);
Besides, as indicated there, the need to fold this into the previous
patch, you will also want to pay attention to alloc_heap_pages()
carefully avoiding to scrub or flush pages with the heap lock held.
You will want to follow this for your additions.
Jan
|