Module Name:    src
Committed By:   martin
Date:           Fri Dec 30 14:39:10 UTC 2022

Modified Files:
        src/sys/dev/ata [netbsd-9]: ata.c ata_recovery.c ata_wdc.c atavar.h
            satapmp_subr.c wd.c
        src/sys/dev/ic [netbsd-9]: ahcisata_core.c mvsata.c siisata.c wdc.c
            wdcvar.h
        src/sys/dev/scsipi [netbsd-9]: atapi_wdc.c
        src/sys/dev/usb [netbsd-9]: umass_isdata.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1557):

        sys/dev/ic/ahcisata_core.c: revision 1.83
        sys/dev/ic/ahcisata_core.c: revision 1.102
        sys/dev/ata/ata.c: revision 1.164
        sys/dev/ata/ata_wdc.c: revision 1.115
        sys/dev/ata/ata_recovery.c: revision 1.4
        sys/dev/ic/siisata.c: revision 1.42
        sys/dev/ic/wdc.c: revision 1.308
        sys/dev/ic/mvsata.c: revision 1.56
        sys/dev/scsipi/atapi_wdc.c: revision 1.138
        sys/dev/ic/siisata.c: revision 1.49
        sys/dev/ata/atavar.h: revision 1.105
        sys/dev/ata/wd.c: revision 1.460
        sys/dev/ata/ata.c: revision 1.155
        sys/dev/ata/wd.c: revision 1.462
        sys/dev/ata/atavar.h: revision 1.109
        sys/dev/ata/satapmp_subr.c: revision 1.16
        sys/dev/ic/wdc.c: revision 1.299
        sys/dev/ic/ahcisata_core.c: revision 1.93
        sys/dev/ata/ata_wdc.c: revision 1.120
        sys/dev/ic/wdcvar.h: revision 1.100
        sys/dev/scsipi/atapi_wdc.c: revision 1.141
        sys/dev/ic/mvsata.c: revision 1.61
        sys/dev/usb/umass_isdata.c      (apply patch)

drop wd lock in wdstart1() before calling the ata_bio hook; when called
from ata thread context, that can still need to sleep for wdc attachments
in wdcwait()

fix use-after-free for ata xfer on bio submission found by KASAN
driver ata_bio hooks read parts of the xfer after ata_exec_xfer()
call in order to determine return value, change so that the hook
doesn't return any value - callers do not care already,
as all I/O requests are asynchronous

this problem was uncovered by recent change for wd(4) to not hold
wd mutex during ata_bio call, the interrupt for the xfer might
thus actually fire immediately

adjust also ata_exec_command driver hooks similarily - remove all
completion and waiting logic from drivers, upper layer ata code
using AT_WAIT/AT_POLL changed to call ata_wait_cmd() itself
PR kern/55169 by Nick Hudson

Function declaration formating whitespace consistency.  NFCI.

PR kern/56403
Fix kernel freeze for wdc(4) variants with ATAC_CAP_NOIRQ:

(1) Change ata_xfer_ops:c_poll from void to int function. When it returns
    ATAPOLL_AGAIN, let ata_xfer_start() iterate itself again.
(2) Let wdc_ata_bio_poll() return ATAPOLL_AGAIN until ATA_ITSDONE is
    achieved.

A similar change has been made for mvsata(4) (see mvsata_bio_poll()),
and no functional changes for other devices.

This is how the drivers worked before jdolecek-ncq branch was merged.
Note that this changes are less likely to cause infinite recursion:

(1) wdc_ata_bio_intr() called from wdc_ata_bio_poll() asserts ATA_ITSDONE
    in its error handling paths via wdc_ata_bio_done().
(2) Return value from c_start (= wdc_ata_bio_start()) is checked in
    ata_xfer_start().

Therefore, errors encountered in ata_xfer_ops:c_poll and c_start routines
terminate the recursion for wdc(4). The situation is similar for mvsata(4).

Still, there is a possibility where ata_xfer_start() takes long time to
finish a normal operation. This can result in a delayed response for lower
priority interrupts. But, I've never observed such a situation, even when
heavy thrashing takes place for swap partition in wd(4).
"Go ahead" by jdolecek@.


To generate a diff of this commit:
cvs rdiff -u -r1.149.2.2 -r1.149.2.3 src/sys/dev/ata/ata.c
cvs rdiff -u -r1.2.8.1 -r1.2.8.2 src/sys/dev/ata/ata_recovery.c
cvs rdiff -u -r1.113 -r1.113.4.1 src/sys/dev/ata/ata_wdc.c
cvs rdiff -u -r1.103 -r1.103.4.1 src/sys/dev/ata/atavar.h
cvs rdiff -u -r1.15 -r1.15.4.1 src/sys/dev/ata/satapmp_subr.c
cvs rdiff -u -r1.452.2.2 -r1.452.2.3 src/sys/dev/ata/wd.c
cvs rdiff -u -r1.75.4.4 -r1.75.4.5 src/sys/dev/ic/ahcisata_core.c
cvs rdiff -u -r1.48 -r1.48.2.1 src/sys/dev/ic/mvsata.c
cvs rdiff -u -r1.39 -r1.39.4.1 src/sys/dev/ic/siisata.c
cvs rdiff -u -r1.291.4.1 -r1.291.4.2 src/sys/dev/ic/wdc.c
cvs rdiff -u -r1.98.10.1 -r1.98.10.2 src/sys/dev/ic/wdcvar.h
cvs rdiff -u -r1.133 -r1.133.4.1 src/sys/dev/scsipi/atapi_wdc.c
cvs rdiff -u -r1.42 -r1.42.4.1 src/sys/dev/usb/umass_isdata.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Reply via email to