From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rafal Prylowski Subject: Re: [PATCH v2 1/3] PATA host controller driver for ep93xx Date: Thu, 05 Apr 2012 09:52:01 +0200 Message-ID: <4F7D4F21.2060401@metasoft.pl> References: <4F7B0C54.8010804@metasoft.pl> <4F7C64B8.5000909@metasoft.pl> <4F7C65CE.6000309@metasoft.pl> <201204041523.50872.arnd@arndb.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: 7bit Return-path: Received: from metasoft.pl ([195.149.224.191]:57109 "EHLO smtp.metasoft.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751254Ab2DEHwS (ORCPT ); Thu, 5 Apr 2012 03:52:18 -0400 In-Reply-To: <201204041523.50872.arnd@arndb.de> Sender: linux-ide-owner@vger.kernel.org List-Id: linux-ide@vger.kernel.org To: Arnd Bergmann Cc: linux-arm-kernel@lists.infradead.org, "rmallon@gmail.com" , Sergei Shtylyov , "linux-ide@vger.kernel.org" , "joao.ramos@inov.pt" , H Hartley Sweeten , "bzolnier@gmail.com" On 2012-04-04 17:23, Arnd Bergmann wrote: > On Wednesday 04 April 2012, Rafal Prylowski wrote: >>> >>> According to ATA specification, maximum IORDY pulse width is 1250ns, >>> so I'll set timeout to 2ms (I should check this before posting the driver..). >> >> 2ms is far too big value... Should be 2us. > > Ok, in this case, don't use jiffies. I guess it was already flawed because > jiffies doesn't get updated while you are in an interrupt handler. > > You could use ktime_get to get a high-resolution time stamp to compare to, > but it depends on how accurate your clocksource is. Jiffies seem to work. I was wrong with this interrupt handler. Actually IDE register read/write (and IORDY polling) is called from softirq, this is only triggered by interrupt. I hope this backtrace confirm this: BUG: scheduling while atomic: swapper/0/0x40000100 [] (unwind_backtrace+0x0/0xf4) from [] (__schedule+0x2e0/0x3 30) [] (__schedule+0x2e0/0x330) from [] (__cond_resched+0x24/0x3 4) [] (__cond_resched+0x24/0x34) from [] (_cond_resched+0x38/0x 40) [] (_cond_resched+0x38/0x40) from [] (ep93xx_pata_wait_for_i ordy+0x20/0x64) [] (ep93xx_pata_wait_for_iordy+0x20/0x64) from [] (ep93xx_pa ta_read+0xac/0xb4) [] (ep93xx_pata_read+0xac/0xb4) from [] (ep93xx_pata_check_s tatus+0x1c/0x28) [] (ep93xx_pata_check_status+0x1c/0x28) from [] (T.508+0x3c/ 0xf0) [] (T.508+0x3c/0xf0) from [] (ata_bmdma_qc_issue+0x50/0x19c) [] (ata_bmdma_qc_issue+0x50/0x19c) from [] (ata_qc_issue+0x1 98/0x2f8) [] (ata_qc_issue+0x198/0x2f8) from [] (ata_scsi_translate+0x 98/0x178) [] (ata_scsi_translate+0x98/0x178) from [] (ata_scsi_queuecm d+0x7c/0x230) [] (ata_scsi_queuecmd+0x7c/0x230) from [] (scsi_dispatch_cmd +0xd8/0x1b4) [] (scsi_dispatch_cmd+0xd8/0x1b4) from [] (scsi_request_fn+0 x308/0x378) [] (scsi_request_fn+0x308/0x378) from [] (__blk_run_queue+0x 18/0x1c) [] (__blk_run_queue+0x18/0x1c) from [] (blk_run_queue+0x14/0 x1c) [] (blk_run_queue+0x14/0x1c) from [] (scsi_run_queue+0xc0/0x 208) [] (scsi_run_queue+0xc0/0x208) from [] (scsi_next_command+0x 2c/0x38) [] (scsi_next_command+0x2c/0x38) from [] (scsi_io_completion +0x258/0x56c) [] (scsi_io_completion+0x258/0x56c) from [] (blk_done_softir q+0x80/0x98) [] (blk_done_softirq+0x80/0x98) from [] (__do_softirq+0x94/0 x150) [] (__do_softirq+0x94/0x150) from [] (irq_exit+0x48/0x50) [] (irq_exit+0x48/0x50) from [] (handle_IRQ+0x34/0x84) [] (handle_IRQ+0x34/0x84) from [] (vic_handle_irq+0x94/0xd4) [] (vic_handle_irq+0x94/0xd4) from [] (__irq_svc+0x34/0x40) Sorry for the mess. I'm doing kernel development only occasionally... I changed msecs_to_jiffies() to usecs_to_jiffies(). Is it possible that ktime_get() give us better resolution? Thanks for all hints. RP