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 14519374F for ; Sun, 11 Dec 2016 09:29:57 +0100 (CET) Received: by mail-oi0-f43.google.com with SMTP id y198so60730602oia.1 for ; Sun, 11 Dec 2016 00:29:57 -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=Zs4FVYhVFxN06po156X1wvc9RNo1/HMhz3/eMj7Bp7I=; b=dtSepyouhsBIxWv8iVeJOaz1gfO3IHm558SvBEpvMzxfCdSxPCwHv41E8D/zuRQnZJ 5mDvvZFU/QUEJDCdLWVaTbek3oqRdLSSDYGBEBrY5gL4H4S76M4hPd1jdkLCnFzJxNrp GAe8aWt7JhX1u/yYc/36hJt4SHA/Xp2dErxJsdsQFMglsVqF4znyw7pO+r8jL89iwpBH wkZxIyKWYBKL4UaQZ0Kl9tT4ihqpFT2U6LmGA9mT+4ETC6sU63XhTJnqsXaI/r/cWmVJ Cr+FVY/EBK7sMhmPtf/JrCocOC1h3UsH35SQpSSDRx+JsK97LyA2TdgrE0+TAfhZPsO9 a4xg== 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=Zs4FVYhVFxN06po156X1wvc9RNo1/HMhz3/eMj7Bp7I=; b=IcNzNIGzkGItxKUTxuO6Q+69/I+nbcxI2ULMBveamgymiX4pSMTMS58E7QcD6dMk3M iZUxYzqH1ZbIAsGXwSpuP8BurgVpWvifo97aizOSi6Ia/NZXp9h6NtUfnwR1jjNubqGj xSVoeB1O1mk1Val9xTyuBJdGSSBa3Ls+34/RSh/IcwtIFPLpw2IBFnHZQUolAIu67As6 By2QIt3VjgzhGSqOiyOaAeO2UG5lyGdw5P1KkHvkgNjZijrRXwCBzheph8hsxTYUfGi+ uPofT2GYrT4TwVGVb8vEo+tBT/uaGsD3nvtV/1w9DUSCR90RFEk2dQaXX1DSw6L+l6iH /GpA== X-Gm-Message-State: AKaTC00iOCVIODCQxaD2o/P645Q5DEP8P/WyOqWsVifiRgFVLkt0MUzOX8rm4yQ1LHAD8r37opEmKKFQA+QU8A== X-Received: by 10.202.84.214 with SMTP id i205mr47701540oib.43.1481444997123; Sun, 11 Dec 2016 00:29:57 -0800 (PST) MIME-Version: 1.0 Received: by 10.182.72.166 with HTTP; Sun, 11 Dec 2016 00:29:56 -0800 (PST) In-Reply-To: References: From: Gopakumar Choorakkot Edakkunni Date: Sun, 11 Dec 2016 00:29:56 -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 08:29:58 -0000 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 >> > >