From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AD079A0C3F for ; Mon, 10 May 2021 14:42:27 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9B4B7410FE; Mon, 10 May 2021 14:42:27 +0200 (CEST) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by mails.dpdk.org (Postfix) with ESMTP id 3063C4003E; Mon, 10 May 2021 14:42:25 +0200 (CEST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id BE1495C0158; Mon, 10 May 2021 08:42:24 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 10 May 2021 08:42:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=fm1; bh= yeatO1PusXDrvoiFQ/9zKqicrhpzpIfMrcEnMX/RxLY=; b=Oli4j0P3jdQO9IFC A0OIMkcH9/DBYkgRsxKjrgkG/0cJCGjCZabzZ7dmFGFN7v4XmF91MV4o+vJHt8VO SXvwZ14T3p0QatQjNQvGZAlMvvfwhdWqeRjkh/JfNpKhf9PaPPU2VuVqS3UH/LRi omFUB4GqTOuMbc0aHPRAKvifBD/kAIxpTsYldaKYkyw2hxUQ8kik94ssY2N3/jWD akOTKLn7zyPAuSgRXsTVWc2wSQKebxNmyhg/sgG1nc0xMJijokvNVLXom2ZWBbVv yb3WqqEeL28zVLrkR1i9rG9rug9Knjf3uP8TO2t/daHKYwuGufYbDlnK+DYI74Wp qBpTJA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=yeatO1PusXDrvoiFQ/9zKqicrhpzpIfMrcEnMX/Rx LY=; b=rJ9qIcRhQXuJ1YDUJxeWpMe8lEFNAi903q07FfmEcTEJYFYUjdJ4eLG/2 1m4NSg/FWlcVafTHdZCQF5vjclOBH90uQrtOj3+yvRPQsbW2q6R9JuPsdk686ior uSfwj6cVtxJrQFXslpbDH2DESpnbDCT/JENH+z0X8GA5Uos7I7i1fMm3ujivbQ2U nh0id/3Yu3y7590ARDYb7TYcg2hpvVH1t4VLxCGgpPfQIIIuvy318QZ01NL7nVBb wSKBP3UV5uiXaIH7SM6J/qywlMP7vVFPaGEWSmLp0dnzR5xrglDrwbi5JwEFZTnD myDyRq1zrEpcqk+b77JDDmdTcgbCA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdegkedgheehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepudeggfdvfeduffdtfeeglefghfeukefgfffhueejtdetuedtjeeu ieeivdffgeehnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl ohhnrdhnvght X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 10 May 2021 08:42:23 -0400 (EDT) From: Thomas Monjalon To: Lance Richardson Cc: Dmitry Kozlyuk , Narcisa Ana Maria Vasile , Dmitry Malloy , Pallavi Kadam , dev@dpdk.org, stable@dpdk.org, anatoly.burakov@intel.com Date: Mon, 10 May 2021 14:42:22 +0200 Message-ID: <2003089.4ItjxMFgZf@thomas> In-Reply-To: <20210508142753.114343-1-lance.richardson@broadcom.com> References: <20210507181025.84012-1-lance.richardson@broadcom.com> <20210508142753.114343-1-lance.richardson@broadcom.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH v3] eal: fix memory mapping for 32-bit targets X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" +Cc Anatoly 08/05/2021 16:27, Lance Richardson: > For 32-bit targets, size_t is normally a 32-bit type and > does not have sufficient range to represent 64-bit offsets > that can are needed when mapping PCI addresses. Use uint64_t > instead. > > Found when attempting to run 32-bit Linux dpdk-testpmd > using VFIO driver: > > EAL: pci_map_resource(): cannot map resource(63, 0xc0010000, \ > 0x200000, 0x20000000000): Invalid argument ((nil)) > > Fixes: c4b89ecb64ea ("eal: introduce memory management wrappers") > Cc: stable@dpdk.org > Signed-off-by: Lance Richardson > --- > v3: Use PRIx64 instead of llx to format offset in log message. > v2: Use uint64_t instead of off_t (off_t is unknown to Windows). > > lib/eal/include/rte_eal_paging.h | 2 +- > lib/eal/unix/eal_unix_memory.c | 11 ++++++----- > lib/eal/windows/eal_memory.c | 2 +- > 3 files changed, 8 insertions(+), 7 deletions(-) > > diff --git a/lib/eal/include/rte_eal_paging.h b/lib/eal/include/rte_eal_paging.h > index ed98e70e9e..c60317d0f5 100644 > --- a/lib/eal/include/rte_eal_paging.h > +++ b/lib/eal/include/rte_eal_paging.h > @@ -61,7 +61,7 @@ enum rte_map_flags { > __rte_internal > void * > rte_mem_map(void *requested_addr, size_t size, int prot, int flags, > - int fd, size_t offset); > + int fd, uint64_t offset); > > /** > * OS-independent implementation of POSIX munmap(3). > diff --git a/lib/eal/unix/eal_unix_memory.c b/lib/eal/unix/eal_unix_memory.c > index ec7156df96..68ae93bd6e 100644 > --- a/lib/eal/unix/eal_unix_memory.c > +++ b/lib/eal/unix/eal_unix_memory.c > @@ -5,6 +5,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -24,14 +25,14 @@ > > static void * > mem_map(void *requested_addr, size_t size, int prot, int flags, > - int fd, size_t offset) > + int fd, uint64_t offset) > { > void *virt = mmap(requested_addr, size, prot, flags, fd, offset); > if (virt == MAP_FAILED) { > RTE_LOG(DEBUG, EAL, > - "Cannot mmap(%p, 0x%zx, 0x%x, 0x%x, %d, 0x%zx): %s\n", > - requested_addr, size, prot, flags, fd, offset, > - strerror(errno)); > + "Cannot mmap(%p, 0x%zx, 0x%x, 0x%x, %d, 0x%"PRIx64"): %s\n", > + requested_addr, size, prot, flags, fd, offset, > + strerror(errno)); > rte_errno = errno; > return NULL; > } > @@ -106,7 +107,7 @@ mem_rte_to_sys_prot(int prot) > > void * > rte_mem_map(void *requested_addr, size_t size, int prot, int flags, > - int fd, size_t offset) > + int fd, uint64_t offset) > { > int sys_flags = 0; > int sys_prot; > diff --git a/lib/eal/windows/eal_memory.c b/lib/eal/windows/eal_memory.c > index 2cf5a5e649..4db048ccb5 100644 > --- a/lib/eal/windows/eal_memory.c > +++ b/lib/eal/windows/eal_memory.c > @@ -508,7 +508,7 @@ eal_mem_set_dump(void *virt, size_t size, bool dump) > > void * > rte_mem_map(void *requested_addr, size_t size, int prot, int flags, > - int fd, size_t offset) > + int fd, uint64_t offset) > { > HANDLE file_handle = INVALID_HANDLE_VALUE; > HANDLE mapping_handle = INVALID_HANDLE_VALUE; >