* [GIT PULL] libata fixes for v4.10-rc6
From: Tejun Heo @ 2017-01-31 16:46 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel, linux-ide
Hello, Linus.
Three libata fixes. An error handling fix, blacklist addition for
another fallout from upping the default max sectors, and fix for a
sense data reporting bug which affects new harddrives which can report
sense data.
Thanks.
The following changes since commit 88ba6cae15e38f609aba4f3881e1c404c432596c:
Merge tag 'platform-drivers-x86-v4.10-3' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86 (2017-01-05 23:17:41 -0800)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata.git for-4.10-fixes
for you to fetch changes up to 064c3db9c564cc5be514ac21fb4aa26cc33db746:
ata: sata_mv:- Handle return value of devm_ioremap. (2017-01-06 15:45:32 -0500)
----------------------------------------------------------------
Arvind Yadav (1):
ata: sata_mv:- Handle return value of devm_ioremap.
Damien Le Moal (1):
libata: Fix ATA request sense
Tejun Heo (1):
libata: apply MAX_SEC_1024 to all CX1-JB*-HP devices
drivers/ata/libata-core.c | 6 ++++--
drivers/ata/sata_mv.c | 3 +++
2 files changed, 7 insertions(+), 2 deletions(-)
--
tejun
^ permalink raw reply
* Re: remove the cmd_type field from struct request
From: Jens Axboe @ 2017-01-31 18:02 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-block, linux-scsi, linux-ide, linux-kernel
In-Reply-To: <1485878251-6107-1-git-send-email-hch@lst.de>
On 01/31/2017 07:57 AM, Christoph Hellwig wrote:
> [1] which were a pain in the ass to untangle and debug during development,
> it's really time for it to die..
Outside of the patch series in question, how to we expedite the
euthanasia of IDE? What explicit features/support are we missing through
libata that would need to be added, before we can git rm drivers/ide/ ?
--
Jens Axboe
^ permalink raw reply
* Re: for-4.10-fixes branch
From: Tejun Heo @ 2017-01-31 16:35 UTC (permalink / raw)
To: Damien Le Moal; +Cc: linux-ide
In-Reply-To: <ccee6286-f349-5f2e-0e6e-39496bc3f986@wdc.com>
Hello,
On Tue, Jan 31, 2017 at 11:47:36AM +0900, Damien Le Moal wrote:
> Tejun,
>
> Some commits in your for-4.10-fixes branch have not yet been pulled in
> Linus 4.10 tree. Is this normal ? Can we expect the fixes to go in rc7 ?
> I am concerned about the request sense fix I sent. That bug is breaking
> applications and still exists in rc6. Those commits really need to go in.
That's me waiting for more fixes combined with procrastinating. Will
send the trees out right away.
Thanks for the poking.
--
tejun
^ permalink raw reply
* Re: remove the cmd_type field from struct request
From: James Bottomley @ 2017-01-31 18:51 UTC (permalink / raw)
To: Jens Axboe, Christoph Hellwig
Cc: linux-block, linux-scsi, linux-ide, linux-kernel
In-Reply-To: <bbe16fc1-5652-bbc2-03a5-0298c3f16645@kernel.dk>
On Tue, 2017-01-31 at 10:02 -0800, Jens Axboe wrote:
> On 01/31/2017 07:57 AM, Christoph Hellwig wrote:
> > [1] which were a pain in the ass to untangle and debug during
> > development, it's really time for it to die..
>
> Outside of the patch series in question, how to we expedite the
> euthanasia of IDE? What explicit features/support are we missing
> through libata that would need to be added, before we can git rm
> drivers/ide/?
I thought the primary objection was actually embedded in that libata
with its reliance on SCSI was just too large a dependency, so they have
to keep using drivers/ide. Perhaps nvme and flash is obviating this
problem and we can ask them again, though?
James
^ permalink raw reply
* Re: remove the cmd_type field from struct request
From: Sergei Shtylyov @ 2017-01-31 18:58 UTC (permalink / raw)
To: James Bottomley, Jens Axboe, Christoph Hellwig
Cc: linux-block, linux-scsi, linux-ide, linux-kernel
In-Reply-To: <1485888674.3199.49.camel@HansenPartnership.com>
On 01/31/2017 09:51 PM, James Bottomley wrote:
>>> [1] which were a pain in the ass to untangle and debug during
>>> development, it's really time for it to die..
>>
>> Outside of the patch series in question, how to we expedite the
>> euthanasia of IDE? What explicit features/support are we missing
>> through libata that would need to be added, before we can git rm
>> drivers/ide/?
>
> I thought the primary objection was actually embedded in that libata
Back at MontaVista, even embedded uses switched to libata years ago...
DaveM thinks we still can't prove that libata works everywhere the IDE works.
Besided, there are still a number of non-x86 drivers not converted over to
libata (like DaVinci, etc.)...
> with its reliance on SCSI was just too large a dependency, so they have
> to keep using drivers/ide.
Do you remember how many years ago a libata's own block driver was
promised to you? ;-)
I'd gladly wrote one, getting tired of my current OSS work... :-)
> Perhaps nvme and flash is obviating this
> problem and we can ask them again, though?
What's wrong with those? I'm not really following NVMe...
> James
MBR, Sergei
^ permalink raw reply
* Re: remove the cmd_type field from struct request
From: Jens Axboe @ 2017-01-31 21:07 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-block, linux-scsi, linux-ide, linux-kernel
In-Reply-To: <1485878251-6107-1-git-send-email-hch@lst.de>
On 01/31/2017 07:57 AM, Christoph Hellwig wrote:
> Hi Jens,
>
> this series gets rid of the cmd_type field in struct request and
> instead folds it into the REQ_OP* space. This reduces the size of
> struct request, and leads to a single op namespace that drivers
> can easily switch on. Except for the legacy ide driver which has
> a mess of different request types [1] this also nicely cleans up the
> code.
>
> Note that the patches are on top of the
>
> "make SCSI passthrough support optional"
>
> series I sent out on Saturday. To make life easier I also have a git
> tree available here:
>
> git://git.infradead.org/users/hch/block.git cmd_type
>
> http://git.infradead.org/users/hch/block.git/shortlog/refs/heads/cmd_type
Looks good to me, applied for 4.11.
--
Jens Axboe
^ permalink raw reply
* Re: remove the cmd_type field from struct request
From: Jens Axboe @ 2017-01-31 21:09 UTC (permalink / raw)
To: Sergei Shtylyov, James Bottomley, Christoph Hellwig
Cc: linux-block, linux-scsi, linux-ide, linux-kernel
In-Reply-To: <ebcc36be-9c02-eff3-33a0-20f7dedc3c0b@cogentembedded.com>
On 01/31/2017 10:58 AM, Sergei Shtylyov wrote:
> On 01/31/2017 09:51 PM, James Bottomley wrote:
>
>>>> [1] which were a pain in the ass to untangle and debug during
>>>> development, it's really time for it to die..
>>>
>>> Outside of the patch series in question, how to we expedite the
>>> euthanasia of IDE? What explicit features/support are we missing
>>> through libata that would need to be added, before we can git rm
>>> drivers/ide/?
>>
>> I thought the primary objection was actually embedded in that libata
>
> Back at MontaVista, even embedded uses switched to libata years ago...
Indeed, that would be my assumption as well, not too worried about that
side.
> DaveM thinks we still can't prove that libata works everywhere the IDE works.
> Besided, there are still a number of non-x86 drivers not converted over to
> libata (like DaVinci, etc.)...
That argument is getting harder to buy. IDE has become a considerable
maintenance burden - not for Dave, but for the rest of us that have
to carry a subsystem forward. Personally I would _love_ to kill IDE
at some point in the future, where that future hopefully isn't too far
off. But if we have hardware that is being used and where IDE works and
libata support does not exist, then weneed to fix that first.
> Do you remember how many years ago a libata's own block driver was
> promised to you? ;-)
> I'd gladly wrote one, getting tired of my current OSS work... :-)
Pretty sure I told Jeff originally that libata should only go into the
kernel, if there was a plan to make it independent of SCSI. A promise
was made that of course it would, but that promise was never held,
unfortunately.
--
Jens Axboe
^ permalink raw reply
* Re: remove the cmd_type field from struct request
From: Martin K. Petersen @ 2017-02-01 2:58 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: axboe, linux-block, linux-scsi, linux-ide, linux-kernel
In-Reply-To: <1485878251-6107-1-git-send-email-hch@lst.de>
>>>>> "Christoph" == Christoph Hellwig <hch@lst.de> writes:
Christoph> this series gets rid of the cmd_type field in struct
Christoph> request and instead folds it into the REQ_OP* space. This
Christoph> reduces the size of struct request, and leads to a single op
Christoph> namespace that drivers can easily switch on.
Very nice cleanup!
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply
* Re: for-4.10-fixes branch
From: Damien Le Moal @ 2017-02-01 3:00 UTC (permalink / raw)
To: Tejun Heo; +Cc: linux-ide
In-Reply-To: <20170131163539.GA23970@htj.duckdns.org>
Tejun,
On 2/1/17 01:35, Tejun Heo wrote:
> Hello,
>
> On Tue, Jan 31, 2017 at 11:47:36AM +0900, Damien Le Moal wrote:
>> Tejun,
>>
>> Some commits in your for-4.10-fixes branch have not yet been pulled in
>> Linus 4.10 tree. Is this normal ? Can we expect the fixes to go in rc7 ?
>> I am concerned about the request sense fix I sent. That bug is breaking
>> applications and still exists in rc6. Those commits really need to go in.
>
> That's me waiting for more fixes combined with procrastinating. Will
> send the trees out right away.
Thanks !
--
Damien Le Moal, Ph.D.
Sr. Manager, System Software Research Group,
Western Digital Corporation
Damien.LeMoal@wdc.com
(+81) 0466-98-3593 (ext. 513593)
1 kirihara-cho, Fujisawa,
Kanagawa, 252-0888 Japan
www.wdc.com, www.hgst.com
^ permalink raw reply
* Re: remove the cmd_type field from struct request
From: Hannes Reinecke @ 2017-02-01 6:53 UTC (permalink / raw)
To: Jens Axboe, Christoph Hellwig
Cc: linux-block, linux-scsi, linux-ide, linux-kernel
In-Reply-To: <bbe16fc1-5652-bbc2-03a5-0298c3f16645@kernel.dk>
On 01/31/2017 07:02 PM, Jens Axboe wrote:
> On 01/31/2017 07:57 AM, Christoph Hellwig wrote:
>> [1] which were a pain in the ass to untangle and debug during development,
>> it's really time for it to die..
>
> Outside of the patch series in question, how to we expedite the
> euthanasia of IDE? What explicit features/support are we missing through
> libata that would need to be added, before we can git rm drivers/ide/ ?
>
There is only a single driver (sgi_ide) which hasn't been moved over to
libata. But this is for an old Itanium-based server only, and even SGI
didn't press us to have this ported.
(And we have disabled the IDE drivers since SLES11, where we still
support Itanium.)
So they can be safely assumed defunct at this time.
I'm all for removing them.
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@suse.de +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
^ permalink raw reply
* Bitte kontaktieren Sie mich für weitere Details!
From: Miss Marbell @ 2017-02-01 8:14 UTC (permalink / raw)
Sehr geehrte Damen und Herren,
Ich brauche Ihre Unterstützung in Ihrem Land zu verlagern und zu investieren.Ich bitte Sie um Hilfe, weil ich nicht das Wissen über
Geschäft und die Regeln, die Ihr Land für eine sichere Investition führen.
Werden Sie versprechen, mit mir aufrichtig zu sein?
Bitte kontaktieren Sie mich für weitere Details!
Mit freundlichen Grüßen,
Fräulein Marbell.
^ permalink raw reply
* Re: [PATCH 0/3] ata: add m68k/Atari Falcon PATA support
From: Finn Thain @ 2017-02-01 8:40 UTC (permalink / raw)
To: Michael Schmitz
Cc: Bartlomiej Zolnierkiewicz, Tejun Heo, Geert Uytterhoeven,
linux-ide, Linux/m68k, Linux Kernel Development, Andreas Schwab
In-Reply-To: <a524b8e2-b7ea-482d-f62c-b0460e852a8b@gmail.com>
On Fri, 27 Jan 2017, Michael Schmitz wrote:
> Am 26.01.2017 um 21:47 schrieb Finn Thain:
>
> > This would imply CPU overhead that is half of that which mac_scsi
> > incurs. That's the best case, but I see no reason to expect worse
> > performance than PDMA gets.
>
> But how much more overhead would we have compared to using the SCSI
> interrupt to signal DMA completion?
>
I imagine that contention for the CPU bus would be a problem if we polled
the interrupt flag without any delay between iterations. With a small
delay I think the overhead would be comparable with PDMA and therefore
tolerable.
> The libata driver currently does disable the IDE interrupt and uses
> polling, but I'd like to change that if at all possible. Sorry I didn't
> make that clear.
>
[snip]
> Since IDE does not use the ST-DMA and does not share any registers with
> ST-DMA, peeking at the IDE status register in order to decide whether
> the interrupt was raised by the IDE interface won't hurt the running DMA
> process (regardless of whether FDC or SCSI started it). Nor will
> servicing the IDE interrupt.
>
Maybe we can just call the IDE handler from the ST-DMA handler regardless
of the status register. For a shared interrupt handler this should work
okay. (BTW, where is the IDE status register found anyway?)
> If at the end of the IDE interrupt processing the interrupt status is
> cleared in the IDE interface, the interrupt line should go high again
> before the IDE inthandler returns.
>
On page 2 of the schematic, MFP pin I5 is wired to the output of the
logical OR combination of the IDEIRQ and XDISKINT signals (actually
active-low signals fed into an AND gate). The pin is edge-triggered.
This is just like the wired-OR Nubus slot IRQs connected to the Mac's VIA
pin. The handler must ack all asserted IRQs. Otherwise there will be no
more edges and no more interrupts.
This means looping over the IDE, FDC/SCSI DMA handlers until they all
return IRQ_NONE. (Or equivalently, looping over the IRQ flags in the
device registers until they are all de-asserted.)
BTW, this makes me think that the stdma.c mechanism is already flawed,
since stdma_int() can cause only one of IDEIRQ and XDISKINT to become
inactive, but not both. That's fine as long as no device raises IRQ until
it's driver acquires the stdma lock -- but we know this is not true for
the 5380 bus reset interrupt and it isn't true for IDE devices either
(based on Geert's email in this thread).
> If we can ensure that the FDC/SCSI interrupt handler runs after the IDE
> handler, we can then make that handler check the interrupt line status
> and bail out if there's nothing to be done. (For the sake of simplicity,
> this check can be done in stdma_int() since we need to retain mutual
> locking of the DMA interface by SCSI and FDC anyway.)
>
> We can ensure the IDE interrupt is called first by using a special
> interrupt controller to register separate IDE and FDC/SCSI interrupts
> with (I've done that to provide distinct interrupt numbers and handlers
> for the timer D interrupt that's used to poll ethernet and USB interface
> status on the ROM port).
>
> That way, we can ensure IDE interrupts do not step on the ST-DMA state,
> and all that remains are premature SCSI interrupts terminating DMA
> transfer (which we already face anyway).
>
> Am I missing a potential race here? Does IDE send the next request off
> to the disk from inside the interrupt handler so we could see IDE
> immediately raise the next interrupt? In that case, we'd also need to
> check the IDE interrupt status in the interface status register, and
> bail out for another pass through the IDE/FDC/SCSI handlers until IDE is
> no longer posting an interrupt...
>
I don't know anything about IDE so I can't comment on this particular
scenario (IDE interrupt handler causing IDE interrupt). The race condition
may be only theoretical.
What you seem to be aiming at is an algorithm to ensure that no DMA
interrupt is handled whilst an IDE interrupt is pending. Taking into
account the logical OR issue, one could imagine a handler for the
IRQ_MFP_FSCSI interrupt something like the following. (This code is
probably useless for implementing your interrupt controller, but I hope it
illustrates some of the issues.)
do {
handled = ata_handler(irq, ata_dev);
if (handled == IRQ_NONE && atari_irq_pending(IRQ_MFP_FSCSI))
handled |= stdma_int(irq, stdma_dev);
} while (handled != IRQ_NONE);
Clearly this is not free from race conditions. The other problem is the
use of atari_irq_pending(IRQ_MFP_FSCSI). It tells us when an edge appears
but doesn't tell us about the present state of the IRQ output pins on the
NCR5380 or the WD1772. We can't access the device registers so
st_mfp.par_dt_reg & BIT(5) must be used instead of
atari_irq_pending(IRQ_MFP_FSCSI);
The simplest approach is to treat it like a shared interrupt, with a loop
to account for the logical OR:
do {
handled = ata_handler(irq, ata_dev) |
scsi_falcon_intr(irq, scsi_dev) |
fdc_handler(irq, fdc_dev);
} while (handled != IRQ_NONE);
This should work fine with polled DMA (and might even allow the flawed
stdma.c lock mechanism to be eliminated) but it can't work with your
scheme because scsi_falcon_intr() assumes exclusive access to the IRQ;
hence it must not be called unless there is an actual 5380 or DMA
interrupt.
I don't know which scheme is better. Mine is simpler and probably free of
race conditions but does burn some CPU time. Your scheme is more
complicated.
--
> Cheers,
>
> Michael
>
^ permalink raw reply
* Re: [PATCH 0/3] ata: add m68k/Atari Falcon PATA support
From: Geert Uytterhoeven @ 2017-02-01 8:45 UTC (permalink / raw)
To: Finn Thain
Cc: Michael Schmitz, Bartlomiej Zolnierkiewicz, Tejun Heo,
linux-ide@vger.kernel.org, Linux/m68k, Linux Kernel Development,
Andreas Schwab
In-Reply-To: <alpine.LNX.2.00.1701271858100.368@nippy.intranet>
Hi Finn,
On Wed, Feb 1, 2017 at 9:40 AM, Finn Thain <fthain@telegraphics.com.au> wrote:
> okay. (BTW, where is the IDE status register found anyway?)
In the IDE device.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply
* Re: remove the cmd_type field from struct request
From: Bartlomiej Zolnierkiewicz @ 2017-02-01 10:37 UTC (permalink / raw)
To: Jens Axboe
Cc: Christoph Hellwig, linux-block, linux-scsi, linux-ide,
linux-kernel
In-Reply-To: <bbe16fc1-5652-bbc2-03a5-0298c3f16645@kernel.dk>
Hi,
On Tuesday, January 31, 2017 10:02:50 AM Jens Axboe wrote:
> On 01/31/2017 07:57 AM, Christoph Hellwig wrote:
> > [1] which were a pain in the ass to untangle and debug during development,
> > it's really time for it to die..
>
> Outside of the patch series in question, how to we expedite the
> euthanasia of IDE? What explicit features/support are we missing through
When it comes to missing features/support there is still
number of non-x86 host drivers not ported to libata (I'm
slowly working on this as a side-task, any help would be
much appreciated).
> libata that would need to be added, before we can git rm drivers/ide/ ?
I was trying to start the removal with [1] last year but
it has been NAK-ed by DaveM who seems to want to keep
drivers/ide/ forever [2].
[1] https://lkml.org/lkml/2016/2/4/409
[2] https://lkml.org/lkml/2016/12/8/423
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
^ permalink raw reply
* Re: remove the cmd_type field from struct request
From: Sergei Shtylyov @ 2017-02-01 10:55 UTC (permalink / raw)
To: Hannes Reinecke, Jens Axboe, Christoph Hellwig
Cc: linux-block, linux-scsi, linux-ide, linux-kernel
In-Reply-To: <c61b9b98-8e4a-ac23-bf0c-002d112d5468@suse.de>
On 2/1/2017 9:53 AM, Hannes Reinecke wrote:
>>> [1] which were a pain in the ass to untangle and debug during development,
>>> it's really time for it to die..
>>
>> Outside of the patch series in question, how to we expedite the
>> euthanasia of IDE? What explicit features/support are we missing through
>> libata that would need to be added, before we can git rm drivers/ide/ ?
>>
> There is only a single driver (sgi_ide) which hasn't been moved over to
> libata.
Huh? What about Toshiba TC86C001 and TX4938/9, TI DaVinci? That's off the
top of my head only...
> But this is for an old Itanium-based server only, and even SGI didn't
> press us to have this ported.
> (And we have disabled the IDE drivers since SLES11, where we still support
> Itanium.)
Or do you mean only the drivers SuSe is interested in?
[...]
> Cheers,
>
> Hannes
MBR, Sergei
^ permalink raw reply
* Re: [PATCH 0/3] ata: add m68k/Atari Falcon PATA support
From: Michael Schmitz @ 2017-02-02 7:48 UTC (permalink / raw)
To: Finn Thain
Cc: Bartlomiej Zolnierkiewicz, Tejun Heo, Geert Uytterhoeven,
linux-ide, Linux/m68k, Linux Kernel Development, Andreas Schwab
In-Reply-To: <alpine.LNX.2.00.1701271858100.368@nippy.intranet>
Hi Finn,
Am 01.02.2017 um 21:40 schrieb Finn Thain:
>
> On Fri, 27 Jan 2017, Michael Schmitz wrote:
>
>> Am 26.01.2017 um 21:47 schrieb Finn Thain:
>>
>>> This would imply CPU overhead that is half of that which mac_scsi
>>> incurs. That's the best case, but I see no reason to expect worse
>>> performance than PDMA gets.
>>
>> But how much more overhead would we have compared to using the SCSI
>> interrupt to signal DMA completion?
>>
>
> I imagine that contention for the CPU bus would be a problem if we polled
> the interrupt flag without any delay between iterations. With a small
> delay I think the overhead would be comparable with PDMA and therefore
> tolerable.
The first delay can even be quite long, estimated based on the transfer
size.
>> Since IDE does not use the ST-DMA and does not share any registers with
>> ST-DMA, peeking at the IDE status register in order to decide whether
>> the interrupt was raised by the IDE interface won't hurt the running DMA
>> process (regardless of whether FDC or SCSI started it). Nor will
>> servicing the IDE interrupt.
>>
>
> Maybe we can just call the IDE handler from the ST-DMA handler regardless
> of the status register. For a shared interrupt handler this should work
> okay. (BTW, where is the IDE status register found anyway?)
We could do that as well, true. Easier to implement on the quick.
>> If at the end of the IDE interrupt processing the interrupt status is
>> cleared in the IDE interface, the interrupt line should go high again
>> before the IDE inthandler returns.
>>
>
> On page 2 of the schematic, MFP pin I5 is wired to the output of the
> logical OR combination of the IDEIRQ and XDISKINT signals (actually
> active-low signals fed into an AND gate). The pin is edge-triggered.
>
> This is just like the wired-OR Nubus slot IRQs connected to the Mac's VIA
> pin. The handler must ack all asserted IRQs. Otherwise there will be no
> more edges and no more interrupts.
Quite right - that's why I mentioned monitoring the IRQ signal status in
the GPIO register.
> This means looping over the IDE, FDC/SCSI DMA handlers until they all
> return IRQ_NONE. (Or equivalently, looping over the IRQ flags in the
> device registers until they are all de-asserted.)
Looping over the handlers risks stopping the DMA without need (except
for IDE).
> BTW, this makes me think that the stdma.c mechanism is already flawed,
> since stdma_int() can cause only one of IDEIRQ and XDISKINT to become
> inactive, but not both. That's fine as long as no device raises IRQ until
> it's driver acquires the stdma lock -- but we know this is not true for
> the 5380 bus reset interrupt and it isn't true for IDE devices either
> (based on Geert's email in this thread).
The initial bus reset code had safeguards against raising an interrupt -
the IRQ was 'turned off' while the bus reset was executed. Maybe we need
something like that, at least in the case where SCSI does not hold the
ST-DMA lock.
>> If we can ensure that the FDC/SCSI interrupt handler runs after the IDE
>> handler, we can then make that handler check the interrupt line status
>> and bail out if there's nothing to be done. (For the sake of simplicity,
>> this check can be done in stdma_int() since we need to retain mutual
>> locking of the DMA interface by SCSI and FDC anyway.)
>>
>> We can ensure the IDE interrupt is called first by using a special
>> interrupt controller to register separate IDE and FDC/SCSI interrupts
>> with (I've done that to provide distinct interrupt numbers and handlers
>> for the timer D interrupt that's used to poll ethernet and USB interface
>> status on the ROM port).
>>
>> That way, we can ensure IDE interrupts do not step on the ST-DMA state,
>> and all that remains are premature SCSI interrupts terminating DMA
>> transfer (which we already face anyway).
>>
>> Am I missing a potential race here? Does IDE send the next request off
>> to the disk from inside the interrupt handler so we could see IDE
>> immediately raise the next interrupt? In that case, we'd also need to
>> check the IDE interrupt status in the interface status register, and
>> bail out for another pass through the IDE/FDC/SCSI handlers until IDE is
>> no longer posting an interrupt...
>>
>
> I don't know anything about IDE so I can't comment on this particular
> scenario (IDE interrupt handler causing IDE interrupt). The race condition
> may be only theoretical.
>
> What you seem to be aiming at is an algorithm to ensure that no DMA
> interrupt is handled whilst an IDE interrupt is pending. Taking into
Whilst the IDE interrupt is the only one pending, to be precise.
> account the logical OR issue, one could imagine a handler for the
> IRQ_MFP_FSCSI interrupt something like the following. (This code is
> probably useless for implementing your interrupt controller, but I hope it
> illustrates some of the issues.)
>
> do {
> handled = ata_handler(irq, ata_dev);
> if (handled == IRQ_NONE && atari_irq_pending(IRQ_MFP_FSCSI))
> handled |= stdma_int(irq, stdma_dev);
> } while (handled != IRQ_NONE);
Not quite - we can't be certain that there aren't actually two
interrupts pending (say IDE interrupts first, and while we service that
interrupt, SCSI interrupts next but since the IRQ signal remains low, we
don't trigger another interrupt). So we must run the loop for both IDE
and stdma_int for as long as the IRQ signal remains low.
I had missed the case where SCSI interrupts first and the IDE interrupt
only comes in while the SCSI inthandler is running - need to think a bit
more about this.
> Clearly this is not free from race conditions. The other problem is the
> use of atari_irq_pending(IRQ_MFP_FSCSI). It tells us when an edge appears
> but doesn't tell us about the present state of the IRQ output pins on the
> NCR5380 or the WD1772. We can't access the device registers so
> st_mfp.par_dt_reg & BIT(5) must be used instead of
> atari_irq_pending(IRQ_MFP_FSCSI);
I've written a function to that effect, and tested it in the current
Falcon inthandler (without sharing the interrupt truly yet).
> The simplest approach is to treat it like a shared interrupt, with a loop
> to account for the logical OR:
>
> do {
> handled = ata_handler(irq, ata_dev) |
> scsi_falcon_intr(irq, scsi_dev) |
> fdc_handler(irq, fdc_dev);
> } while (handled != IRQ_NONE);
We can never have both SCSI and FDC interrupt at the same time (both
register access and DMA setup are shared between the two). Best retain
stdma_lock() for these two.
> This should work fine with polled DMA (and might even allow the flawed
> stdma.c lock mechanism to be eliminated) but it can't work with your
> scheme because scsi_falcon_intr() assumes exclusive access to the IRQ;
> hence it must not be called unless there is an actual 5380 or DMA
> interrupt.
Correct - polled DMA might be easier to handle here.
> I don't know which scheme is better. Mine is simpler and probably free of
> race conditions but does burn some CPU time. Your scheme is more
> complicated.
Meaning likely to race...
I'll have to test this with IDE removed from the locking scheme, and
we'll hopefully see races pretty quick.
Got a few new ideas to try now, thanks!
Cheers,
Michael
^ permalink raw reply
* Re: [PATCH] pata_legacy: Allow disabling of legacy PATA device probes on non-PCI systems
From: Gwendal Grignou @ 2017-02-07 20:21 UTC (permalink / raw)
To: whiteheadm
Cc: Tejun Heo, One Thousand Gnomes, Greg Kroah-Hartman,
Sergei Shtylyov, IDE/ATA development list
In-Reply-To: <CAP8WD_b2PXXXQgTQ_-a=8Z7ppNMa5xGuhsEvJGDT_WvT1EFwog@mail.gmail.com>
link2, dev2.x are not leaking. pata_legacy.1 is not freed because of ata2.
I extracted some of the output where the ata port object is not freed properly:
ref=1++ (attribute_container_add_device:transport_setup_device:ata_tport_add)
ref=2++ (ata_tport_add:ata_host_register:ata_host_activate)
ref=3++ (klist_node_init:klist_add_tail:device_add)
ref=4-- (ata_tport_add:ata_host_register:ata_host_activate)
ref=3++ (attribute_container_add_class_device:transport_add_class_device:attribute_container_device_trigger)
ref=4++ (kobject_add:get_device_parent:device_add)
ref=5++ (ata_tlink_add:ata_tport_add:ata_host_register)
ref=6++ (ata_tlink_add:ata_tport_add:ata_host_register)
ref=7++ (kobject_add:device_add:ata_tlink_add)
ref=8++ (scsi_add_host_with_dma:ata_scsi_add_hosts:ata_host_register)
ref=9++ (kobject_add:device_add:scsi_add_host_with_dma)
ref=10++ (scsi_add_host_with_dma:ata_scsi_add_hosts:ata_host_register)
ref=11-- (device_del:scsi_remove_host:ata_host_detach)
ref=10-- (scsi_remove_host:ata_host_detach:legacy_init [pata_legacy])
ref=9-- (device_del:ata_tlink_delete:ata_tport_delete)
ref=8-- (ata_tlink_delete:ata_tport_delete:ata_host_detach)
ref=7-- (ata_tlink_release:device_release:kobject_cleanup)
ref=6-- (kobject_cleanup:kobject_put:cleanup_glue_dir)
ref=5-- (attribute_container_class_device_del:transport_remove_classdev:attribute_container_device_trigger)
ref=4-- (klist_put:klist_del:device_del)
ref=3-- (attribute_container_release:device_release:kobject_cleanup)
ref=2-- (ata_tport_delete:ata_host_detach:legacy_init [pata_legacy])
Trying to match the put and get, I notice that scsi_add_host_with_dma
does 2 direct get, but scsi_remove_host only one direct put.
I did the following match:
ref=1++ (attribute_container_add_device:transport_setup_device:ata_tport_add)
--> ref=3-- (attribute_container_release:device_release:kobject_cleanup)
ref=3++ (klist_node_init:klist_add_tail:device_add) --> ref=4--
(klist_put:klist_del:device_del)
ref=3++ (attribute_container_add_class_device:transport_add_class_device:attribute_container_device_trigger)
--> ref=5--
(attribute_container_class_device_del:transport_remove_classdev:attribute_container_device_trigger)
ref=4++ (kobject_add:get_device_parent:device_add) --> ref=6--
(kobject_cleanup:kobject_put:cleanup_glue_dir)
ref=5++ (ata_tlink_add:ata_tport_add:ata_host_register) --> ref=7--
(ata_tlink_release:device_release:kobject_cleanup)
ref=6++ (ata_tlink_add:ata_tport_add:ata_host_register) --> ref=8--
(ata_tlink_delete:ata_tport_delete:ata_host_detach)
ref=7++ (kobject_add:device_add:ata_tlink_add) --> ref=9--
(device_del:ata_tlink_delete:ata_tport_delete)
ref=8++ (scsi_add_host_with_dma:ata_scsi_add_hosts:ata_host_register)
--> ref=10-- (scsi_remove_host:ata_host_detach:..
ref=9++ (kobject_add:device_add:scsi_add_host_with_dma) -->
ref=11-- (device_del:scsi_remove_host:ata_host_detach)
ref=10++ (scsi_add_host_with_dma:ata_scsi_add_hosts:ata_host_register)
Then the final call should have trigger destruction the port object:
ref=2-- (ata_tport_delete:ata_host_detach:legacy_init [pata_legacy])
Looking at scsi_add_host_with_dma/scsi_remove_host, we need to do
get_device on shost->shost_gendev.parent because we will do put_device
in scsi_host_dev_release, the release function of shost_gendev (which
is not called).
We do get_device on shost->shost_gendev for scsi_host_cls_release()
put_device, the release function of shost->host_dev, so I think it is
fine.
I am wondering if we don't have a circular dependency:
We do the final put_device (in scsi_host_put) on ap->scsi_host in
ata_host_release(), but it is not called because
[scsi_host]->shost_gendev.parent is &ap->tdev which hold the put on
its parent, ap.
If my understanding is correct, as Tejun pointed out, removing the put
on ap in ata_tport_release and the get_device(parent) in ata_tport_add
should unlock the situation.
^ permalink raw reply
* Re: [PATCH] pata_legacy: Allow disabling of legacy PATA device probes on non-PCI systems
From: Tejun Heo @ 2017-02-08 19:43 UTC (permalink / raw)
To: Gwendal Grignou
Cc: whiteheadm, One Thousand Gnomes, Greg Kroah-Hartman,
Sergei Shtylyov, IDE/ATA development list
In-Reply-To: <CAMHSBOUAMxTj7u5Jg4_VkxHmG5BUCr-AhDHY2UT+VMchn8daLQ@mail.gmail.com>
Hello,
On Tue, Feb 07, 2017 at 12:21:37PM -0800, Gwendal Grignou wrote:
> I am wondering if we don't have a circular dependency:
> We do the final put_device (in scsi_host_put) on ap->scsi_host in
> ata_host_release(), but it is not called because
> [scsi_host]->shost_gendev.parent is &ap->tdev which hold the put on
> its parent, ap.
>
> If my understanding is correct, as Tejun pointed out, removing the put
> on ap in ata_tport_release and the get_device(parent) in ata_tport_add
> should unlock the situation.
Heh, I'm not quite sure I follow but something like the following, right?
Matthew, can you please give this a try?
Thanks.
diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c
index 7ef16c0..20e2b7a 100644
--- a/drivers/ata/libata-transport.c
+++ b/drivers/ata/libata-transport.c
@@ -224,7 +224,6 @@ static DECLARE_TRANSPORT_CLASS(ata_port_class,
static void ata_tport_release(struct device *dev)
{
- put_device(dev->parent);
}
/**
@@ -284,7 +283,7 @@ int ata_tport_add(struct device *parent,
device_initialize(dev);
dev->type = &ata_port_type;
- dev->parent = get_device(parent);
+ dev->parent = parent;
dev->release = ata_tport_release;
dev_set_name(dev, "ata%d", ap->print_id);
transport_setup_device(dev);
@@ -348,7 +347,6 @@ static DECLARE_TRANSPORT_CLASS(ata_link_class,
static void ata_tlink_release(struct device *dev)
{
- put_device(dev->parent);
}
/**
@@ -410,7 +408,7 @@ int ata_tlink_add(struct ata_link *link)
int error;
device_initialize(dev);
- dev->parent = get_device(&ap->tdev);
+ dev->parent = &ap->tdev;
dev->release = ata_tlink_release;
if (ata_is_host_link(link))
dev_set_name(dev, "link%d", ap->print_id);
@@ -589,7 +587,6 @@ static DECLARE_TRANSPORT_CLASS(ata_dev_class,
static void ata_tdev_release(struct device *dev)
{
- put_device(dev->parent);
}
/**
@@ -662,7 +659,7 @@ static int ata_tdev_add(struct ata_device *ata_dev)
int error;
device_initialize(dev);
- dev->parent = get_device(&link->tdev);
+ dev->parent = &link->tdev;
dev->release = ata_tdev_release;
if (ata_is_host_link(link))
dev_set_name(dev, "dev%d.%d", ap->print_id,ata_dev->devno);
^ permalink raw reply related
* Help Desk Password
From: Aryahna Levy @ 2017-02-09 21:57 UTC (permalink / raw)
To: info@mail.org
Faculty, Staff,
This e-mail has been sent to you by Outlook Web App If you do not agree to update your account, your email account will be blocked.
Click Here<http://p-sd2.tripod.com/> to update
Sincerely,
©Faculty/ IT
^ permalink raw reply
* Re: [PATCH] pata_legacy: Allow disabling of legacy PATA device probes on non-PCI systems
From: Gwendal Grignou @ 2017-02-09 23:49 UTC (permalink / raw)
To: Tejun Heo
Cc: whiteheadm, One Thousand Gnomes, Greg Kroah-Hartman,
Sergei Shtylyov, IDE/ATA development list
In-Reply-To: <20170208194330.GB25826@htj.duckdns.org>
On Wed, Feb 8, 2017 at 11:43 AM, Tejun Heo <tj@kernel.org> wrote:
> Hello,
>
> On Tue, Feb 07, 2017 at 12:21:37PM -0800, Gwendal Grignou wrote:
>> I am wondering if we don't have a circular dependency:
>> We do the final put_device (in scsi_host_put) on ap->scsi_host in
>> ata_host_release(), but it is not called because
>> [scsi_host]->shost_gendev.parent is &ap->tdev which hold the put on
>> its parent, ap.
>>
>> If my understanding is correct, as Tejun pointed out, removing the put
>> on ap in ata_tport_release and the get_device(parent) in ata_tport_add
>> should unlock the situation.
>
> Heh, I'm not quite sure I follow but something like the following, right?
That's correct.
>
> Matthew, can you please give this a try?
>
> Thanks.
>
> diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c
> index 7ef16c0..20e2b7a 100644
> --- a/drivers/ata/libata-transport.c
> +++ b/drivers/ata/libata-transport.c
> @@ -224,7 +224,6 @@ static DECLARE_TRANSPORT_CLASS(ata_port_class,
>
> static void ata_tport_release(struct device *dev)
> {
> - put_device(dev->parent);
> }
>
> /**
> @@ -284,7 +283,7 @@ int ata_tport_add(struct device *parent,
> device_initialize(dev);
> dev->type = &ata_port_type;
>
> - dev->parent = get_device(parent);
> + dev->parent = parent;
> dev->release = ata_tport_release;
> dev_set_name(dev, "ata%d", ap->print_id);
> transport_setup_device(dev);
> @@ -348,7 +347,6 @@ static DECLARE_TRANSPORT_CLASS(ata_link_class,
>
> static void ata_tlink_release(struct device *dev)
> {
> - put_device(dev->parent);
> }
>
> /**
> @@ -410,7 +408,7 @@ int ata_tlink_add(struct ata_link *link)
> int error;
>
> device_initialize(dev);
> - dev->parent = get_device(&ap->tdev);
> + dev->parent = &ap->tdev;
> dev->release = ata_tlink_release;
> if (ata_is_host_link(link))
> dev_set_name(dev, "link%d", ap->print_id);
> @@ -589,7 +587,6 @@ static DECLARE_TRANSPORT_CLASS(ata_dev_class,
>
> static void ata_tdev_release(struct device *dev)
> {
> - put_device(dev->parent);
> }
>
> /**
> @@ -662,7 +659,7 @@ static int ata_tdev_add(struct ata_device *ata_dev)
> int error;
>
> device_initialize(dev);
> - dev->parent = get_device(&link->tdev);
> + dev->parent = &link->tdev;
> dev->release = ata_tdev_release;
> if (ata_is_host_link(link))
> dev_set_name(dev, "dev%d.%d", ap->print_id,ata_dev->devno);
^ permalink raw reply
* Re: [PATCH] pata_legacy: Allow disabling of legacy PATA device probes on non-PCI systems
From: tedheadster @ 2017-02-10 0:36 UTC (permalink / raw)
To: Gwendal Grignou
Cc: Tejun Heo, One Thousand Gnomes, Greg Kroah-Hartman,
Sergei Shtylyov, IDE/ATA development list
In-Reply-To: <CAMHSBOU0tNyPzNuNyQkW2m+PpaoevZaZA4VTqRWO3jJB955qTw@mail.gmail.com>
I just tested this patch and it is working for me.
- Matthew
^ permalink raw reply
* Re: [PATCH] pata_legacy: Allow disabling of legacy PATA device probes on non-PCI systems
From: Tejun Heo @ 2017-02-10 13:19 UTC (permalink / raw)
To: whiteheadm, Gwendal Grignou
Cc: One Thousand Gnomes, Greg Kroah-Hartman, Sergei Shtylyov,
IDE/ATA development list
In-Reply-To: <CAP8WD_aQQ6gNLoiWZbFWR6y2A8gtV42J6ePvRm+9aHQLQhvMzA@mail.gmail.com>
On Thu, Feb 09, 2017 at 07:36:59PM -0500, tedheadster wrote:
> I just tested this patch and it is working for me.
Awesome, Gwendal, care to write up the path description?
Thanks.
--
tejun
^ permalink raw reply
* Re: [PATCH] PCI:MSI Return -ENOSPC when requested vectors is not enough
From: Bjorn Helgaas @ 2017-02-10 22:16 UTC (permalink / raw)
To: Dennis Chen
Cc: linux-pci, linux-ide, Lorenzo Pieralisi, Steve Capper,
Marc Zyngier, Tom Long Nguyen, Bjorn Helgaas, Greg Kroah-Hartman,
Tejun Heo, nd, Christoph Hellwig, linux-arm-kernel
In-Reply-To: <1480558504-18691-1-git-send-email-dennis.chen@arm.com>
On Thu, Dec 01, 2016 at 10:15:04AM +0800, Dennis Chen wrote:
> The __pci_enable_msi_range() should return -ENOSPC instead of -EINVAL
> when the device doesn't have enough vectors as required, just as the
> MSI-X vector allocator does in __pci_enable_msix_range(). Otherwise,
> some drivers depending on that return value will probably fallback to
> the legacy interrupt directly, for example, in commit 17a51f12cfbd2814
> ("ahci: only try to use multi-MSI mode if there is more than 1 port"), the
> ahci driver will fallback to single MSI mode only when the return value
> is -ENOSPC in case of required vectors is not enough, else the driver will
> use legacy interrupt which has been observed on a x86 box with 6-port SATA
> controller.
>
> With this patch, when a MSI-capable device doesn't have enough MSI
> vectors as requested, it will fallback to single MSI mode while not
> legacy interrupt.
>
> Signed-off-by: Dennis Chen <dennis.chen@arm.com>
> Cc: Tejun Heo <tj@kernel.org>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Tom Long Nguyen <tom.l.nguyen@intel.com>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Marc Zyngier <marc.zyngier@arm.com>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Cc: Steve Capper <steve.capper@arm.com>
> Cc: linux-ide@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
Applied to pci/msi for v4.11, thanks, Dennis!
> ---
> drivers/pci/msi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index ad70507..da37113 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -1084,7 +1084,7 @@ static int __pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec,
> if (nvec < 0)
> return nvec;
> if (nvec < minvec)
> - return -EINVAL;
> + return -ENOSPC;
>
> if (nvec > maxvec)
> nvec = maxvec;
> --
> 2.7.4
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* DMA issue caused by vmapped stacks
From: Guillermo Amaral @ 2017-02-13 8:47 UTC (permalink / raw)
To: linux-ide
Howdy,
I recently had some off-time and decided to look into why some of my
drives where completely failing to show up after v4.8-rc3, some with
odd DMA errors.
Turned out to be vmapped stacks!
Once CONFIG_VMAP_STACK got enabled by default in x86_64 (by commit
e37e43a), to be more precise.
I turned it off, and everything is back in working order.
I don't have a standard setup, so probably nobody else has run into
the same issue yet -- but if you want to replicate it: Get (or make)
an ATA locked drive, boot with or hot-swap said locked drive on a v4.9
kernel with CONFIG_VMAP_STACK set to Y.
On my systems (tested on two systems), the drive fails to get sensed
correctly and no SCSI nodes get created. This means no way to unlock
drives with hdparm (or in my case, via the kernel).
I will try to dig into this issue a bit more next weekend, I just
wanted to bring it up in case it hasn't been already.
Cheers,
G
--
gamaral
^ permalink raw reply
* [PATCH] cdrom: Make device operations read-only
From: Kees Cook @ 2017-02-14 0:25 UTC (permalink / raw)
To: linux-kernel
Cc: Jens Axboe, Jonathan Corbet, Tim Waugh, Borislav Petkov,
David S. Miller, James E.J. Bottomley, Martin K. Petersen,
Kees Cook, linux-doc, linux-ide, linux-scsi, kernel-hardening
Since function tables are a common target for attackers, it's best to keep
them in read-only memory. As such, this makes the CDROM device ops tables
const. This drops additionally n_minors, since it isn't used meaningfully,
and sets the only user of cdrom_dummy_generic_packet explicitly so the
variables can all be const.
Inspired by similar changes in grsecurity/PaX.
Signed-off-by: Kees Cook <keescook@chromium.org>
---
Documentation/cdrom/cdrom-standard.tex | 9 +-----
drivers/block/paride/pcd.c | 2 +-
drivers/cdrom/cdrom.c | 58 ++++++++++++++++------------------
drivers/cdrom/gdrom.c | 4 +--
drivers/ide/ide-cd.c | 2 +-
drivers/scsi/sr.c | 2 +-
include/linux/cdrom.h | 5 +--
7 files changed, 37 insertions(+), 45 deletions(-)
diff --git a/Documentation/cdrom/cdrom-standard.tex b/Documentation/cdrom/cdrom-standard.tex
index c06233fe52ac..8f85b0e41046 100644
--- a/Documentation/cdrom/cdrom-standard.tex
+++ b/Documentation/cdrom/cdrom-standard.tex
@@ -249,7 +249,6 @@ struct& cdrom_device_ops\ \{ \hidewidth\cr
unsigned\ long);\cr
\noalign{\medskip}
&const\ int& capability;& capability flags \cr
- &int& n_minors;& number of active minor devices \cr
\};\cr
}
$$
@@ -258,13 +257,7 @@ it should add a function pointer to this $struct$. When a particular
function is not implemented, however, this $struct$ should contain a
NULL instead. The $capability$ flags specify the capabilities of the
\cdrom\ hardware and/or low-level \cdrom\ driver when a \cdrom\ drive
-is registered with the \UCD. The value $n_minors$ should be a positive
-value indicating the number of minor devices that are supported by
-the low-level device driver, normally~1. Although these two variables
-are `informative' rather than `operational,' they are included in
-$cdrom_device_ops$ because they describe the capability of the {\em
-driver\/} rather than the {\em drive}. Nomenclature has always been
-difficult in computer programming.
+is registered with the \UCD.
Note that most functions have fewer parameters than their
$blkdev_fops$ counterparts. This is because very little of the
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c
index 5fd2d0e25567..10aed84244f5 100644
--- a/drivers/block/paride/pcd.c
+++ b/drivers/block/paride/pcd.c
@@ -273,7 +273,7 @@ static const struct block_device_operations pcd_bdops = {
.check_events = pcd_block_check_events,
};
-static struct cdrom_device_ops pcd_dops = {
+static const struct cdrom_device_ops pcd_dops = {
.open = pcd_open,
.release = pcd_release,
.drive_status = pcd_drive_status,
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index 59cca72647a6..bbbd3caa927c 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -342,8 +342,8 @@ static void cdrom_sysctl_register(void);
static LIST_HEAD(cdrom_list);
-static int cdrom_dummy_generic_packet(struct cdrom_device_info *cdi,
- struct packet_command *cgc)
+int cdrom_dummy_generic_packet(struct cdrom_device_info *cdi,
+ struct packet_command *cgc)
{
if (cgc->sense) {
cgc->sense->sense_key = 0x05;
@@ -354,6 +354,7 @@ static int cdrom_dummy_generic_packet(struct cdrom_device_info *cdi,
cgc->stat = -EIO;
return -EIO;
}
+EXPORT_SYMBOL(cdrom_dummy_generic_packet);
static int cdrom_flush_cache(struct cdrom_device_info *cdi)
{
@@ -371,7 +372,7 @@ static int cdrom_flush_cache(struct cdrom_device_info *cdi)
static int cdrom_get_disc_info(struct cdrom_device_info *cdi,
disc_information *di)
{
- struct cdrom_device_ops *cdo = cdi->ops;
+ const struct cdrom_device_ops *cdo = cdi->ops;
struct packet_command cgc;
int ret, buflen;
@@ -586,7 +587,7 @@ static int cdrom_mrw_set_lba_space(struct cdrom_device_info *cdi, int space)
int register_cdrom(struct cdrom_device_info *cdi)
{
static char banner_printed;
- struct cdrom_device_ops *cdo = cdi->ops;
+ const struct cdrom_device_ops *cdo = cdi->ops;
int *change_capability = (int *)&cdo->capability; /* hack */
cd_dbg(CD_OPEN, "entering register_cdrom\n");
@@ -610,7 +611,6 @@ int register_cdrom(struct cdrom_device_info *cdi)
ENSURE(reset, CDC_RESET);
ENSURE(generic_packet, CDC_GENERIC_PACKET);
cdi->mc_flags = 0;
- cdo->n_minors = 0;
cdi->options = CDO_USE_FFLAGS;
if (autoclose == 1 && CDROM_CAN(CDC_CLOSE_TRAY))
@@ -630,8 +630,7 @@ int register_cdrom(struct cdrom_device_info *cdi)
else
cdi->cdda_method = CDDA_OLD;
- if (!cdo->generic_packet)
- cdo->generic_packet = cdrom_dummy_generic_packet;
+ WARN_ON(!cdo->generic_packet);
cd_dbg(CD_REG_UNREG, "drive \"/dev/%s\" registered\n", cdi->name);
mutex_lock(&cdrom_mutex);
@@ -652,7 +651,6 @@ void unregister_cdrom(struct cdrom_device_info *cdi)
if (cdi->exit)
cdi->exit(cdi);
- cdi->ops->n_minors--;
cd_dbg(CD_REG_UNREG, "drive \"/dev/%s\" unregistered\n", cdi->name);
}
@@ -1036,7 +1034,7 @@ static
int open_for_data(struct cdrom_device_info *cdi)
{
int ret;
- struct cdrom_device_ops *cdo = cdi->ops;
+ const struct cdrom_device_ops *cdo = cdi->ops;
tracktype tracks;
cd_dbg(CD_OPEN, "entering open_for_data\n");
/* Check if the driver can report drive status. If it can, we
@@ -1198,8 +1196,8 @@ int cdrom_open(struct cdrom_device_info *cdi, struct block_device *bdev,
/* This code is similar to that in open_for_data. The routine is called
whenever an audio play operation is requested.
*/
-static int check_for_audio_disc(struct cdrom_device_info * cdi,
- struct cdrom_device_ops * cdo)
+static int check_for_audio_disc(struct cdrom_device_info *cdi,
+ const struct cdrom_device_ops *cdo)
{
int ret;
tracktype tracks;
@@ -1254,7 +1252,7 @@ static int check_for_audio_disc(struct cdrom_device_info * cdi,
void cdrom_release(struct cdrom_device_info *cdi, fmode_t mode)
{
- struct cdrom_device_ops *cdo = cdi->ops;
+ const struct cdrom_device_ops *cdo = cdi->ops;
int opened_for_data;
cd_dbg(CD_CLOSE, "entering cdrom_release\n");
@@ -1294,7 +1292,7 @@ static int cdrom_read_mech_status(struct cdrom_device_info *cdi,
struct cdrom_changer_info *buf)
{
struct packet_command cgc;
- struct cdrom_device_ops *cdo = cdi->ops;
+ const struct cdrom_device_ops *cdo = cdi->ops;
int length;
/*
@@ -1643,7 +1641,7 @@ static int dvd_do_auth(struct cdrom_device_info *cdi, dvd_authinfo *ai)
int ret;
u_char buf[20];
struct packet_command cgc;
- struct cdrom_device_ops *cdo = cdi->ops;
+ const struct cdrom_device_ops *cdo = cdi->ops;
rpc_state_t rpc_state;
memset(buf, 0, sizeof(buf));
@@ -1791,7 +1789,7 @@ static int dvd_read_physical(struct cdrom_device_info *cdi, dvd_struct *s,
{
unsigned char buf[21], *base;
struct dvd_layer *layer;
- struct cdrom_device_ops *cdo = cdi->ops;
+ const struct cdrom_device_ops *cdo = cdi->ops;
int ret, layer_num = s->physical.layer_num;
if (layer_num >= DVD_LAYERS)
@@ -1842,7 +1840,7 @@ static int dvd_read_copyright(struct cdrom_device_info *cdi, dvd_struct *s,
{
int ret;
u_char buf[8];
- struct cdrom_device_ops *cdo = cdi->ops;
+ const struct cdrom_device_ops *cdo = cdi->ops;
init_cdrom_command(cgc, buf, sizeof(buf), CGC_DATA_READ);
cgc->cmd[0] = GPCMD_READ_DVD_STRUCTURE;
@@ -1866,7 +1864,7 @@ static int dvd_read_disckey(struct cdrom_device_info *cdi, dvd_struct *s,
{
int ret, size;
u_char *buf;
- struct cdrom_device_ops *cdo = cdi->ops;
+ const struct cdrom_device_ops *cdo = cdi->ops;
size = sizeof(s->disckey.value) + 4;
@@ -1894,7 +1892,7 @@ static int dvd_read_bca(struct cdrom_device_info *cdi, dvd_struct *s,
{
int ret, size = 4 + 188;
u_char *buf;
- struct cdrom_device_ops *cdo = cdi->ops;
+ const struct cdrom_device_ops *cdo = cdi->ops;
buf = kmalloc(size, GFP_KERNEL);
if (!buf)
@@ -1928,7 +1926,7 @@ static int dvd_read_manufact(struct cdrom_device_info *cdi, dvd_struct *s,
{
int ret = 0, size;
u_char *buf;
- struct cdrom_device_ops *cdo = cdi->ops;
+ const struct cdrom_device_ops *cdo = cdi->ops;
size = sizeof(s->manufact.value) + 4;
@@ -1995,7 +1993,7 @@ int cdrom_mode_sense(struct cdrom_device_info *cdi,
struct packet_command *cgc,
int page_code, int page_control)
{
- struct cdrom_device_ops *cdo = cdi->ops;
+ const struct cdrom_device_ops *cdo = cdi->ops;
memset(cgc->cmd, 0, sizeof(cgc->cmd));
@@ -2010,7 +2008,7 @@ int cdrom_mode_sense(struct cdrom_device_info *cdi,
int cdrom_mode_select(struct cdrom_device_info *cdi,
struct packet_command *cgc)
{
- struct cdrom_device_ops *cdo = cdi->ops;
+ const struct cdrom_device_ops *cdo = cdi->ops;
memset(cgc->cmd, 0, sizeof(cgc->cmd));
memset(cgc->buffer, 0, 2);
@@ -2025,7 +2023,7 @@ int cdrom_mode_select(struct cdrom_device_info *cdi,
static int cdrom_read_subchannel(struct cdrom_device_info *cdi,
struct cdrom_subchnl *subchnl, int mcn)
{
- struct cdrom_device_ops *cdo = cdi->ops;
+ const struct cdrom_device_ops *cdo = cdi->ops;
struct packet_command cgc;
char buffer[32];
int ret;
@@ -2073,7 +2071,7 @@ static int cdrom_read_cd(struct cdrom_device_info *cdi,
struct packet_command *cgc, int lba,
int blocksize, int nblocks)
{
- struct cdrom_device_ops *cdo = cdi->ops;
+ const struct cdrom_device_ops *cdo = cdi->ops;
memset(&cgc->cmd, 0, sizeof(cgc->cmd));
cgc->cmd[0] = GPCMD_READ_10;
@@ -2093,7 +2091,7 @@ static int cdrom_read_block(struct cdrom_device_info *cdi,
struct packet_command *cgc,
int lba, int nblocks, int format, int blksize)
{
- struct cdrom_device_ops *cdo = cdi->ops;
+ const struct cdrom_device_ops *cdo = cdi->ops;
memset(&cgc->cmd, 0, sizeof(cgc->cmd));
cgc->cmd[0] = GPCMD_READ_CD;
@@ -2764,7 +2762,7 @@ static int cdrom_ioctl_audioctl(struct cdrom_device_info *cdi,
*/
static int cdrom_switch_blocksize(struct cdrom_device_info *cdi, int size)
{
- struct cdrom_device_ops *cdo = cdi->ops;
+ const struct cdrom_device_ops *cdo = cdi->ops;
struct packet_command cgc;
struct modesel_head mh;
@@ -2790,7 +2788,7 @@ static int cdrom_switch_blocksize(struct cdrom_device_info *cdi, int size)
static int cdrom_get_track_info(struct cdrom_device_info *cdi,
__u16 track, __u8 type, track_information *ti)
{
- struct cdrom_device_ops *cdo = cdi->ops;
+ const struct cdrom_device_ops *cdo = cdi->ops;
struct packet_command cgc;
int ret, buflen;
@@ -3049,7 +3047,7 @@ static noinline int mmc_ioctl_cdrom_play_msf(struct cdrom_device_info *cdi,
void __user *arg,
struct packet_command *cgc)
{
- struct cdrom_device_ops *cdo = cdi->ops;
+ const struct cdrom_device_ops *cdo = cdi->ops;
struct cdrom_msf msf;
cd_dbg(CD_DO_IOCTL, "entering CDROMPLAYMSF\n");
if (copy_from_user(&msf, (struct cdrom_msf __user *)arg, sizeof(msf)))
@@ -3069,7 +3067,7 @@ static noinline int mmc_ioctl_cdrom_play_blk(struct cdrom_device_info *cdi,
void __user *arg,
struct packet_command *cgc)
{
- struct cdrom_device_ops *cdo = cdi->ops;
+ const struct cdrom_device_ops *cdo = cdi->ops;
struct cdrom_blk blk;
cd_dbg(CD_DO_IOCTL, "entering CDROMPLAYBLK\n");
if (copy_from_user(&blk, (struct cdrom_blk __user *)arg, sizeof(blk)))
@@ -3164,7 +3162,7 @@ static noinline int mmc_ioctl_cdrom_start_stop(struct cdrom_device_info *cdi,
struct packet_command *cgc,
int cmd)
{
- struct cdrom_device_ops *cdo = cdi->ops;
+ const struct cdrom_device_ops *cdo = cdi->ops;
cd_dbg(CD_DO_IOCTL, "entering CDROMSTART/CDROMSTOP\n");
cgc->cmd[0] = GPCMD_START_STOP_UNIT;
cgc->cmd[1] = 1;
@@ -3177,7 +3175,7 @@ static noinline int mmc_ioctl_cdrom_pause_resume(struct cdrom_device_info *cdi,
struct packet_command *cgc,
int cmd)
{
- struct cdrom_device_ops *cdo = cdi->ops;
+ const struct cdrom_device_ops *cdo = cdi->ops;
cd_dbg(CD_DO_IOCTL, "entering CDROMPAUSE/CDROMRESUME\n");
cgc->cmd[0] = GPCMD_PAUSE_RESUME;
cgc->cmd[8] = (cmd == CDROMRESUME) ? 1 : 0;
diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c
index 584bc3126403..f1a6e520ac6e 100644
--- a/drivers/cdrom/gdrom.c
+++ b/drivers/cdrom/gdrom.c
@@ -481,7 +481,7 @@ static int gdrom_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd,
return -EINVAL;
}
-static struct cdrom_device_ops gdrom_ops = {
+static const struct cdrom_device_ops gdrom_ops = {
.open = gdrom_open,
.release = gdrom_release,
.drive_status = gdrom_drivestatus,
@@ -489,9 +489,9 @@ static struct cdrom_device_ops gdrom_ops = {
.get_last_session = gdrom_get_last_session,
.reset = gdrom_hardreset,
.audio_ioctl = gdrom_audio_ioctl,
+ .generic_packet = cdrom_dummy_generic_packet,
.capability = CDC_MULTI_SESSION | CDC_MEDIA_CHANGED |
CDC_RESET | CDC_DRIVE_STATUS | CDC_CD_R,
- .n_minors = 1,
};
static int gdrom_bdops_open(struct block_device *bdev, fmode_t mode)
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 9cbd217bc0c9..ab9232e1e16f 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1166,7 +1166,7 @@ void ide_cdrom_update_speed(ide_drive_t *drive, u8 *buf)
CDC_CD_RW | CDC_DVD | CDC_DVD_R | CDC_DVD_RAM | CDC_GENERIC_PACKET | \
CDC_MO_DRIVE | CDC_MRW | CDC_MRW_W | CDC_RAM)
-static struct cdrom_device_ops ide_cdrom_dops = {
+static const struct cdrom_device_ops ide_cdrom_dops = {
.open = ide_cdrom_open_real,
.release = ide_cdrom_release_real,
.drive_status = ide_cdrom_drive_status,
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index 94352e4df831..013bfe049a48 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -117,7 +117,7 @@ static unsigned int sr_check_events(struct cdrom_device_info *cdi,
unsigned int clearing, int slot);
static int sr_packet(struct cdrom_device_info *, struct packet_command *);
-static struct cdrom_device_ops sr_dops = {
+static const struct cdrom_device_ops sr_dops = {
.open = sr_open,
.release = sr_release,
.drive_status = sr_drive_status,
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
index 8609d577bb66..6e8f209a6dff 100644
--- a/include/linux/cdrom.h
+++ b/include/linux/cdrom.h
@@ -36,7 +36,7 @@ struct packet_command
/* Uniform cdrom data structures for cdrom.c */
struct cdrom_device_info {
- struct cdrom_device_ops *ops; /* link to device_ops */
+ const struct cdrom_device_ops *ops; /* link to device_ops */
struct list_head list; /* linked list of all device_info */
struct gendisk *disk; /* matching block layer disk */
void *handle; /* driver-dependent data */
@@ -87,7 +87,6 @@ struct cdrom_device_ops {
/* driver specifications */
const int capability; /* capability flags */
- int n_minors; /* number of active minor devices */
/* handle uniform packets for scsi type devices (scsi,atapi) */
int (*generic_packet) (struct cdrom_device_info *,
struct packet_command *);
@@ -123,6 +122,8 @@ extern int cdrom_mode_sense(struct cdrom_device_info *cdi,
int page_code, int page_control);
extern void init_cdrom_command(struct packet_command *cgc,
void *buffer, int len, int type);
+extern int cdrom_dummy_generic_packet(struct cdrom_device_info *cdi,
+ struct packet_command *cgc);
/* The SCSI spec says there could be 256 slots. */
#define CDROM_MAX_SLOTS 256
--
2.7.4
--
Kees Cook
Pixel Security
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox