From jeremy@sgi.com Fri Oct 15 17:38:09 2004 Return-Path: X-Original-To: jbarnes@spamtin.engr.sgi.com Delivered-To: jbarnes@spamtin.engr.sgi.com Received: from cthulhu.engr.sgi.com (cthulhu.engr.sgi.com [192.26.80.2]) by spamtin.engr.sgi.com (Postfix) with ESMTP id B35122407F34 for ; Fri, 15 Oct 2004 17:42:56 -0700 (PDT) Received: from imr2.americas.sgi.com (imr2.americas.sgi.com [192.48.203.141]) by cthulhu.engr.sgi.com (SGI-8.12.5/8.12.5) with ESMTP id i9G0gtLG4094021 for ; Fri, 15 Oct 2004 17:42:56 -0700 (PDT) Received: from mx1.sgi.com (mx1.sgi.com [192.48.168.24]) by imr2.americas.sgi.com (8.12.9/8.12.10/SGI_generic_relay-1.2) with ESMTP id i9G0loGe38363494 for ; Fri, 15 Oct 2004 17:47:51 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org [12.107.209.244]) by mx1.sgi.com (8.12.11/8.12.11/freebsd-nospam-3.3) with ESMTP id i9G0ikpU056525 for ; Fri, 15 Oct 2004 17:44:46 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S268065AbUJPAiy (ORCPT ); Fri, 15 Oct 2004 20:38:54 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S268051AbUJPAiy (ORCPT ); Fri, 15 Oct 2004 20:38:54 -0400 Received: from omx3-ext.sgi.com ([192.48.171.20]:34495 "EHLO omx3.sgi.com") by vger.kernel.org with ESMTP id S268059AbUJPAie (ORCPT ); Fri, 15 Oct 2004 20:38:34 -0400 Received: from cthulhu.engr.sgi.com (cthulhu.engr.sgi.com [192.26.80.2]) by omx3.sgi.com (8.12.11/8.12.9/linux-outbound_gateway-1.1) with ESMTP id i9FNnrFe024362; Fri, 15 Oct 2004 16:50:00 -0700 Received: from classic.engr.sgi.com (classic.engr.sgi.com [163.154.5.111]) by cthulhu.engr.sgi.com (SGI-8.12.5/8.12.5) with ESMTP id i9G0cBLG4091298; Fri, 15 Oct 2004 17:38:12 -0700 (PDT) Received: from classic.engr.sgi.com (localhost [127.0.0.1]) by classic.engr.sgi.com (SGI-8.12.5/8.12.5) with ESMTP id i9G0cAjn298260; Fri, 15 Oct 2004 17:38:11 -0700 (PDT) Received: (from jeremy@localhost) by classic.engr.sgi.com (SGI-8.12.5/8.12.5/Submit) id i9G0c9gt299512; Fri, 15 Oct 2004 17:38:09 -0700 (PDT) Date: Fri, 15 Oct 2004 17:38:09 -0700 From: Jeremy Higdon To: Guennadi Liakhovetski , akpm@osdl.org Cc: Jesse Barnes , linux-kernel@vger.kernel.org, gnb@sgi.com, linux-scsi@vger.kernel.org Subject: Re: [PATCH] I/O space write barrier Message-ID: <20041016003809.GA299051@sgi.com> References: <200409271103.39913.jbarnes@engr.sgi.com> <200409291555.29138.jbarnes@engr.sgi.com> <20040930071541.GA201816@sgi.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.1i Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on spamtin.engr.sgi.com X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=unavailable version=3.0.0 X-UID: 69644 X-Length: 5979 On Thu, Sep 30, 2004 at 11:21:39PM +0200, Guennadi Liakhovetski wrote: > > A pretty obvious note: instead of repeating this nice but pretty lengthy > comment 3 times in the same file, wouldn't it be better to write at > further locations something like > > /* Enforce IO-ordering. See comment in for details. */ > > Also helps if you later have to modify the comment, or move it, or add > more mmiowb()s, or do some other modifications. > > Thanks > Guennadi > --- > Guennadi Liakhovetski Suggestion applied. Now that the mmiowb is in the mm patch, this patch to qla1280 should be ready for inclusion therein also. signed-off-by: Jeremy Higdon --- linux-2.6.9-rc4.orig/drivers/scsi/qla1280.c 2004-10-15 17:21:21.000000000 -0700 +++ linux-2.6.9-rc4/drivers/scsi/qla1280.c 2004-10-15 17:23:08.000000000 -0700 @@ -3409,7 +3409,8 @@ sp->flags |= SRB_SENT; ha->actthreads++; WRT_REG_WORD(®->mailbox4, ha->req_ring_index); - (void) RD_REG_WORD(®->mailbox4); /* PCI posted write flush */ + /* Enforce mmio write ordering; see comment in qla1280_isp_cmd(). */ + mmiowb(); out: if (status) @@ -3677,7 +3678,8 @@ sp->flags |= SRB_SENT; ha->actthreads++; WRT_REG_WORD(®->mailbox4, ha->req_ring_index); - (void) RD_REG_WORD(®->mailbox4); /* PCI posted write flush */ + /* Enforce mmio write ordering; see comment in qla1280_isp_cmd(). */ + mmiowb(); out: if (status) @@ -3787,9 +3789,21 @@ } else ha->request_ring_ptr++; - /* Set chip new ring index. */ + /* + * Update request index to mailbox4 (Request Queue In). + * The mmiowb() ensures that this write is ordered with writes by other + * CPUs. Without the mmiowb(), it is possible for the following: + * CPUA posts write of index 5 to mailbox4 + * CPUA releases host lock + * CPUB acquires host lock + * CPUB posts write of index 6 to mailbox4 + * On PCI bus, order reverses and write of 6 posts, then index 5, + * causing chip to issue full queue of stale commands + * The mmiowb() prevents future writes from crossing the barrier. + * See Documentation/DocBook/deviceiobook.tmpl for more information. + */ WRT_REG_WORD(®->mailbox4, ha->req_ring_index); - (void) RD_REG_WORD(®->mailbox4); /* PCI posted write flush */ + mmiowb(); LEAVE("qla1280_isp_cmd"); } - 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/