-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tcmur: improve batch kernel wake up notifications #392
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,12 +57,15 @@ void tcmur_command_complete(struct tcmu_device *dev, struct tcmulib_cmd *cmd, | |
static void aio_command_finish(struct tcmu_device *dev, struct tcmulib_cmd *cmd, | ||
int rc) | ||
{ | ||
int wakeup; | ||
struct tcmur_device *rdev = tcmu_get_daemon_dev_private(dev); | ||
int wake_up; | ||
|
||
track_aio_request_finish(tcmu_get_daemon_dev_private(dev), &wakeup); | ||
tcmur_command_complete(dev, cmd, rc); | ||
if (wakeup) | ||
track_aio_request_finish(rdev, &wake_up); | ||
while (wake_up) { | ||
tcmulib_processing_complete(dev); | ||
track_aio_wakeup_finish(rdev, &wake_up); | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we could hit a race:
If the race analysis is correct I think we just need to do something like the attached where we hold the device completion lock while updating the aio track calls as well as doing the tcmulib_command_complete. aio_command_finish it just a little funky in that it straddles both the aio code and tcmur cmd handler code, so my change here is a little gross. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Couldn't the call to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Lol, yeah that is much better! My eyes were probably going crosseyed :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK -- swapped the two function calls. |
||
|
||
static int alloc_iovec(struct tcmulib_cmd *cmd, size_t length) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think cleanup is necessary here. It's necessary when there is a cancellation point in the critical section. My reading of posix (and the linux man page) doesn't include assert as a cancellation point, but I could be wrong... It may output, which could block (and hence should count as a cancellation point), but if it does, it will exit the application anyway so is probably moot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's probably not needed since the daemon will crash if we hit the assert.
I think we are sometimes overly careful. We can do a clean up patch later.