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

Re: [PATCH 12/14] swiotlb: move global variables into a new io_tlb_mem structure


  • To: Christoph Hellwig <hch@xxxxxx>
  • From: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
  • Date: Wed, 17 Mar 2021 13:42:07 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.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=UO4nQ+8IdYLmNMwK0SJ17RQ/xMqltbB4iQCeQZxLkyA=; b=c7RkZEXb7vVIUr09Z4PxUgBTosjGFGqzozg4GhTNt02HbDIquv1K1J+lmxZZF6P3qdTM7p0xHpPb0i0pCfkCli0kJxkalAFR0apECxQ8gjOnh5DWsFF5gu15mtXJf7VgZUnMCy0kfAvxzomNkD0DoV8yUdBgEHTHf+eaS6ddzPRzloz1XhGpBy8daUNZDh+dcxuyr/WWj8wxkGvJiVP1xC7bGRsJUWNvyH2WJk/NdeNZLVZfsxqE6PQoEeVPiM7da7q0Lc5dVEyQK1ytle5UyPxw5RPYS7w9qmhzBN4efoojZOgdmkegEWRQ/4NCJFNACBzAR/78o4Rfc4BSiaxLFA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SUHw/HVbau2QpVJgPzEeDCfUvHE++N9q5bs3ZyswhLKxaxQFCaddF11f7KDSXQqxPemadFJ4eM0RhodtSwVSzSw2fh6OKt0xZBrigIr1tsySewQNeUlhi4iFVFpMzTROHEQ/iuFKzbLB+ya37uoyMSrUnaIbWrwWwkdtoA/r6/j33JyNJxMcNeDSPEBwt9skrwrAF9bGspbu90WdBNBZXKY5KWYmutikHexnxb2nGdrU4uhvtC5LewXVVjUEWIXTiMojruOp8aG+XIkcKme1BTQga/CbdaWH/7NKt8qP8fhlsmi2/J0OsxE8WWF/H1bv69q9WYJ9gxgcz6KZL0ANRQ==
  • Authentication-results: lst.de; dkim=none (message not signed) header.d=none;lst.de; dmarc=none action=none header.from=oracle.com;
  • Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx>, iommu@xxxxxxxxxxxxxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, Claire Chang <tientzu@xxxxxxxxxxxx>, linuxppc-dev@xxxxxxxxxxxxxxxx, Dongli Zhang <dongli.zhang@xxxxxxxxxx>
  • Delivery-date: Wed, 17 Mar 2021 13:42:36 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

..snip..
>  int __init swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int 
> verbose)
>  {
..snip..
>       /*
>        * Allocate and initialize the free list array.  This array is used
>        * to find contiguous free memory regions of size up to IO_TLB_SEGSIZE
> -      * between io_tlb_start and io_tlb_end.
> +      * between mem->start and mem->end.
>        */
> -     alloc_size = PAGE_ALIGN(io_tlb_nslabs * sizeof(int));
> -     io_tlb_list = memblock_alloc(alloc_size, PAGE_SIZE);
> -     if (!io_tlb_list)
> +     alloc_size = PAGE_ALIGN(mem->nslabs * sizeof(int));
> +     mem->list = memblock_alloc(alloc_size, PAGE_SIZE);
> +     if (!mem->list)
>               panic("%s: Failed to allocate %zu bytes align=0x%lx\n",
>                     __func__, alloc_size, PAGE_SIZE);
>  
> -     alloc_size = PAGE_ALIGN(io_tlb_nslabs * sizeof(phys_addr_t));
> -     io_tlb_orig_addr = memblock_alloc(alloc_size, PAGE_SIZE);
> -     if (!io_tlb_orig_addr)
> +     alloc_size = PAGE_ALIGN(mem->nslabs * sizeof(phys_addr_t));
> +     mem->orig_addr = memblock_alloc(alloc_size, PAGE_SIZE);
> +     if (!mem->orig_addr)
>               panic("%s: Failed to allocate %zu bytes align=0x%lx\n",
>                     __func__, alloc_size, PAGE_SIZE);
>  
> -     alloc_size = PAGE_ALIGN(io_tlb_nslabs * sizeof(size_t));
> -     io_tlb_alloc_size = memblock_alloc(alloc_size, PAGE_SIZE);
> -     if (!io_tlb_alloc_size)
> -             panic("%s: Failed to allocate %zu bytes align=0x%lx\n",
> -                   __func__, alloc_size, PAGE_SIZE);

Shouldn't this be converted to:
        mem->alloc_size = memblock_alloc(alloc_size, PAGE_SIZE);
        if (...)

Seems that it got lost in the search and replace?
> -
> -     for (i = 0; i < io_tlb_nslabs; i++) {
> -             io_tlb_list[i] = IO_TLB_SEGSIZE - io_tlb_offset(i);
> -             io_tlb_orig_addr[i] = INVALID_PHYS_ADDR;
> -             io_tlb_alloc_size[i] = 0;
> +     for (i = 0; i < mem->nslabs; i++) {
> +             mem->list[i] = IO_TLB_SEGSIZE - io_tlb_offset(i);
> +             mem->orig_addr[i] = INVALID_PHYS_ADDR;
> +             mem->alloc_size[i] = 0;
>       }
> -     io_tlb_index = 0;
>       no_iotlb_memory = false;
>  
>       if (verbose)
>               swiotlb_print_info();
>  
> -     swiotlb_set_max_segment(io_tlb_nslabs << IO_TLB_SHIFT);
> +     swiotlb_set_max_segment(mem->nslabs << IO_TLB_SHIFT);
>       return 0;
>  }
>  

..snip..



 


Rackspace

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