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 7A163A09FF; Wed, 6 Jan 2021 09:40:32 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EC40C160886; Wed, 6 Jan 2021 09:40:31 +0100 (CET) Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by mails.dpdk.org (Postfix) with ESMTP id 554301607EA for ; Wed, 6 Jan 2021 09:40:30 +0100 (CET) Received: by mail-pl1-f179.google.com with SMTP id s15so1200266plr.9 for ; Wed, 06 Jan 2021 00:40:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=F1A5tSYBBwPCnbRPhhKtWCXtroqESfaUId/8kGRM7bk=; b=BjTt4hmd9/e59Rx1WLquBRPjCKi3Ktp/xBYHZK1aytuZTiQa22v6uIJzE8dnm381dN YCwjzg1TjCiilxCSVubo9VLXeq6GxzF65wMKEjbbQYz/1HkS8AFNxcQPoYa5Ut6FQx91 lHOc8QvYC/BQoUaXJ2a6mOID3Q0+/lrii7TunJPcs9xhNBg5bgps6lLT/41EOHLF00Sz mgxIpntf9As1aQnhd8NpkjtMnwBvp+V9EKD87nKOAkVKkDSP7dydENBIIFmIIWn8rCxP 9Xb7zcsWXKAoJB9Qa81sp8Or9wYLGr7O29M/ZNuf1sn3ufUa/dKviaV5XZyFNjae5lic LNKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=F1A5tSYBBwPCnbRPhhKtWCXtroqESfaUId/8kGRM7bk=; b=B8Zu+XWfLeKmN6VzFQpUusOmEnfAtHjFKbrU/TkroExcEsks1TP9+ehBEjbbf2vJZp yFlzC3+sHnp/7w23Vs9y89jdqW8GrH0zStsoOficoVuK3hxDH289db8DvknejKi2xGZI ja88AZGw0IIbQRAa7xEXAmMMSJLSUh3dPnHHEicT6+3cGvX3mM0cbvqY1imlpnG2TW+x mWMUser9OTc8rEO4xit1dyNO93qV3mAO4mLisd/432tTvjcDboEUCDwvy1w4+acW1djd YY+GC2E+ADXlzgzyu0O2pQxTIGip+aMTdP6p0biy7geP4owmgo4pNkXnXgsRnK4F3yZu jU+g== X-Gm-Message-State: AOAM530q+olWwjKV2BHnvd296xoHXxGEPCsrUus2VIEXc+gX3gwYaNfE 4EzCYv0zvjBEo5k1mZ99TuA= X-Google-Smtp-Source: ABdhPJxnZ96Ve5bEy8KDo29mrMjQMoIhkgE8A9jl2SkbRTbaqAXEwZzXoQsx23v+76pbkXBJ+fxb0g== X-Received: by 2002:a17:902:8a88:b029:dc:f3:6db2 with SMTP id p8-20020a1709028a88b02900dc00f36db2mr3646058plo.2.1609922429433; Wed, 06 Jan 2021 00:40:29 -0800 (PST) Received: from gmail.com ([1.6.215.26]) by smtp.gmail.com with ESMTPSA id u15sm1589712pju.7.2021.01.06.00.40.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Jan 2021 00:40:28 -0800 (PST) Date: Wed, 6 Jan 2021 14:10:21 +0530 From: Nithin Dabilpuram To: David Christensen Cc: anatoly.burakov@intel.com, david.marchand@redhat.com, jerinj@marvell.com, dev@dpdk.org Message-ID: 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <935bd057-2ec6-f42c-02a2-9b62784e4950@linux.vnet.ibm.com> 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 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 ? > > Dave