From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (xvm-189-124.dc0.ghst.net [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6C359A09FF; Wed, 6 Jan 2021 22:20:51 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0C96E140E49; Wed, 6 Jan 2021 22:20:51 +0100 (CET) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by mails.dpdk.org (Postfix) with ESMTP id 46EDD40FA7 for ; Wed, 6 Jan 2021 22:20:49 +0100 (CET) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 106L4kjl098460; Wed, 6 Jan 2021 16:20:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=9bhE9/fkYrtbO5/1c40sKl4KgKX9Rj95qVWhPKsdFQ4=; b=mWCn1HCnPvx4CO7pQl5NSWR53skzROCqH7P010FbCzKqxl0v8aHVZQjQ46DDCjefKB3K HOS7FPMSgkbbrVEl2mwQFNyryVnm8+6myhgSbGQrNUy0jE8yRe+slzGoToC5MuP/se44 V5netdX58Fc2eaX3TQJYiFdgLSUmKnY6HWw+zvHuYIVOzcSDDECdCmXZ28qXRZ+JgxOv re2Fr4Jn5of+0cE5/Fz5DjykgdVWXf2dL1aUeHfrM467nngM+6acPWmQ1b0rA1kAbE0n ysvfThz/JmJ9hcnVS2xcBb/L59U5ncKp1WlXiaQM4p3VkajKiE0jCZLUP0YCJsU6OyEn 5w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 35why55daa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 06 Jan 2021 16:20:48 -0500 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 106L525N099039; Wed, 6 Jan 2021 16:20:47 -0500 Received: from ppma02wdc.us.ibm.com (aa.5b.37a9.ip4.static.sl-reverse.com [169.55.91.170]) by mx0a-001b2d01.pphosted.com with ESMTP id 35why55d9t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 06 Jan 2021 16:20:47 -0500 Received: from pps.filterd (ppma02wdc.us.ibm.com [127.0.0.1]) by ppma02wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 106LDTUq001515; Wed, 6 Jan 2021 21:20:46 GMT Received: from b01cxnp23034.gho.pok.ibm.com (b01cxnp23034.gho.pok.ibm.com [9.57.198.29]) by ppma02wdc.us.ibm.com with ESMTP id 35tgf97umf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 06 Jan 2021 21:20:46 +0000 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 106LKkqX41157020 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 6 Jan 2021 21:20:46 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1DCE5B2066; Wed, 6 Jan 2021 21:20:46 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 827A1B205F; Wed, 6 Jan 2021 21:20:45 +0000 (GMT) Received: from Davids-MBP.randomparity.org (unknown [9.163.86.38]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 6 Jan 2021 21:20:45 +0000 (GMT) To: Nithin Dabilpuram Cc: anatoly.burakov@intel.com, david.marchand@redhat.com, jerinj@marvell.com, dev@dpdk.org References: <20201012081106.10610-1-ndabilpuram@marvell.com> <20201217190604.29803-1-ndabilpuram@marvell.com> <20201217190604.29803-4-ndabilpuram@marvell.com> <935bd057-2ec6-f42c-02a2-9b62784e4950@linux.vnet.ibm.com> From: David Christensen Message-ID: <72d7ee73-fa91-07ce-a0cb-4b1b334a5503@linux.vnet.ibm.com> Date: Wed, 6 Jan 2021 13:20:44 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343, 18.0.737 definitions=2021-01-06_12:2021-01-06, 2021-01-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 malwarescore=0 suspectscore=0 priorityscore=1501 bulkscore=0 adultscore=0 clxscore=1015 phishscore=0 mlxlogscore=999 mlxscore=0 impostorscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101060120 Subject: Re: [dpdk-dev] [PATCH v6 3/4] test: add test case to validate VFIO DMA map/unmap X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 1/6/21 12:40 AM, Nithin Dabilpuram wrote: > On Tue, Jan 05, 2021 at 11:33:20AM -0800, David Christensen wrote: >> Hey Nithin, >> >>>> +static int >>>> +test_memory_vfio_dma_map(void) >>>> +{ >>>> + uint64_t sz1, sz2, sz = 2 * rte_mem_page_size(); >>>> + uint64_t unmap1, unmap2; >>>> + uint8_t *alloc_mem; >>>> + uint8_t *mem; >>>> + int ret; >>>> + >>>> + /* Allocate twice size of requirement from heap to align later */ >>>> + alloc_mem = malloc(sz * 2); >>>> + if (!alloc_mem) { >>>> + printf("Skipping test as unable to alloc %"PRIx64"B from heap\n", >>>> + sz * 2); >>>> + return 1; >>>> + } >>>> + >>>> + /* Force page allocation */ >>>> + memset(alloc_mem, 0, sz * 2); >>>> + >>>> + mem = RTE_PTR_ALIGN(alloc_mem, rte_mem_page_size()); >>>> + >>>> + /* map the whole region */ >>>> + ret = rte_vfio_container_dma_map(RTE_VFIO_DEFAULT_CONTAINER_FD, >>>> + (uintptr_t)mem, (rte_iova_t)mem, sz); >> >> I'm not sure how to resolve this patch for POWER systems. The patch >> currently fails with the error: >> >> EAL: cannot map vaddr for IOMMU, error 22 (Invalid argument) >> >> The problem is that the size argument (page size of 64KB * 2) is smaller >> than the page size set when the DMA window is created (2MB or 1GB depending >> on system configuration for hugepages), resulting in the EINVAL error. When >> I tried bumping the sz value up to 2 * 1GB the test also failed because the >> VA address was well outside the DMA window set when scanning memseg lists. >> >> Allocating heap memory dynamically through the EAL works since it's >> allocated in hugepage size segments and the EAL attempts to keep VA memory >> addresses contiguous, therefore within the defined DMA window. But the >> downside is that the memory is DMA mapped behind the scenes in >> vfio_mem_event_callback(). >> >> Not sure how to get around this without duplicating a lot of the heap >> management code in your test. Maybe others have a suggestion. > > David, Anatoly Burakov, > > Given that both malloc'ed memory and mmap'd memory is not working for POWER9 > setup, I can either drop this test patch(3/4) alone or restrict it to non-POWER9 > system's. Since main fix is already acked, I think it shouldn't be a problem to > drop test case which was only added to demostrate the problem. > > Any thoughts ? I dislike having to special case the architecture in general but I don't see an easy solution in this case. I'd be fine with either option, dropping the test case of disabling test case support for all POWER architecture. Dave