From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg Kroah-Hartman Subject: Re: [PATCH 1/2 v3] alpha: add a delay to inb_p, inb_w and inb_l Date: Wed, 13 May 2020 18:13:52 +0200 Message-ID: <20200513161352.GD1362525@kroah.com> References: <20200513144128.GA16995@mail.rc.ru> Mime-Version: 1.0 Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589386434; bh=scDmKpReNvSDyaXOgfs0CFFWdytS3oT1ya21NeyynX8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kByrWg397T/zsRO+6EgO9D1dBbCdqM6U/M9H/QGH3Wvyrf1BymHHRcI59qN6rAdVt 4ZvrNgBtXez6a33z7K/OmqEkmTQp+YWR3rl07ErtPVzsGn51l6BSszcG6VgYpqJZ6J NVvtSjzx0PmucGC9LsjIGruPj1TBlQM8bBZ6XSiA= Content-Disposition: inline In-Reply-To: <20200513144128.GA16995@mail.rc.ru> Sender: linux-alpha-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Ivan Kokshaysky Cc: "Maciej W. Rozycki" , Mikulas Patocka , Arnd Bergmann , Richard Henderson , Matt Turner , alpha , linux-serial@vger.kernel.org, linux-rtc@vger.kernel.org On Wed, May 13, 2020 at 03:41:28PM +0100, Ivan Kokshaysky wrote: > On Mon, May 11, 2020 at 03:58:24PM +0100, Maciej W. Rozycki wrote: > > Individual PCI port locations correspond to different MMIO locations, so > > yes, accesses to these can be reordered (merging won't happen due to the > > use of the sparse address space). > > Correct, it's how Alpha write buffers work. According to 21064 hardware > reference manual, these buffers are flushed when one of the following > conditions is met: > > 1) The write buffer contains at least two valid entries. > 2) The write buffer contains one valid entry and at least 256 CPU cycles > have elapsed since the execution of the last write buffer-directed > instruction. > 3) The write buffer contains an MB, STQ_C or STL_C instruction. > 4) A load miss is pending to an address currently valid in the write > buffer that requires the write buffer to be flushed. > > I'm certain that in these rtc/serial cases we've got readX arriving > to device *before* preceeding writeX because of 2). That's why small > delay (300-1400 ns, apparently depends on CPU frequency) seemingly > "fixes" the problem. The 4) is not met because loads and stores are > to different ports, and 3) has been broken by commit 92d7223a74. > > So I believe that correct fix would be to revert 92d7223a74 and > add wmb() before [io]writeX macros to meet memory-barriers.txt > requirement. The "wmb" instruction is cheap enough and won't hurt > IO performance too much. I agree, that sounds easier, and work with the authors of memory-barriers.txt in order to straighten things out. greg k-h