Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753336AbbDPEel (ORCPT ); Thu, 16 Apr 2015 00:34:41 -0400 Received: from mail-db3on0127.outbound.protection.outlook.com ([157.55.234.127]:56940 "EHLO emea01-db3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752387AbbDPEea (ORCPT ); Thu, 16 Apr 2015 00:34:30 -0400 Authentication-Results: suse.com; dkim=none (message not signed) header.d=none; Date: Thu, 16 Apr 2015 13:18:37 +0900 From: Hyong-Youb Kim To: "Luis R. Rodriguez" CC: Andy Walls , Hyong-Youb Kim , , Andy Lutomirski , Toshi Kani , "H. Peter Anvin" , Ingo Molnar , , Hal Rosenstock , Sean Hefty , Suresh Siddha , Rickard Strandqvist , Mike Marciniszyn , Roland Dreier , Juergen Gross , Mauro Carvalho Chehab , Borislav Petkov , Mel Gorman , Vlastimil Babka , Davidlohr Bueso , , , , Ville =?iso-8859-1?Q?Syrj=E4l=E4?= , , , Subject: Re: ioremap_uc() followed by set_memory_wc() - burrying MTRR Message-ID: <20150416041837.GA5712@hykim-PC> References: <1428695379.6646.69.camel@misato.fc.hp.com> <20150410210538.GB5622@wotan.suse.de> <1428699490.21794.5.camel@misato.fc.hp.com> <20150411012938.GC5622@wotan.suse.de> <20150413174938.GE5622@wotan.suse.de> <1429137531.1899.28.camel@palomino.walls.org> <20150415235816.GG5622@wotan.suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20150415235816.GG5622@wotan.suse.de> User-Agent: Mutt/1.5.23 (2014-03-12) X-Originating-IP: [125.132.7.245] X-ClientProxiedBy: HKXPR06CA004.apcprd06.prod.outlook.com (10.242.96.44) To AM3PR05MB1298.eurprd05.prod.outlook.com (25.163.7.151) X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:AM3PR05MB1298; X-Microsoft-Antispam-PRVS: X-Forefront-Antispam-Report: BMV:1;SFV:NSPM;SFS:(10019020)(6009001)(51704005)(24454002)(92566002)(46406003)(2950100001)(42186005)(62966003)(93886004)(77156002)(551934003)(40100003)(33656002)(66066001)(87976001)(83506001)(97756001)(122386002)(47776003)(50466002)(46102003)(50196002)(4001350100001)(50986999)(54356999)(76176999)(33716001)(110136001)(7059030)(107986001);DIR:OUT;SFP:1102;SCL:1;SRVR:AM3PR05MB1298;H:hykim-PC;FPR:;SPF:None;MLV:sfv;LANG:en; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(5002010);SRVR:AM3PR05MB1298;BCL:0;PCL:0;RULEID:;SRVR:AM3PR05MB1298; X-Forefront-PRVS: 0548586081 X-OriginatorOrg: cspi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Apr 2015 04:19:17.4583 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR05MB1298 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1499 Lines: 31 On Thu, Apr 16, 2015 at 01:58:16AM +0200, Luis R. Rodriguez wrote: > > An alternative... is to just ioremap_wc() the entire region, including > MMIO registers for these old devices. I see one ethernet driver that does > this, myri10ge, and am curious how and why they ended up deciding this > and if they have run into any issues. I wonder if this is a reasonable > comrpomise for these 2 remaining corner cases. > For myri10ge, it a performance thing. Descriptor rings are in NIC memory BAR0, not in host memory. Say, to send a packet, the driver writes the send descriptor to the ioremap'd NIC memory. It is a multi-word descriptor. So, to send it as one PCIE MWr transaction, the driver maps the whole BAR0 as WC and does "copy descriptor; wmb". Without WC, descriptors would end up as multiple 4B or 8B MWr packets to the NIC, which has a pretty big performance impact on this particular NIC. Most registers that do not want WC are actually in BAR2, which is not mapped as WC. For registers that are in BAR0, we do "write to the register; wmb". If we want to wait till the NIC has seen the write, we do "write; wmb; read". This approach has worked for this device for many years. I cannot say whether it works for other devices, though. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/