Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4034244ybg; Fri, 25 Oct 2019 12:22:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqxwmm5bw3vN/ZZleFsn7lqlT9wGCWRfZqR2hmnEGixcul+cUCrWHVUGN5UKW3wF3s9gkF1w X-Received: by 2002:a17:906:22cc:: with SMTP id q12mr5129659eja.131.1572031346365; Fri, 25 Oct 2019 12:22:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572031346; cv=none; d=google.com; s=arc-20160816; b=KHxZHw6o5VO14sNXDIjs1FZVuXBqSNv3GuX+PhqaynPSz727CvcHDlUoKJN+/jRLC8 bALGYZCLWnmSo8ryrGF2NxfUMi5L4Badr5Y1oD10SMu1GP0X7HrCj49+yHYlc/ndwXwI 8FjwhlbrOftuDU8CnAhu92xF/EjFIsDrxzYf41nu/x7a3zSbmtMSw7NPvoi83GswvQ81 HARljSdrX470rNMMZNBICi2NhaCVl1BBNNOuRhCKKL7ZlRw8sLADqDWfNjdKnLbY2Dbj JFhsG81nXMSErXNwDDyznjoDZ+/KEeR29rWIXm3mtOZUY6/j9tDP9qLh7IriV/+2FvtY g3PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:subject:message-id:date:from :mime-version:dkim-signature; bh=s40+8wzgRSY+pgeAEpaD4Zs5m3v5rnXlS7Wuh/d03v8=; b=HbShcGB7rRFn3Lwp0XN5e3s/zkgW7+SjMGvdIyM7uX9Y8U+xjCN5sT2safFvA4gpbU fQLSco2joaFaPfjIcnV64FLyIosSxxbbdX05x6juMXkW/bZzA942RWaUGM/RMCMXX7Hk UlPnDDoTCYZwzunh1F9MBcsucaza2A3EHbga/TlZN1wh9c4Q2uC2v8woUEERAkxB67Wm ibmgxW7/0s6WOQwxMaS07yV131hlVWQ7sT+LpW7JqXWy4amYV9cedJqN0usROxTkLcCc xEUW4gdbmc4qYYLOmYcTQa0YEhhudOYJOlKCKurKSviW/Xa0O8Huasw43WLX5zEkNqQ6 niMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oEnXcmg1; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a60si2010400edf.169.2019.10.25.12.22.02; Fri, 25 Oct 2019 12:22:26 -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; dkim=pass header.i=@kernel.org header.s=default header.b=oEnXcmg1; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389891AbfJYEqK (ORCPT + 99 others); Fri, 25 Oct 2019 00:46:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:39688 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387990AbfJYEqK (ORCPT ); Fri, 25 Oct 2019 00:46:10 -0400 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1C9E121D71 for ; Fri, 25 Oct 2019 04:46:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571978769; bh=wiorhjSe1Jgcumgj5fluZs16cVEe1hZJXsHjFLCRfNw=; h=From:Date:Subject:To:From; b=oEnXcmg1azk8QDn15o3bAkiEncszDSU5RsmnFzLqFni3RkGh2DwCR2RLRRq3CBBWC 8PODXZeZvxdBdOdL/Hzc0UYPX9h1i7q5lKT0Wx/hUXkswqkiFmnfxnAyrqGkZaN8S0 Kr5oPdgpCBStOwCCb5jrWGFtXAaAv1PRbhbj1a9s= Received: by mail-wr1-f50.google.com with SMTP id o28so692297wro.7 for ; Thu, 24 Oct 2019 21:46:09 -0700 (PDT) X-Gm-Message-State: APjAAAX+PE8v7BR/+0AHY1ojTHYYkozoLGBRx/Mqww0CsMmSpbZZXFNO MwWPynhWWyNR/B2ABi7Bu40cpUxEDmW3C8PlSlsc4g== X-Received: by 2002:a5d:51c2:: with SMTP id n2mr865701wrv.149.1571978767560; Thu, 24 Oct 2019 21:46:07 -0700 (PDT) MIME-Version: 1.0 From: Andy Lutomirski Date: Thu, 24 Oct 2019 21:45:56 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Please stop using iopl() in DPDK To: dev@dpdk.org, Thomas Gleixner , Peter Zijlstra , LKML 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 Hi all- 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(). 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(). 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. Thanks, Andy