Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp854734yba; Wed, 24 Apr 2019 10:40:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqwycJaf5kE4icnXghgwvsdyg5iBHDT/0LR+C/j3It4LERxZuMJRJWWuakggP5AjUOJPjjbG X-Received: by 2002:a62:205c:: with SMTP id g89mr34066124pfg.34.1556127638249; Wed, 24 Apr 2019 10:40:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556127638; cv=none; d=google.com; s=arc-20160816; b=k3IFhYy5svDvCclvdFNaF8OV1WAddryNUmdbsxHBlMO3VQy9E5OZNUZ6BHAcLO5omO IK1sSyTPljwJ9e75T1LUxlBRK8J8nnjL9f7dzz/VhYhULrtmALxqW/5U1MJ5X9rPAj9g MBMDtDOdmcI+kl3grfKo57bwVFOkKPydK+1Pr6jVyT1ZQNGsHu231zSnE4IgUNiEjKE7 FJabBpyC2IoXxXTI3OKf51GanEyfF9PklcGT1Y//9ZWzhrKtUnGuwRQmGTigYdu9/VkR dndUzjm/N/XwSPBZrKYBOKxxAsmAlrK2oqyD+loot+q/HwxTRS9aAcPaZjWticBIiR9l AUuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=v+IGgsIcMU4qL2tH5tZciArYfNKMG3cynBf9DQJtUno=; b=C09IxTlz11jV+5LrzW24AaK36qj8q24OCtsjUs20XzBiALhkmsPMxlm91RbbQOlQMR iu3rNKzR+C0KVzRj7XVTKwUl9KxxIOtMEcBuguyz0E2maxxlmxFyPfYekG2Qs+UAdArT lu/qQnC+ZLRJySOX7Hf8V5T5x54ha562rDce2K/YiIGPocS8p+CHXjGF61vs3YgeWno1 QDg6GbE+DalNUGY0C+5qfD5nQrgqFdW4+QZK301AF0+OR1SDd+5UF1/V6OOVt3dStXCI I/Rb2MECvrVX6ux3a6jqfLVzvkuTjPbeZhXEpR6PQAnyjis3il8wWnTAYjp1VfjIqIZw rBNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sC15aiGO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n8si18794560plk.108.2019.04.24.10.40.23; Wed, 24 Apr 2019 10:40:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sC15aiGO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392290AbfDXRhx (ORCPT + 99 others); Wed, 24 Apr 2019 13:37:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:36904 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392273AbfDXRht (ORCPT ); Wed, 24 Apr 2019 13:37:49 -0400 Received: from localhost (62-193-50-229.as16211.net [62.193.50.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0DB6C2054F; Wed, 24 Apr 2019 17:37:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556127468; bh=LsHaX6xQcgDK/uYHzVPsRvaJcP+eXZiyMT0Hc/0VLgo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sC15aiGO0QJX8yIjLX6pNDZaaCKG3nIPLYc9lSLC6pbobppJ61yVWuddJwdvtab6G DWOroCcuB9qvgOK3OSfY7bp/6GJqd9gAZp35+oYseJsudhe7vFUcBmAJRox9njakVu RktFw9ixnr+OjFNkGT2E8NzIS7KjoPrqEu+ruCco= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Erwin Tsaur , Toshi Kani , Dan Williams , Sasha Levin Subject: [PATCH 5.0 102/115] nfit/ars: Allow root to busy-poll the ARS state machine Date: Wed, 24 Apr 2019 19:10:38 +0200 Message-Id: <20190424170930.705928099@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190424170924.797924502@linuxfoundation.org> References: <20190424170924.797924502@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org commit 5479b2757f26fe9908fc341d105b2097fe820b6f upstream. 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: bc6ba8085842 ("nfit, address-range-scrub: rework and simplify ARS...") Cc: Reported-by: Erwin Tsaur Reviewed-by: Toshi Kani Signed-off-by: Dan Williams Signed-off-by: Sasha Levin --- drivers/acpi/nfit/core.c | 8 ++++++++ drivers/acpi/nfit/nfit.h | 1 + 2 files changed, 9 insertions(+) diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c index 64308e669250..61d3fd65fbe9 100644 --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c @@ -1335,6 +1335,13 @@ static ssize_t scrub_show(struct device *dev, busy = test_bit(ARS_BUSY, &acpi_desc->scrub_flags) && !test_bit(ARS_CANCEL, &acpi_desc->scrub_flags); rc = sprintf(buf, "%d%s", acpi_desc->scrub_count, busy ? "+\n" : "\n"); + /* Allow an admin to poll the busy state at a higher rate */ + if (busy && capable(CAP_SYS_RAWIO) && !test_and_set_bit(ARS_POLL, + &acpi_desc->scrub_flags)) { + acpi_desc->scrub_tmo = 1; + mod_delayed_work(nfit_wq, &acpi_desc->dwork, HZ); + } + mutex_unlock(&acpi_desc->init_mutex); device_unlock(dev); return rc; @@ -3196,6 +3203,7 @@ static void acpi_nfit_scrub(struct work_struct *work) else notify_ars_done(acpi_desc); memset(acpi_desc->ars_status, 0, acpi_desc->max_ars); + clear_bit(ARS_POLL, &acpi_desc->scrub_flags); mutex_unlock(&acpi_desc->init_mutex); } diff --git a/drivers/acpi/nfit/nfit.h b/drivers/acpi/nfit/nfit.h index 897ce10192a0..d14bad687fb8 100644 --- a/drivers/acpi/nfit/nfit.h +++ b/drivers/acpi/nfit/nfit.h @@ -213,6 +213,7 @@ struct nfit_mem { enum scrub_flags { ARS_BUSY, ARS_CANCEL, + ARS_POLL, }; struct acpi_nfit_desc { -- 2.19.1