From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi0-f43.google.com (mail-oi0-f43.google.com [209.85.218.43]) by dpdk.org (Postfix) with ESMTP id 7AD1F370 for ; Sun, 11 Dec 2016 19:52:46 +0100 (CET) Received: by mail-oi0-f43.google.com with SMTP id b126so68391657oia.2 for ; Sun, 11 Dec 2016 10:52:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=jhJ5IAM6fj1Uu93NZw+N6btInwvB4c4oRkkZFQmik0E=; b=sYSKEL+wvrc0EjOLqUkPqqfrm3jXVBWn1W+HNwEM+4eVkw9s7yPCIZYU2kxnx0nJFa cqcAhXZoHxDzVRleAI2dllRqoRl9VtBD53AyQDXC5dssWxUVzjbrC29JsOcp3kYzjP4u DC36SHIZhoaRDh7d7RZ9p+UgXR8sCCb4HnHaAvnucRq3O9SFs4KU5ACgZbJ809Qko4M3 5pLADAYQNGhm9SBmiAQGkA+6u/AFjHsNSatdjL0asCZ8tvVM7hLmsX1FqsFekjecUyxt krhI2TWez29+r8koPpgMabcgwIKfIy1IfptrVOb17khKXzRtXk+07uv8Km79DZQQnQha H5YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=jhJ5IAM6fj1Uu93NZw+N6btInwvB4c4oRkkZFQmik0E=; b=VF6SarzTOGxWLM+5SVnPsu4JBdhNmml+JvAytlDWiOBHeYS1syH8nWYdkdYVkVN5V6 2XGsMY6YmQFhpOFq0cUF2BLVfftFWpF4oFQ+PXXXN8dgYRJGJF22OKfR/gu6Mv9HcH7R y2re7r8ZwBFZyxMV08yLX6ataN8kmJiKOpSQuMuugRyNJaJmngcYp6Og7K34UydySF5s 7gRbpA4xPY/u1Pf5kMRd1goHXcOjmgb8UMumVjx1lNQp2EWQ7PbqeVMQzyzSpsM6txMR 5tzo744dpSrwSYwyXBTlQCax/vPzds1MGI+HDp7tZQdCFZqWC2FKc/Upkuk22/66aggv oNKQ== X-Gm-Message-State: AKaTC01LppADMXmU0k/OFW2exFyZIxIzXpw/JNULXSJz+E/CD9SHog4Tg3SsbcF2cWWSiF+i7x5Zm+wFOsPRoQ== X-Received: by 10.202.245.143 with SMTP id t137mr47812887oih.78.1481482350602; Sun, 11 Dec 2016 10:52:30 -0800 (PST) MIME-Version: 1.0 Received: by 10.182.72.166 with HTTP; Sun, 11 Dec 2016 10:52:30 -0800 (PST) In-Reply-To: References: From: Gopakumar Choorakkot Edakkunni Date: Sun, 11 Dec 2016 10:52:30 -0800 Message-ID: To: dev@dpdk.org, Olivier Matz Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] dpdk16.07 and virtio "Cannot mmap IO port resource" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Dec 2016 18:52:46 -0000 nevermind .. I saw the hew ARCH_X86 flag which I dint realise I have to add in my config file when I moved from dpdk2.0 On Sun, Dec 11, 2016 at 12:29 AM, Gopakumar Choorakkot Edakkunni < gopakumar.c.e@gmail.com> wrote: > Somewhere I read that the "offset" parameter for sysfs mmap() needs to be > the start address of the resource, so I tried the below diff, and mmap > still fails .. Still scratching my head > > diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c > b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c > index 1786b75..e882940 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c > +++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c > @@ -462,8 +462,8 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar, > strerror(errno)); > goto error; > } > - addr = mmap(NULL, end_addr + 1, PROT_READ | PROT_WRITE, > - MAP_SHARED, fd, 0); > + addr = mmap(NULL, (end_addr-phys_addr) + 1, PROT_READ | PROT_WRITE, > + MAP_SHARED, fd, phys_addr); > close(fd); > if (addr == MAP_FAILED) { > RTE_LOG(ERR, EAL, "Cannot mmap IO port resource: %s\n", > @@ -473,7 +473,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar, > > /* strangely, the base address is mmap addr + phys_addr */ > p->base = (uintptr_t)addr + phys_addr; > - p->len = end_addr + 1; > + p->len = (end_addr-phys_addr) + 1; > RTE_LOG(DEBUG, EAL, "PCI Port IO found start=0x%"PRIx64"\n", > p->base); > fclose(f); > > On Sat, Dec 10, 2016 at 3:21 PM, Gopakumar Choorakkot Edakkunni < > gopakumar.c.e@gmail.com> wrote: > >> Hi Oliver, >> >> Looking at the kernel code pci_mmap_resource()--->pci_mmap_fits(), it >> looks like pci_mmap_fits() expects that the "number of pages" requested to >> map is no larger than the actual size of the pci resource. But in >> pci_uio_ioport_map() what is passed as the requested size is the end_addr >> of the resource, which in my case is 0xc09f, but the size of the resource >> itself is 0x20 and hence kernel expects one page - but 0xc09f+1 >> (end_addr+1) gets translated to 13 pages ! And I guess that leads to the >> mmap to fail .. Thoughts on this ? >> >> Rgds, >> Gopa. >> >> >> On Fri, Dec 9, 2016 at 8:30 PM, Gopakumar Choorakkot Edakkunni < >> gopakumar.c.e@gmail.com> wrote: >> >>> I tried to load up dpdk (bound to uio_pci_generic, tried igb_uio also!) >>> on a virtio interface. Dpdk exits with the "Cannot mmap IO port resource" >>> complaint - the call chain is legacy_virtio_resource_init()-->pci_uio_ioport_map(). >>> >>> >>> If anyone can give any clues/pointers as to what might be wrong, that >>> can greatly help in getting me on the right track fast ! >>> >>> --- >>> EAL: probe driver: 1af4:1000 rte_virtio_pmd >>> EAL: PCI device 0000:00:05.0 on NUMA socket 0 >>> EAL: probe driver: 1af4:1000 r[ 330.753458] ------------[ cut here >>> ]------------ >>> rte_virtio_pmd >>> [ 330.754430] WARNING: CPU: 0 PID: 8063 at drivers/pci/pci-sysfs.c:984 >>> pci_mmap_resource.isra.14+0x113/0x1b0() >>> [ 330.756083] process "dpdk_master" tried to map 0x0000d000 bytes at >>> page 0x00000000 on 0000:00:05.0 BAR 0 (start 0x c080, size >>> 0x 20) >>> [ 330.758272] Modules linked in: rte_kni igb_uio pppoe ppp_async >>> iptable_nat cdc_mbim sierra_net rndis_host qmi_wwan qcserial pppox >>> ppp_generic option nf_nat_pptp nf_nat_ipv4 nf_nat_amanda nf_conntrack_pptp >>> nf_conntrack_ipv4 nf_conntrack_amanda ipt_MASQUERADE huawei_cdc_ncm >>> cdc_subset cdc_ncm cdc_ether cdc_eem ax88179_178a asix xt_u32 xt_time >>> xt_tcpmss xt_string xt_statistic xt_state xt_socket xt_recent xt_quota >>> xt_pkttype xt_physdev xt_owner xt_nat xt_multiport xt_mark xt_mac xt_limit >>> xt_length xt_iprange xt_id xt_hl xt_helper xt_hashlimit xt_esp xt_ecn >>> xt_dscp xt_conntrack xt_connmark xt_connlimit xt_connbytes xt_comment >>> xt_addrtype xt_TPROXY xt_TEE xt_TCPMSS xt_REDIRECT xt_NETMAP xt_LOG xt_LED >>> xt_HL xt_DSCP xt_CT xt_CLASSIFY usbnet usb_wwan ts_kmp ts_fsm ts_bm slhc >>> sierra pl2303 nfnetlink_queue nfnetlink_log nf_nat_tftp nf_nat_snmp_basic >>> nf_nat_sip nf_nat_proto_gre nf_nat_irc nf_nat_h323 nf_nat_ftp nf_nat >>> nf_defrag_ipv4 nf_conntrack_tftp nf_conntrack_snmp nf_conntrack_sip >>> nf_conntrack_proto_gre nf_conntrack_netlink nf_conntrack_irc >>> nf_conntrack_h323 nf_conntrack_ftp nf_conntrack_broadcast >>> lib80211_crypt_wep lib80211_crypt_tkip lib80211_crypt_ccmp lib80211 >>> iptable_raw iptable_mangle iptable_filter ipt_ah ipt_ULOG ipt_REJECT >>> ipt_ECN hso ftdi_sio crc8 crc7 crc_itu_t crc_ccitt cp210x cordic >>> compat_xtables cdc_wdm cdc_acm arptable_filter arpt_mangle arp_tables >>> sch_teql sch_tbf sch_sfq sch_red sch_prio sch_netem sch_htb sch_gred >>> sch_dsmark sch_codel em_text em_nbyte em_meta em_cmp cls_basic act_police >>> act_ipt act_connmark act_skbedit act_mirred em_u32 cls_u32 cls_tcindex >>> cls_flow cls_route cls_fw sch_hfsc sch_ingress evdev xt_NFQUEUE xt_set >>> ip_set_list_set ip_set_hash_netport ip_set_hash_netiface ip_set_hash_net >>> ip_set_hash_ipportnet ip_set_hash_ipportip ip_set_hash_ipport >>> ip_set_hash_ip ip_set_bitmap_port ip_set_bitmap_ipmac ip_set_bitmap_ip >>> ip_set nfnetlink sr_mod cdrom ip6t_REJECT ip6table_raw ip6table_mangle >>> ip6table_filter ip6_tables nf_conntrack_ipv6 nf_conntrack nf_defrag_ipv6 >>> ifb ipip ip6_tunnel tunnel6 tunnel4 ip_tunnel tun mdio loop vfat fat isofs >>> nls_utf8 nls_iso8859_15 nls_iso8859_1 nls_cp850 nls_cp437 rfkill virtio_rng >>> sha512_generic sha256_generic sha1_generic md5 arc4 ath10k_pci ath10k_core >>> ath9k ath9k_common ath9k_hw ath mac80211 cfg80211 compat pcnet32 e1000 >>> virtio_net ohci_hcd ixgbevf ixgbe hwmon igbvf igb dsa_core mii [last >>> unloaded: igb_uio] >>> [ 330.805110] CPU: 0 PID: 8063 Comm: dpdk_master Tainted: G W >>> 3.14.67 #1 >>> [ 330.806104] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), >>> BIOS Bochs 01/01/2011 >>> [ 330.806104] 0000000000000286 0000000000000000 ffffffff814e167c >>> 0000000000000006 >>> [ 330.806104] ffff88008b573cd8 ffffffff81259d73 ffffffff81061b72 >>> ffff88013b24fae0 >>> [ 330.806104] ffff88013b24f800 0000000000000000 ffff88013a498000 >>> ffff88013b24f8a8 >>> [ 330.806104] Call Trace: >>> [ 330.806104] [] ? dump_stack+0x5e/0x7a >>> [ 330.806104] [] ? pci_mmap_resource.isra.14+0x11 >>> 3/0x1b0 >>> [ 330.806104] [] ? warn_slowpath_common+0x82/0xb0 >>> [ 330.806104] [] ? warn_slowpath_fmt+0x45/0x50 >>> [ 330.806104] [] ? do_last.isra.58+0xac1/0xc00 >>> [ 330.806104] [] ? pci_mmap_resource.isra.14+0x11 >>> 3/0x1b0 >>> [ 330.806104] [] ? kernfs_fop_mmap+0x69/0x100 >>> [ 330.806104] [] ? mmap_region+0x2e8/0x560 >>> [ 330.806104] [] ? do_mmap_pgoff+0x318/0x3b0 >>> [ 330.806104] [] ? vm_mmap_pgoff+0x74/0xc0 >>> [ 330.806104] [] ? SyS_mmap_pgoff+0x18a/0x1e0 >>> [ 330.806104] [] ? system_call_fastpath+0x16/0x1b >>> [ 330.823897] ---[ end trace c6106b67c768d501 ]--- >>> EAL: Cannot mmap IO port resource: Invalid argument >>> EAL: Error - exiting with code: 1 >>> Cause: Requested device 0000:00:05.0 cannot be used >>> >> >> >