Skip to content

Commit 5479b27

Browse files
committed
nfit/ars: Allow root to busy-poll the ARS state machine
The ARS implementation implements exponential back-off on the poll interval to prevent high-frequency access to the DIMM / platform interface. Depending on when the ARS completes the poll interval may exceed the completion event by minutes. Allow root to reset the timeout each time it probes the status. A one-second timeout is still enforced, but root can otherwise can control the poll interval. Fixes: bc6ba80 ("nfit, address-range-scrub: rework and simplify ARS...") Cc: <stable@vger.kernel.org> Reported-by: Erwin Tsaur <erwin.tsaur@oracle.com> Reviewed-by: Toshi Kani <toshi.kani@hpe.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent e34b825 commit 5479b27

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

drivers/acpi/nfit/core.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,6 +1333,13 @@ static ssize_t scrub_show(struct device *dev,
13331333
busy = test_bit(ARS_BUSY, &acpi_desc->scrub_flags)
13341334
&& !test_bit(ARS_CANCEL, &acpi_desc->scrub_flags);
13351335
rc = sprintf(buf, "%d%s", acpi_desc->scrub_count, busy ? "+\n" : "\n");
1336+
/* Allow an admin to poll the busy state at a higher rate */
1337+
if (busy && capable(CAP_SYS_RAWIO) && !test_and_set_bit(ARS_POLL,
1338+
&acpi_desc->scrub_flags)) {
1339+
acpi_desc->scrub_tmo = 1;
1340+
mod_delayed_work(nfit_wq, &acpi_desc->dwork, HZ);
1341+
}
1342+
13361343
mutex_unlock(&acpi_desc->init_mutex);
13371344
device_unlock(dev);
13381345
return rc;
@@ -3187,6 +3194,7 @@ static void acpi_nfit_scrub(struct work_struct *work)
31873194
else
31883195
notify_ars_done(acpi_desc);
31893196
memset(acpi_desc->ars_status, 0, acpi_desc->max_ars);
3197+
clear_bit(ARS_POLL, &acpi_desc->scrub_flags);
31903198
mutex_unlock(&acpi_desc->init_mutex);
31913199
}
31923200

drivers/acpi/nfit/nfit.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ struct nfit_mem {
213213
enum scrub_flags {
214214
ARS_BUSY,
215215
ARS_CANCEL,
216+
ARS_POLL,
216217
};
217218

218219
struct acpi_nfit_desc {

0 commit comments

Comments
 (0)