Page MenuHomeFreeBSD

Remove unnecessary sema, use msleep instead
ClosedPublic

Authored by howard0su_gmail.com on Mar 12 2016, 2:21 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 22 2024, 12:31 PM
Unknown Object (File)
Dec 20 2023, 12:24 AM
Unknown Object (File)
Dec 15 2023, 5:19 PM
Unknown Object (File)
Dec 10 2023, 12:00 AM
Unknown Object (File)
Nov 27 2023, 2:50 PM
Unknown Object (File)
Nov 23 2023, 12:49 AM
Unknown Object (File)
Nov 19 2023, 12:54 PM
Unknown Object (File)
Nov 17 2023, 6:10 AM

Details

Summary

Code Cleanup to remove sema

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 2874
Build 2898: arc lint + arc unit

Event Timeline

howard0su_gmail.com retitled this revision from to Remove unnecessary sema, use msleep instead.
howard0su_gmail.com updated this object.
howard0su_gmail.com edited the test plan for this revision. (Show Details)
sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
625

Which resource need to be protected by this lock?

sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
625

It's to make the msleep() usages work.
msleep(xxx, &sc->hslock, xxx,...) assumes the lock has been required.

996

I assume you've checked it's OK to remove the M_ZERO.

However, I found the "retries" field of hv_storvsc_request may be used before proper initialization:

grep 'retries = ' dev/hyperv/storvsc/ -nr

dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c:2027: reqp->retries = 0;

We can see it's only initialized once in storvsc_io_done(), but in this function, it's also tested before the initialization.

1007

Why is it removed? reqp->softc is used in several places.

sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
625

typo.. "required" -> "acquired".

sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
625

Yes. This is due to avoid race condition between sleep and wakeup. In our case, it is not possible but WITNESS requires it anyhow.

996

This is actual a pre-allocate buf pool. every time, grab one from the pool, we will call bzero to initialize it. so it is not needed to zero it here.

1007

it will bzero when grab it from the pool. and set softc again.

decui_microsoft.com edited edge metadata.

LGTM

sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
996

Got it -- I saw that in storvsc_action()'s case XPT_SCSI_IO.

1007

Got it.

This revision is now accepted and ready to land.Mar 13 2016, 12:56 PM
sepherosa_gmail.com edited edge metadata.

Most parts no longer apply; and we will take different approach, i.e. vmbus_xact.