Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3563064imj; Tue, 19 Feb 2019 05:47:24 -0800 (PST) X-Google-Smtp-Source: AHgI3IZpZq+Tp6lT5FIgNjiQ1WxAsSAFBlx2lNhoH5NIcjy9SY5eRjbJONXYU8NopgS6jVYOhnIP X-Received: by 2002:a63:575d:: with SMTP id h29mr9364344pgm.442.1550584044036; Tue, 19 Feb 2019 05:47:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550584044; cv=none; d=google.com; s=arc-20160816; b=gEANMlTE0ykdJ4qBckcA/EysgtbSdV3TwdrIMQVPdw4lqAn1tI7VgETLbZ/GtILykg yl2RomKJHTC50oWHLSkeuNZFkI5wB6St/UTwKXDlphs6+tTOVr96a1tCUg4ceu6ywTaW O/qtnqs87ew/v0JW87pAhlXzM0cLxfp/HHUMKqRYqKlhHT4xXZjg8Ic4KzRjSePLwIrA FAA5IpxB48LD5IQN1NJ1o2Vu/g5aOrBcDcdepZ4Z1FwXh0UNxdlh0Acl90XXQrn1QeA9 mYFwVxdil6CZv3liBRnJv5oKEnlxL6V0BfYNTkmtGQOCVE4LoAupGKBzW5Tn+7dqLVqU zSew== 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=Ok/bPWmoRh3V02dyhMl5PyZU/ZPoyF6FhprZOPxPR/Q=; b=bi6o4LLWe8K3CtmRL+vzMCiaDDZj0VF/aenp2wQV23mt68K5LMjJIJnCvY+ke7ZGJn UiEC2VrGBwBJSOstBu6nXpNNoUPC7tVYKyqsVO3VY3enNT5A5Mko0ice0nOSD6/O6t31 /nphy5gd1O3qMPWbnOUfqlrR6puZHUL1kiGQ9HyPFVNxg1M8Cm83l603+wchOX7HjxZW 5chHGTBiv4FYbKvr4mhwrQ0D2ALfKR58NXSgtmDsjx+tKIMj6WKSWkk7BMY2aAne8TrN /ebwR34FbQVgtzFiqx9jrlPCZzDKqnPK90NiTSE/XMy3N9/gd4HuHr3VK/yVqzVoS4ui fXyA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e3si16099865pfe.203.2019.02.19.05.47.08; Tue, 19 Feb 2019 05:47:24 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728833AbfBSNp3 (ORCPT + 99 others); Tue, 19 Feb 2019 08:45:29 -0500 Received: from mail-qt1-f195.google.com ([209.85.160.195]:36212 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728611AbfBSNp3 (ORCPT ); Tue, 19 Feb 2019 08:45:29 -0500 Received: by mail-qt1-f195.google.com with SMTP id p25so22840472qtb.3; Tue, 19 Feb 2019 05:45:28 -0800 (PST) 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=Ok/bPWmoRh3V02dyhMl5PyZU/ZPoyF6FhprZOPxPR/Q=; b=HufVlOpPe0fUaGhBJrsvxd2qe1AMWKXbiGIUbhkoZqLJEsWcj/NKZDwYvaMMW60c1x 8mAs+82sKfrBqp6lilALBo8AX61XkrlbYXsn5L2oSU9cusibgdadBuNQwGpXJnUTx90I yEWy6tZ7VorgEgJIaGaklRDk4rrq4EG56kWGQmMAzhutTt7JjSnk6FO0U/bM4o6OxPOQ cZg3DRlfTtzjFFAIZytLqkTkM+kC1psKGui5Fwj8qZ2234tmv23alDT2k0mXotw/CEAC bj4h7QtBNEgpOzZC2dF16fB8+oSAg50KXnBcGIqO+/T5wIS27TPigHiPVfDpWUVFklO8 s5JA== X-Gm-Message-State: AHQUAuYXdSTXi4Cp+o/gizXaJH6jB6KVjdpHlPJvppdZKRuaaYYKw8A9 pqKNAHmNSJEZ8XwswG2Yf4MDmLIWfWG/LERCIuoUdiHe X-Received: by 2002:a0c:c60f:: with SMTP id v15mr21155229qvi.40.1550583928032; Tue, 19 Feb 2019 05:45:28 -0800 (PST) MIME-Version: 1.0 References: <20190211172948.3322-1-will.deacon@arm.com> <20190218162954.GB16713@fuggles.cambridge.arm.com> <20190218175625.GD16713@fuggles.cambridge.arm.com> <20190219112747.7db95e58@windsurf.home> <20190219113609.GC4027@fuggles.cambridge.arm.com> <20190219132021.GJ8501@fuggles.cambridge.arm.com> In-Reply-To: <20190219132021.GJ8501@fuggles.cambridge.arm.com> From: Arnd Bergmann Date: Tue, 19 Feb 2019 14:45:11 +0100 Message-ID: Subject: Re: [RFC PATCH] docs/memory-barriers.txt: Rewrite "KERNEL I/O BARRIER EFFECTS" section To: Will Deacon Cc: Thomas Petazzoni , linux-arch , Linux Kernel Mailing List , "Paul E. McKenney" , Benjamin Herrenschmidt , Peter Zijlstra , Andrea Parri , Daniel Lustig , David Howells , Alan Stern , Linus Torvalds , Thomas Petazzoni , Gregory CLEMENT , Russell King - ARM Linux 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 On Tue, Feb 19, 2019 at 2:20 PM Will Deacon wrote: > On Tue, Feb 19, 2019 at 02:01:50PM +0100, Arnd Bergmann wrote: > > On Tue, Feb 19, 2019 at 12:36 PM Will Deacon wrote: > > > On Tue, Feb 19, 2019 at 12:31:50PM +0100, Arnd Bergmann wrote: > > > > On Tue, Feb 19, 2019 at 11:27 AM Thomas Petazzoni > > One reference to non-posted transaction in a comment is in > > drivers/net/ethernet/dec/tulip/de4x5.c: > > > > /* > > ** The DE4X5 interrupt handler. > > ** > > ** I/O Read/Writes through intermediate PCI bridges are never 'posted', > > ** so that the asserted interrupt always has some real data to work with - > > ** if these I/O accesses are ever changed to memory accesses, ensure the > > ** STS write is read immediately to complete the transaction if the adapter > > ** is not on bus 0. Lost interrupts can still occur when the PCI bus load > > ** is high and descriptor status bits cannot be set before the associated > > ** interrupt is asserted and this routine entered. > > */ > > Thankfully, that driver is both old and non-portable: > > depends on VIRT_TO_BUS || ALPHA || PPC || SPARC > > so I'm not especially concerned about it. Judging by the comment, we'd > need to add something like: > > > diff --git a/drivers/net/ethernet/dec/tulip/de4x5.c b/drivers/net/ethernet/dec/tulip/de4x5.c > index 66535d1653f6..c85089f65b0e 100644 > --- a/drivers/net/ethernet/dec/tulip/de4x5.c > +++ b/drivers/net/ethernet/dec/tulip/de4x5.c > @@ -1556,6 +1556,10 @@ de4x5_interrupt(int irq, void *dev_id) > sts = inl(DE4X5_STS); /* Read IRQ status */ > outl(sts, DE4X5_STS); /* Reset the board interrupts */ > > + /* Beware of PCI posted writes */ > + if (IS_ENABLED(CONFIG_ARM64) && lp->bus_num) > + inl(DE4X5_STS); > + > if (!(sts & lp->irq_mask)) break;/* All done */ > handled = 1; > > > > if we wanted to get this working reliably on arm64. However, I'll be honest > and say we haven't had much demand for supporting DEC PCI devices yet :) Agreed. I find a total of 590 drivers calling inb/outb and related helpers, using "git grep -wl 'out\(l\|w\|b\)' drivers/ sound/" (there are probably a couple more. There are hardly any among those that one would expect to see in a modern machine: - The majority is for ISA, PCMCIA or PCI devices, as opposed to PCIe, and presumably no longer sold. - Many are de factor architecture specific, e.g. drivers for stuff in a PC chipset. drivers/staging/comedi/ has some things in it that have a slight chance of still being put into modern machines when moving from an old embedded system to a new one, but being staging, chances are that the drivers also require other changes before they work on a new architecture. Overall, I wonder if we'd be better off completely disabling outb etc on arm64, and only supporting iomap()/ioread()/iowrite() instead, without giving any guarantees there. Getting there would definitely require some code changes (and many Kconfig changes), but it still seems appealing given how much legacy stuff we could completely ignore afterwards. > > I found another comment in the via-rhine driver: > > > > /* Beware of PCI posted writes */ > > #define IOSYNC do { ioread8(ioaddr + StationAddr); } while (0) > > > > this one is used in the chip reset function, and in the transmit > > path. > > Since this is doing a read-back, I take this comment as saying "posted > writes are a thing, so perform a read-back to force the prior write to > complete", which is fine. Right. Arnd