I tried my best to make iopl work but couldnt, i wrote a small 'c' program that does only iopl()  and even that does not work, neither on the host machine nor on the VM in docker ... i am wondering if this has anything to do with bios settings ...i tried it on different machines too ... root permissions, explicity setting capset ... etc .. i tried them all but still does not work ... quite frustrating how many hours i had to spent trying different things... thanks On Friday, August 3, 2018, 2:24:28 PM PDT, Stephen Hemminger wrote: On Wed, 1 Aug 2018 16:27:49 +0000 (UTC) amit sehas wrote: > I am trying to run a dpdk application in docker and i get the above error ... the docker instance was run as below: > > docker run -dit --name -v /hostlibpath:/contlibpath:ro fedora:26 bash > > i am new to dpdk, as a result i am quite lost as to where to look ... > > thanks Short answer virtio requires DPDK process to be run as root. In order for the virtio device to signal the underlying host it may need the in/out instructions. These CPU instructions are normally privileged (only allowed in kernel) but on Linux there is is a system call to allow a process with root (really CAP_SYS_RAWIO) to do these from userspace. See iopl manual page. The actual answer is more complex. Older versions of virtio (legacy) use in/out but the current version (modern) can use memory read/write.  Ideally, the DPDK virtio would only ask for IOPL privilege if it needed it. The problem is that may need it during the negotiation process. Someone should look into fixing this. From stephen@networkplumber.org Sat Aug 4 00:22:00 2018 Return-Path: Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by dpdk.org (Postfix) with ESMTP id 90A581B5C4 for ; Sat, 4 Aug 2018 00:22:00 +0200 (CEST) Received: by mail-pg1-f195.google.com with SMTP id r5-v6so3466911pgv.0 for ; Fri, 03 Aug 2018 15:22:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s 150623; hÚte:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IzosJVJk8sWwKlKVQsTAYzj2g5D1wSpaDcg1w8wi2tQ=; b=LjmzFkAk4GqRMXcWb/smm3MdsKAaLu0Q9hWj16wTAezFqMYd6UbcuGyqlG4btYMQ48 8saFkqr7M3p2l/H4/kliKuccJuo2a/m8Kfc86qkZPtUfC9LD6XGtNEyy+hzjaWwHCMtJ QWqWPkDAGIsFzsOve7RBilaVPqetu2d6BgHTJrJCOt0n4azdpujKR4Dc/b4rWvYKz6kS XZXOLzm0eOjmCwQrZVcQo5lz6oSqUreTSnZ6GEFfXfhcjr6MsAs6tQlTUm1IHPY+c+TV ld0iUtGpx86qhiloDIZjxCWb5PLX99bSB5sffoyTVBYfg9iSvUihgiMaE11zJW/uu9St xgyQ=X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d100.net; s 161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IzosJVJk8sWwKlKVQsTAYzj2g5D1wSpaDcg1w8wi2tQ=; b=gRuTD9mG1cuF0rY4C8DMYbVRSteXn7TjuY+AQoUXA18OXRLI3zHuR7wtt0PPXEqXhy GC9ty/E282rv3CozwdlZ9XH8bW8at64MfTEN0o6PVHy7LTt4dHj0gzwZ6I+ycFjmXEJW /8ZSq+ERE5FiuimPor3r+9MqeR6rFAiqYJTUH7ESYyLOwYrblW0a+sgOafxLCbI2pr+Q HLkwID3g5oQx3rvRcKFwyb/CekZTxgjlyDCc28fZVISDkmhvDRd7Yq0of6Lyd+DlpPE5 mvBE3tNEpHSkSMOBRxepArRsjoeAI9VJBxeoeXXCONNxxxsuUOkexFtw0s2mw37Dr5E3 jyTQ=X-Gm-Message-State: AOUpUlEJf7+kNwzSi+aJ3F36hkswEGm3si5mS2MqItZq8gEB7XPSbgFH 9bMA8zgQLWlRM664gmiF4gQbv4IPQf0X-Google-Smtp-Source: AAOMgpeAbw26mzUqm7z7rPtSQqFB0iFsfhcbgKqpshQ9zvWv+6ezbz4GUDt1AeR3ciKOfIiIOUeOqQ=X-Received: by 2002:a63:375b:: with SMTP id g27-v6mr5493715pgn.59.1533334919681; Fri, 03 Aug 2018 15:21:59 -0700 (PDT) Received: from xeon-e3 (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id h10-v6sm11118033pfj.78.2018.08.03.15.21.59 (version=TLS1_2 cipherìDHE-RSA-CHACHA20-POLY1305 bits%6/256); Fri, 03 Aug 2018 15:21:59 -0700 (PDT) Date: Fri, 3 Aug 2018 15:21:50 -0700 From: Stephen Hemminger To: amit sehas Cc: maxime.coquelin@redhat.com, users@dpdk.org Message-ID: <20180803152150.10c1ecc4@xeon-e3> In-Reply-To: <607910178.1827758.1533334812223@mail.yahoo.com> References: <1685797689.496737.1533140869394.ref@mail.yahoo.com> <1685797689.496737.1533140869394@mail.yahoo.com> <20180803142420.1198b64b@xeon-e3> <607910178.1827758.1533334812223@mail.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-users] rte_virtio_pmd_init(): IOPL call failed - cannot use virtio PMD X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Aug 2018 22:22:01 -0000 On Fri, 3 Aug 2018 22:20:12 +0000 (UTC) amit sehas wrote: What was the error? Are you running on KVM, what version? Or some other hypervisor like virtualbox? > I tried my best to make iopl work but couldnt, i wrote a small 'c' program that does only iopl()  and even that does not work, neither on the host machine nor on the VM in docker ... i am wondering if this has anything to do with bios settings ...i tried it on different machines too ... root permissions, explicity setting capset ... etc .. i tried them all but still does not work ... quite frustrating how many hours i had to spent trying different things... > > thanks > > > On Friday, August 3, 2018, 2:24:28 PM PDT, Stephen Hemminger wrote: > > On Wed, 1 Aug 2018 16:27:49 +0000 (UTC) > amit sehas wrote: > > > I am trying to run a dpdk application in docker and i get the above error ... the docker instance was run as below: > > > > docker run -dit --name -v /hostlibpath:/contlibpath:ro fedora:26 bash > > > > i am new to dpdk, as a result i am quite lost as to where to look ... > > > > thanks > > Short answer virtio requires DPDK process to be run as root. > > In order for the virtio device to signal the underlying host it may need the in/out instructions. > These CPU instructions are normally privileged (only allowed in kernel) but on Linux there is > is a system call to allow a process with root (really CAP_SYS_RAWIO) to do these from userspace. > See iopl manual page. > > The actual answer is more complex. Older versions of virtio (legacy) use in/out but the > current version (modern) can use memory read/write.  Ideally, the DPDK virtio would only > ask for IOPL privilege if it needed it. The problem is that may need it during the negotiation > process. Someone should look into fixing this. >