From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f52.google.com (mail-pa0-f52.google.com [209.85.220.52]) by dpdk.org (Postfix) with ESMTP id B240211C5 for ; Fri, 6 Mar 2015 17:21:01 +0100 (CET) Received: by pabrd3 with SMTP id rd3so19098663pab.6 for ; Fri, 06 Mar 2015 08:21:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=6HFQNEiTMS+anDDmldEbEr9G2RyBxE2lbWzfDYw/gwE=; b=k5qm+KcGLuhKMqqMbFrZMltrPgWnbPbKsHxuSWUhySoAeu56NrWB6PJnmj5K0XeBCg XYt754YqWb7i0eATb8nWNTQIoCSVDoo4KrbLS+QoF7tmCkT3b1jFsKknyp+8WdQw72/c AAaIn33ZOpq1PXSbrcskYBJ7s0IlKnjCIfFN0U1Xf3lHTjlRRYs3Xrvbj33Y2ZZMy52T zS7pQ2eAsxJ6h5Wq9na6EJy+A9Sjzd3X3wKxG31jWvOAzQZnCIM9VcJXnSncLW+zKpxN t6hD03NaO8Bv5xm2KIxclcWVGscYMXwYuiwphEcnUsAOMrqoM6tX7SdqYk64U+hT8lZ9 oHHA== X-Gm-Message-State: ALoCoQnPzp92tZIzyKo2MjoiBhPFPRJ10aB04bI2MzWFVt7fE/tcHs8I2B3gD4lzZrQCBWM92WIF X-Received: by 10.68.217.228 with SMTP id pb4mr26496471pbc.129.1425658860796; Fri, 06 Mar 2015 08:21:00 -0800 (PST) Received: from urahara (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by mx.google.com with ESMTPSA id dm6sm9911377pdb.63.2015.03.06.08.21.00 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Mar 2015 08:21:00 -0800 (PST) Date: Fri, 6 Mar 2015 08:20:57 -0800 From: Stephen Hemminger To: "Ouyang, Changchun" Message-ID: <20150306082057.5c505f54@urahara> In-Reply-To: References: <1425602726-26538-1-git-send-email-stephen@networkplumber.org> <1425602726-26538-2-git-send-email-stephen@networkplumber.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH 1/2] virtio: initialize iopl when device is initialized X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Mar 2015 16:21:02 -0000 On Fri, 6 Mar 2015 03:41:25 +0000 "Ouyang, Changchun" wrote: > > > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen > > Hemminger > > Sent: Friday, March 6, 2015 8:45 AM > > To: dev@dpdk.org > > Subject: [dpdk-dev] [PATCH 1/2] virtio: initialize iopl when device is initialized > > > > The virtio driver needs to use in/out instructions therefore it must initialize > > using iopl(2) system call. The problem is that virtio initialization happens very > > early, and any application that uses daemon() or calls eal_init later in another > > context will fail. > > > > The fix is to move the iopl into rte_eal_init. > > > > Why need move virtio specific code into rte_eal_init? > thanks > Changchun > The issue is that virtio has no place it can do iopl() and have the IRQ thread work. It only shows up on real code where application is daemon, not in a toy demo or test application. Right now: gcc start rte_virtio_pmd_init iopl main daemon fork fork Process is now child of init not original process rte_eal_init fork (pthread) for irq thread irq thread (no iopl permssion) program start rte_pmd_virtio_configure So the only place where iopl() can be done in the proper context so that the IRQ (and other helper threads in future) have the correct permissions is in eal_init.