From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael S. Tsirkin" Subject: Re: [PATCH-RFC 1/2] tile: don't panic on iomap Date: Wed, 30 Nov 2011 09:04:17 +0200 Message-ID: <20111130070417.GA17781@redhat.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Received: from mx1.redhat.com ([209.132.183.28]:4642 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753406Ab1K3HCv (ORCPT ); Wed, 30 Nov 2011 02:02:51 -0500 Content-Disposition: inline In-Reply-To: Sender: linux-arch-owner@vger.kernel.org List-ID: To: Bjorn Helgaas Cc: Chris Metcalf , Lucas De Marchi , Paul Mundt , Jesse Barnes , "David S. Miller" , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-arch@vger.kernel.org, Andrew Morton On Tue, Nov 29, 2011 at 01:04:12PM -0800, Bjorn Helgaas wrote: > On Tue, Nov 29, 2011 at 10:54 AM, Michael S. Tsirkin = wrote: > > I think panic on iomap is there just for debugging. > > If we return NULL instead, the generic pci_iomap will > > DTRT so we don't need to roll our own. >=20 > Just to be explicit about what "doing the right thing" means, here's > what I think is changing (I think the new behavior is OK, but it *is* > different): I think the change is that anyone calling ioport_map *directly* will fail. pci_iomap callers are mostly unaffected. >=20 > Old behavior: Caller calls pci_iomap(), which panics in ioport_map(). Not really, the old pci_iomap simply returned NULL in this case, it did not call ioport_map. > New behavior: Caller calls pci_iomap(), ioport_map() returns NULL, > pci_iomap() returns NULL (failure), caller may check for failure. If > caller does not check for failure and passes the NULL to > ioread()/iowrite(), we WARN in bad_io_access(). >=20 > > =A0static inline void __iomem *ioport_map(unsigned long port, unsig= ned int len) > > =A0{ > > - =A0 =A0 =A0 return (void __iomem *) ioport_panic(); > > + =A0 =A0 =A0 pr_info("Trying to map an IO resource - it does not e= xit on tile.\n"); > > + =A0 =A0 =A0 return NULL; >=20 > s/exit/exist/ >=20 > Since we only expect to see this message during debugging, maybe it > could be more informative, e.g., use dump_stack() to identify the > offending driver? I don't think either the "Trying to map" message o= r > the "Bad IO access" message is enough to actually make progress in > debugging. >=20 > Bjorn As explained above, only direct callers of ioport_map get a changed behaviour. If we start dumping stack there we will hurt users of pci_iomap which used to get a graceful failure and will start getting scary messages. Is does not seem to be worth doing to simplify debuggin= g, right? How about sticking the function name in the pr_info message? A simple grep for ioport_map will then get you the culprit ... Like this: + =A0 =A0 =A0 pr_info("ioport_map: mapping IO resources is unsupported = on tile.\n"); ? --=20 MST