Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4039270ybg; Fri, 25 Oct 2019 12:26:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqzWsnJBpE/HKQINZ3qvBQD6Edbh3ALud4yLrbjQXSNn9eo7G++4A1rOEEFU2e/JcHArI2hW X-Received: by 2002:a50:fa82:: with SMTP id w2mr5893025edr.30.1572031594111; Fri, 25 Oct 2019 12:26:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572031594; cv=none; d=google.com; s=arc-20160816; b=h0NBG4WzWcDdMHivFI2rpeyIIK+WeqsbcUvLpfC+3+zYUL0slbwtxJkMxRPTdvFbOX k+TxzvzTWLBrXszFecI9eV9oXE0j5vfKCo0W6YFCkzIZFEXlJIKhTkorlNAUTFx5crfM puA8EGEkHzgOPsSSHhwYJ9ZR77ledp6FR2mMoJlf6cXKR4V7Ay9dpcDci0jMkfx1suyN xfuf+iGc1emdwHhz2fTGONQkRynF5xv7UJ27RzddgaFpBbx+EaitAfTtKbjw9Gxbx5XZ /O3BUw3lePHEcdxQU8cZUBeUl24QVX8OzoRlyjGWP1Px0phwHgcusn1ct9SgPMx4e3uL /R/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=yGx12ZWXQdTQ4DA+CRwxn3Wgl8jiBGsaV9L7QOn8O5g=; b=HoRwCfy3VT0afR1OQyJUN3w7GF9RgUm6g/CDugfMBnNi1PwnfInE8B/6ElcHXaM6n8 +hU359jZK7ZLqjjZjvO539uPQKYCWhtjOgjjAWflqGQBxjM7GgvkfbCJhVDVod/SRvlO JWPQNM9S7WptW7oAcd/JGHFviRTEQJgy1RASIgUN0YIu2D1Ji4Q1jSBZKTPFnJ7HemuT aI3gTgP/XvW+KdGHwUfDXxYf6Js1w7TlSZeClkagbYQUS3IvR2Sh4qdFjZn9DE2dd5Wj k9Oinbq2vc0hXYMXuBy6+OAx37EHBw6u5Gz69W/wiq9zMzLJVwjPIyp75CZ5nAu7xGa6 x/kA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 93si1324400edo.408.2019.10.25.12.26.10; Fri, 25 Oct 2019 12:26:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393232AbfJYHWj (ORCPT + 99 others); Fri, 25 Oct 2019 03:22:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44042 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392610AbfJYHWj (ORCPT ); Fri, 25 Oct 2019 03:22:39 -0400 Received: from mail-ua1-f69.google.com (mail-ua1-f69.google.com [209.85.222.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6EBB15AFDE for ; Fri, 25 Oct 2019 07:22:38 +0000 (UTC) Received: by mail-ua1-f69.google.com with SMTP id h15so375622uan.4 for ; Fri, 25 Oct 2019 00:22:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=yGx12ZWXQdTQ4DA+CRwxn3Wgl8jiBGsaV9L7QOn8O5g=; b=mZxRX0Lb3Z+lk/op4JTLQDgE9P9Vsbip+6yCwAJNpGHiC7NvfTgqNWkgN9v8nreH9+ XURS7r+6xMj3eLnZxpdvT9iqdaMmlQ15vJertv7wzrKLOzjGYpgB+tReICPoimVnyEiN pdfa1eCuIK+Ity8c/WYNvM/N02bUHa9dFnAixXDGGEoIBl6VPJQsAxG/R4XFoEPkbkWc pEmc6f+z/GwSfwfrpsNb8ffPY9jS0d3EFiCDShMq4P+8GwN1u74130RDT0i8LgrdjyP+ ir2EsVcSCJY/DMg+VkKUYuc7636BZCtsqPM/XNeHeTwj1wqEeD1gezK7vDlKbEsi7Jmv /ZCA== X-Gm-Message-State: APjAAAUDxn6OGG0AhvbRX9+U7MBZ+Da5JhdXV+HkIugZIOPax07aZDfO XfEl773TCDFWzYtl0kFVnRJYzbdpepeqzW1iVnFFos1lg1QfxlqfprWwDD8FDLW+29+TwHaWUNr eY78qCSqGl35oKNUADdJBxb9BX/NIDDM1Wl6snwlt X-Received: by 2002:a67:e88b:: with SMTP id x11mr1105265vsn.180.1571988157514; Fri, 25 Oct 2019 00:22:37 -0700 (PDT) X-Received: by 2002:a67:e88b:: with SMTP id x11mr1105250vsn.180.1571988157178; Fri, 25 Oct 2019 00:22:37 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: David Marchand Date: Fri, 25 Oct 2019 09:22:26 +0200 Message-ID: Subject: Re: [dpdk-dev] Please stop using iopl() in DPDK To: Andy Lutomirski Cc: dev , Thomas Gleixner , Peter Zijlstra , LKML , Maxime Coquelin , Tiwei Bie , Thomas Monjalon Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Andy, On Fri, Oct 25, 2019 at 6:46 AM Andy Lutomirski wrote: > Supporting iopl() in the Linux kernel is becoming a maintainability > problem. As far as I know, DPDK is the only major modern user of > iopl(). Thanks for reaching out. Copying our virtio maintainers (Maxime and Tiwei), since they are the first impacted by such a change. > After doing some research, DPDK uses direct io port access for only a > single purpose: accessing legacy virtio configuration structures. > These structures are mapped in IO space in BAR 0 on legacy virtio > devices. > > There are at least three ways you could avoid using iopl(). Here they > are in rough order of quality in my opinion: > > 1. Change pci_uio_ioport_read() and pci_uio_ioport_write() to use > read() and write() on resource0 in sysfs. > > 2. Use the alternative access mechanism in the virtio legacy spec: > there is a way to access all of these structures via configuration > space. > > 3. Use ioperm() instead of iopl(). And you come with potential solutions, thanks :-) We need to look at them and evaluate what is best from our point of view. See how it impacts our ABI too (we decided on a freeze until 20.11). > We are considering changes to the kernel that will potentially harm > the performance of any program that uses iopl(3) -- in particular, > context switches will become more expensive, and the scheduler might > need to explicitly penalize such programs to ensure fairness. Using > ioperm() already hurts performance, and the proposed changes to iopl() > will make it even worse. Alternatively, the kernel could drop iopl() > support entirely. I will certainly make a change to allow > distributions to remove iopl() support entirely from their kernels, > and I expect that distributions will do this. > > Please fix DPDK. Unfortunately, we are currently closing our rc1 for the 19.11 release. Not sure who is available, but I suppose we can work on this subject in the 20.02 release timeframe. Thanks. -- David Marchand