From patchwork Sun Mar 21 21:53:08 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 48239 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id B807CB7CF5 for ; Mon, 22 Mar 2010 08:53:11 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753508Ab0CUVxK (ORCPT ); Sun, 21 Mar 2010 17:53:10 -0400 Received: from Chamillionaire.breakpoint.cc ([85.10.199.196]:34736 "EHLO Chamillionaire.breakpoint.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753308Ab0CUVxJ (ORCPT ); Sun, 21 Mar 2010 17:53:09 -0400 Received: id: bigeasy by Chamillionaire.breakpoint.cc with local (easymta 1.00 BETA 1) id 1NtT52-0007VI-IK; Sun, 21 Mar 2010 22:53:08 +0100 Date: Sun, 21 Mar 2010 22:53:08 +0100 From: Sebastian Andrzej Siewior To: Jeff Garzik Cc: linux-ide@vger.kernel.org Subject: [PATCH 2/2] libata: disable preemption during PIO copy Message-ID: <20100321215308.GB27709@Chamillionaire.breakpoint.cc> MIME-Version: 1.0 Content-Disposition: inline X-Key-Id: FE3F4706 X-Key-Fingerprint: FFDA BBBB 3563 1B27 75C9 925B 98D5 5C1C FE3F 4706 User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org If the request has been made in user context it could be moved to a different CPU on a SMP machine between the copy and cache flush. Thus we could flush the dcache on the wrong CPU. Signed-off-by: Sebastian Andrzej Siewior --- drivers/ata/libata-sff.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 83ecf48..dca9f90 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c @@ -874,6 +874,9 @@ static void ata_pio_sector(struct ata_queued_cmd *qc) DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read"); +#ifdef CONFIG_SMP + preempt_disable(); +#endif if (PageHighMem(page)) { unsigned long flags; @@ -896,6 +899,9 @@ static void ata_pio_sector(struct ata_queued_cmd *qc) if (!do_write && !PageSlab(page)) flush_dcache_page(page); +#ifdef CONFIG_SMP + preempt_enable(); +#endif qc->curbytes += qc->sect_size; qc->cursg_ofs += qc->sect_size;