From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D77D4A32A2 for ; Fri, 25 Oct 2019 06:46:12 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 62BA81E557; Fri, 25 Oct 2019 06:46:11 +0200 (CEST) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by dpdk.org (Postfix) with ESMTP id 2BA091E551 for ; Fri, 25 Oct 2019 06:46:10 +0200 (CEST) Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (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 24D0921D7F 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-f45.google.com with SMTP id z11so673428wro.11 for ; Thu, 24 Oct 2019 21:46:09 -0700 (PDT) X-Gm-Message-State: APjAAAUPkUa/a2M6AGImLmjurA6VX6sXX0JQ/EKI0MBUnGl5HPP8DPrf WDHvVKAK1UekDOCG9QMpMnhN3J0zoeygZWwwUxnkFg== X-Google-Smtp-Source: APXvYqyNOFp3Ms+uinOmOvqe7XDGXR8wMZpz/A8vGbtQnxZA8XQ8zPGalHKbQrZUar9wc/bhTGaD7FmpMXccmbOUWG8= 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: To: dev@dpdk.org, Thomas Gleixner , Peter Zijlstra , LKML Content-Type: text/plain; charset="UTF-8" Subject: [dpdk-dev] Please stop using iopl() in DPDK X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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