Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp773153rdb; Wed, 1 Nov 2023 02:09:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEGWeGBORjzfUcbgugL3tJwQQXfGXyFQmTLO+hXgQ2CdkosuLYUVetwUikwrRxPmLo77sWt X-Received: by 2002:a05:6a21:498d:b0:181:671f:445e with SMTP id ax13-20020a056a21498d00b00181671f445emr231931pzc.33.1698829775128; Wed, 01 Nov 2023 02:09:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698829775; cv=none; d=google.com; s=arc-20160816; b=ezerjmneHZoH4auoZ5EMm1dD+KOJ07VABKGJCR30JeR+bw7h0+GzraUGhEEJp610Fv ce1gUuGpmULcUB8ZZBO6UD8w/GuG3/9b2Np70hFRUeG7kABtsNagUgh8unXKJWvPIR3z CxMIZQ2mxw+FB0QKxPapf+TBCvZagRaOBSeI5yLVLdIJGSgJaeKpDOUcWCNWYEcRczWJ 4qMAMug4QxZF2js+FlEwtQa7POEegGVO1gHinwiaUCyUZKpnlXxvSZ+bWRKw4li7FwLS 1NWDhArgnM/LYOskMSHE24NRTBUffobWpzKCq43T9d6ANJGmSioFppUIWCsdL559kYAT kZTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:feedback-id:dkim-signature :dkim-signature; bh=DA90ThXbn3roskf8cEXmvsaZgr+/qZjSsxxJDx4CL9s=; fh=1m2DmQQm4XoEbg/QwpbzXjR+Y2+v8RmQEPNWOrxaDK8=; b=cJ3X62IneN9wtjOt+gQd5E/wc2YNgnpgfWhhvpWZ5REt+28SAVpZHbQYmbGFtz/Auz MMo2tvndn2xNjG/Gluq8xV388L7xpdWxKuURVj28pU4ZegxEmnNN3dqs/IeX9b50rtwi EUbQ7B7dBjlJPXCj3fR1fvJbO1VKVBfUnLp6TAE0RKJeqsQ0VyfPxJ4o3TgvH7A+gePU oJIdaYLN9nC88EixhBxUGc8MH78x8EL6msAGQ7CZfOThMkZdlYtwA6dNMqEeaWh1uPcd r1hkifSVDfoALyvljlvjiPtlOU9EYSzWNug6JAnJNvikBqnkTd5WxQeb/3PQ4kFr47s2 hAPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=mXtuiYoK; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=Qh9afl8P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id me8-20020a17090b17c800b002800c14f2e1si420510pjb.89.2023.11.01.02.09.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 02:09:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=mXtuiYoK; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=Qh9afl8P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 030608083B22; Wed, 1 Nov 2023 02:09:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233322AbjKAJJO (ORCPT + 99 others); Wed, 1 Nov 2023 05:09:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232624AbjKAJJN (ORCPT ); Wed, 1 Nov 2023 05:09:13 -0400 Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92144102; Wed, 1 Nov 2023 02:09:06 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 2E2AD5C04BB; Wed, 1 Nov 2023 05:09:03 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Wed, 01 Nov 2023 05:09:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1698829743; x=1698916143; bh=DA 90ThXbn3roskf8cEXmvsaZgr+/qZjSsxxJDx4CL9s=; b=mXtuiYoKEgS8OqIlji qCN62pplqqSLpZbenhSrrZ03PmgoG+vJ+HKbiz5tXo+nkEQL0Tt3y+HCEEiBIEoH +K0OOoWBVhC7zlwTiUbHZlIQvoNeOyoXP62FnPV97Kq7wyixtTEmEVVP2hiVQsAf MzT1Jkc3zrhtO3o0CLGU4vYU3obDnAQazZuW58zInbdz3iSX65b3eKl1bjCGR8kz UtLvGvNwQJ/NoSn6aWkXFTtZBP5PdK+0ZFM0X/SzFym/IzwmN76DnxZvkJ8eI3/D r0MT3nbrKWzmBwfaO1IpTFc9TMiEsUCEphmmrk7UQvBgsjsMVszk0/Aqx6+84FLg TJwg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1698829743; x=1698916143; bh=DA90ThXbn3ros kf8cEXmvsaZgr+/qZjSsxxJDx4CL9s=; b=Qh9afl8P308HQek+iqNSnNSXON3TU DW1TxnC5XsAX6fd1kqkIcLKxMjvA0n446X0DPMyyOdb4fydSoO4LvG4LOLurAb9W DLhrg6EJwIYvqI3+eNVCwjlDI/Zk007Nqw/3WK49APqTtV+pU5zE/mO0YRWGiZeg 5n0y1f92PDeAJO5SCJToRfdNqNh5BjjAA1nP3uw12VEB1xGCaufDm9tl/uqbXIBZ XnYxNLotOkoG9+xhpGU+0JZKPdGvJmZ5FfZ6SKy0zasKgJF5ZE+gPSsFMEJ0sOod JFEENPEieUAJ5lmc52tOyzg9rDMrrTYbG7bFZ2PoGWf47X1cNLtzdHtsw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedruddtgecutefuodetggdotefrodftvfcurf hrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefofgggkfgjfhffhffvvefutgesthdtredtreertdenucfhrhhomhepfdetrhhnugcu uegvrhhgmhgrnhhnfdcuoegrrhhnugesrghrnhgusgdruggvqeenucggtffrrghtthgvrh hnpeffheeugeetiefhgeethfejgfdtuefggeejleehjeeutefhfeeggefhkedtkeetffen ucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrrhhnug esrghrnhgusgdruggv X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id C32ACB60089; Wed, 1 Nov 2023 05:09:02 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-1048-g9229b632c5-fm-20231019.001-g9229b632 MIME-Version: 1.0 Message-Id: In-Reply-To: <82076999-9346-473d-8841-1480cd70b527@app.fastmail.com> References: <82076999-9346-473d-8841-1480cd70b527@app.fastmail.com> Date: Wed, 01 Nov 2023 10:08:42 +0100 From: "Arnd Bergmann" To: "Jiaxun Yang" , Linux-Arch Cc: x86@kernel.org, linux-kernel@vger.kernel.org, "Baoquan He" Subject: Re: Overhead of io{read,write}{8,16,32,64} on x86 Content-Type: text/plain X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 01 Nov 2023 02:09:30 -0700 (PDT) On Tue, Oct 31, 2023, at 22:41, Jiaxun Yang wrote: > Hi all, > > I'm trying to improve Kernel's support of devices that have ioports > mapped into MMIO, that involves converting existing driver which is > using {in,out}{l,w,b} to use io{read,write}{8,16,32,64}, so they can > benefit from ioport_map and pci_iomap. > > However, the problem is io{read,write}{8,16,32,64} will incur penalty > on x86 by introducing extra function calls (they are not inlined) and > having extra condition judgment on MMIO vs PIO. > > x86 folks, do you think this kind of overhead is acceptable? I do think > most of PCI/ISA drivers will need to be converted. > > linux-arch folks, do you think it will be better if we introduce a > variant of io{read,write}{8,16,32,64} that direct to PIO on x86 but > remains the same functionality on other architectures? I think in general there is not much of a problem here since the inb()/outb() operations themselves are extremely slow already, in particular the outb() writes are non-posted unlike writeb(). My feeling is that converting to ioread/iowrite is generally a win for any driver that already needs to support both cases (e.g. serial-8250) since this can unify the two code paths. However, for drivers that only support inb()/outb() today, I don't see a real benefit in converting them from the traditional methods. Another question is whether we actually want to keep the ISA-only drivers around. Usually once you look closely, any particular ISA driver tends to be entirely unused already and can be removed, aside from a few known devices that are either soldered-down on motherboards or that have an LPC variant using the same ISA driver. Arnd