linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] ide-scsi highmem cleanup
       [not found] <200510310302.j9V32hO4009277@hera.kernel.org>
@ 2005-10-31  3:48 ` Jeff Garzik
  2005-10-31  4:00   ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Garzik @ 2005-10-31  3:48 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Linux Kernel Mailing List, Linus Torvalds,
	Bartlomiej Zolnierkiewicz, linux-ide@vger.kernel.org, Alan Cox

Linux Kernel Mailing List wrote:
> tree c6016a8741a2527acac0ceb6e6ce431a798d6708
> parent f1fc78a8c7f3a784b9fd1e07cc1438a0ea569555
> author Andrew Morton <akpm@osdl.org> Mon, 31 Oct 2005 07:00:13 -0800
> committer Linus Torvalds <torvalds@g5.osdl.org> Mon, 31 Oct 2005 09:37:17 -0800
> 
> [PATCH] ide-scsi highmem cleanup
> 
> It's not necessary to test PageHighmem in here - kmap_atomic() does the right
> thing.
> 
> Cc: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
> Signed-off-by: Andrew Morton <akpm@osdl.org>
> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
> 
>  drivers/scsi/ide-scsi.c |   38 ++++++++++++--------------------------
>  1 files changed, 12 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
> --- a/drivers/scsi/ide-scsi.c
> +++ b/drivers/scsi/ide-scsi.c
> @@ -180,19 +180,12 @@ static void idescsi_input_buffers (ide_d
>  			return;
>  		}
>  		count = min(pc->sg->length - pc->b_count, bcount);
> -		if (PageHighMem(pc->sg->page)) {
> -			unsigned long flags;
> -
> -			local_irq_save(flags);
> -			buf = kmap_atomic(pc->sg->page, KM_IRQ0) + pc->sg->offset;
> -			drive->hwif->atapi_input_bytes(drive, buf + pc->b_count, count);
> -			kunmap_atomic(buf - pc->sg->offset, KM_IRQ0);
> -			local_irq_restore(flags);
> -		} else {
> -			buf = page_address(pc->sg->page) + pc->sg->offset;
> -			drive->hwif->atapi_input_bytes(drive, buf + pc->b_count, count);
> -		}
> -		bcount -= count; pc->b_count += count;
> +		buf = kmap_atomic(pc->sg->page, KM_IRQ0);
> +		drive->hwif->atapi_input_bytes(drive,
> +				buf + pc->b_count + pc->sg->offset, count);
> +		kunmap_atomic(buf, KM_IRQ0);
> +		bcount -= count;
> +		pc->b_count += count;
>  		if (pc->b_count == pc->sg->length) {
>  			pc->sg++;
>  			pc->b_count = 0;
> @@ -212,19 +205,12 @@ static void idescsi_output_buffers (ide_
>  			return;
>  		}
>  		count = min(pc->sg->length - pc->b_count, bcount);
> -		if (PageHighMem(pc->sg->page)) {
> -			unsigned long flags;
> -
> -			local_irq_save(flags);
> -			buf = kmap_atomic(pc->sg->page, KM_IRQ0) + pc->sg->offset;
> -			drive->hwif->atapi_output_bytes(drive, buf + pc->b_count, count);
> -			kunmap_atomic(buf - pc->sg->offset, KM_IRQ0);
> -			local_irq_restore(flags);
> -		} else {
> -			buf = page_address(pc->sg->page) + pc->sg->offset;
> -			drive->hwif->atapi_output_bytes(drive, buf + pc->b_count, count);
> -		}
> -		bcount -= count; pc->b_count += count;
> +		buf = kmap_atomic(pc->sg->page, KM_IRQ0);
> +		drive->hwif->atapi_output_bytes(drive,
> +				buf + pc->b_count + pc->sg->offset, count);
> +		kunmap_atomic(buf, KM_IRQ0);
> +		bcount -= count;
> +		pc->b_count += count;

Unless I'm missing something, this patch looks very wrong.

kmap_atomic(..., KM_IRQx) needs to be inside local_irq_save().

As such, the PageHighMem() does have clear benefits.

	Jeff



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ide-scsi highmem cleanup
  2005-10-31  3:48 ` [PATCH] ide-scsi highmem cleanup Jeff Garzik
@ 2005-10-31  4:00   ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2005-10-31  4:00 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-kernel, torvalds, bzolnier, linux-ide, alan

Jeff Garzik <jgarzik@pobox.com> wrote:
>
> > @@ -212,19 +205,12 @@ static void idescsi_output_buffers (ide_
>  >  			return;
>  >  		}
>  >  		count = min(pc->sg->length - pc->b_count, bcount);
>  > -		if (PageHighMem(pc->sg->page)) {
>  > -			unsigned long flags;
>  > -
>  > -			local_irq_save(flags);
>  > -			buf = kmap_atomic(pc->sg->page, KM_IRQ0) + pc->sg->offset;
>  > -			drive->hwif->atapi_output_bytes(drive, buf + pc->b_count, count);
>  > -			kunmap_atomic(buf - pc->sg->offset, KM_IRQ0);
>  > -			local_irq_restore(flags);
>  > -		} else {
>  > -			buf = page_address(pc->sg->page) + pc->sg->offset;
>  > -			drive->hwif->atapi_output_bytes(drive, buf + pc->b_count, count);
>  > -		}
>  > -		bcount -= count; pc->b_count += count;
>  > +		buf = kmap_atomic(pc->sg->page, KM_IRQ0);
>  > +		drive->hwif->atapi_output_bytes(drive,
>  > +				buf + pc->b_count + pc->sg->offset, count);
>  > +		kunmap_atomic(buf, KM_IRQ0);
>  > +		bcount -= count;
>  > +		pc->b_count += count;
> 
>  Unless I'm missing something, this patch looks very wrong.
> 
>  kmap_atomic(..., KM_IRQx) needs to be inside local_irq_save().

Yeah, shared interrupts.

>  As such, the PageHighMem() does have clear benefits.

Yep, thanks.  I'll fix that up.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-10-31  4:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <200510310302.j9V32hO4009277@hera.kernel.org>
2005-10-31  3:48 ` [PATCH] ide-scsi highmem cleanup Jeff Garzik
2005-10-31  4:00   ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).