From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com [209.85.212.180]) by dpdk.org (Postfix) with ESMTP id 5A86C5680 for ; Wed, 29 Jul 2015 19:27:32 +0200 (CEST) Received: by wicmv11 with SMTP id mv11so228029297wic.0 for ; Wed, 29 Jul 2015 10:27:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=6KEUaiqbWrvBQ4pBBRblTOVyhFhTW+cvefMqvEtBTGk=; b=PKsMtTBPPEXxhQfAeCmAPZ2VaQSKStyrL6Dj9wpi+Lx8hLp22CY1QCXK2RfpvdD7F1 hclq4xdYakjrmz2XrMaZAncPXU/Um7w+VtpjVAP+TW/kTO/3PN0Fmh1oiUeTnz3yWiOW f03biXNVSPqN/+QqtWmD53hWpdTRlLKlKAEqJEHL/tNN2xqVzIRn66kNLcfulcSGPRrc lMr/sdGj/6JbnePh3RYyRbjaSR8X1YALKS41RxfvMifekCszDtEfzeQyAk+S54jZtIL6 mXtOSpYh0ueUCFP+j2n/K0eDVmYQ6crXXiJKDKIvAtlAwq6ISVZt/7B581eFFxHJn2rN erFg== X-Gm-Message-State: ALoCoQmsUgnZQP7Xz0E/qtOLD2F6Y9IseNNQLxQktLqjFHfkvHpAkiiB27hQaKsnDbyqUGsgZ/XL X-Received: by 10.180.208.114 with SMTP id md18mr8046478wic.31.1438190852184; Wed, 29 Jul 2015 10:27:32 -0700 (PDT) Received: from xps13.localnet (6wind.net2.nerim.net. [213.41.151.210]) by smtp.gmail.com with ESMTPSA id yu4sm19415936wjc.43.2015.07.29.10.27.30 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Jul 2015 10:27:31 -0700 (PDT) From: Thomas Monjalon To: Stephen Hemminger Date: Wed, 29 Jul 2015 19:26:17 +0200 Message-ID: <3368758.BASS8qfG8B@xps13> Organization: 6WIND User-Agent: KMail/4.14.8 (Linux/4.0.4-2-ARCH; KDE/4.14.8; x86_64; ; ) In-Reply-To: <20150306082057.5c505f54@urahara> References: <1425602726-26538-1-git-send-email-stephen@networkplumber.org> <20150306082057.5c505f54@urahara> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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: Wed, 29 Jul 2015 17:27:32 -0000 2015-03-06 08:20, Stephen Hemminger: > 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 This call tree is wrong. Below is the right (and more complete) one: gcc start driver constructor rte_eal_driver_register (if .a) main rte_eal_init eal_parse_args rte_eal_pci_init rte_eal_memory_init rte_eal_intr_init pthread_create eal_intr_thread_main eal_intr_handle_interrupts eal_intr_process_interrupts virtio_interrupt_handler dlopen (if .so) driver constructor rte_eal_driver_register rte_eal_dev_init driver->init rte_virtio_pmd_init rte_eal_iopl_init rte_eth_driver_register pthread_create rte_eal_pci_probe driver->devinit rte_eth_dev_init rte_eth_dev_allocate eth_drv->eth_dev_init eth_virtio_dev_init virtio_resource_init > 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. No there are 2 other possible solutions: 1) Move rte_eal_intr_init() after rte_eal_dev_init(). 2) Move dlopen() before rte_eal_intr_init() and call iopl in the constructor. With the second solution, we must also keep an iopl call in rte_virtio_pmd_init() to return an error if iopl fails. The second solution was proposed in the series sent by David: http://dpdk.org/ml/archives/dev/2015-March/014931.html http://dpdk.org/ml/archives/dev/2015-March/014932.html