Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2293893ybg; Fri, 5 Jun 2020 10:11:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQFzcRhdOdQWhAfa2PT2cc+YaPejFCQSvnHVX7D9rzH8gwrRwn7J8Oe160IQjQ8PWoF8HR X-Received: by 2002:a17:906:6d4b:: with SMTP id a11mr10144199ejt.108.1591377104513; Fri, 05 Jun 2020 10:11:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591377104; cv=none; d=google.com; s=arc-20160816; b=c1FgGC2OcImvUeccygavqS9KQ7/R/yOdhltQPi4RvLA3xB9zLNfywqjTDZFepQ0Joy 0zpJKQBkA5z9luM3jL5QN2vQ4efBciUWVUiiVIjat22us93mnKpGLurHlMpxQrq8hblP Dvi0lw9aCf3AWUcmQEQKovb2PL0Ml0rV7vDvs8TZ4p51VBr8aOKNJlLnIzTknohLA+7y oRxfu1fff4AEAQ3yuFj2v+xqoSL5a6I5m7bYRAZcDTV/dB+67QfFd1l9apl+CpeYlJhm UX6ZvXso3h/A6bZ5B4JkRRDo5IJWawtGbEfTWCXSej64elqB91dbu7mzw0h/7uS+ptNQ DPJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=nXYAuD6cJqilYclvO4FvsMZJybvzN9VYDs0VzjdhPnY=; b=u9iYOhZdwKnArDZZ9edHsvlmLobOWCn2B1vD0AB21AcAukwlxlf9y1R7PrOswl2pV0 Bqii4FkzJtsYMSZqPM5WWXncf5nn4n4lDd6/IJ4eHGDXxuGC3EVCMUNCAnvRBSAF8IBQ FIQDBJydhuniYrN0Ln137O/VT8uMbG/Rpzt9volvja2MVqUiErPuQ++NWswr7+TuOGpQ exLwvESHk6ZM+s4nEu5SMDUaYPI0KEZ/Y3cweIdr+iPtVyHkAuh5z29TaqbZJVqm5/Fy DljeYjEbLwxoKQ6nagNAci0n49kWZ6w/3y/yIi9jtVwGucdHRCK7O/6HNyqB3xeXF+Z7 KKYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=t5puf6jy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cm27si3808972edb.248.2020.06.05.10.11.21; Fri, 05 Jun 2020 10:11:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=t5puf6jy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727034AbgFERJH (ORCPT + 99 others); Fri, 5 Jun 2020 13:09:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726652AbgFERJG (ORCPT ); Fri, 5 Jun 2020 13:09:06 -0400 Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EAABC08C5C2 for ; Fri, 5 Jun 2020 10:09:06 -0700 (PDT) Received: by mail-ed1-x541.google.com with SMTP id k8so8031691edq.4 for ; Fri, 05 Jun 2020 10:09:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nXYAuD6cJqilYclvO4FvsMZJybvzN9VYDs0VzjdhPnY=; b=t5puf6jywvyNN+70hb28Pvg47DXUPXRfy9clfajsTCTEsz1DVvuvmucmrFXPN4Yera iX5tmSkGaAyNZayciyT3GMyFrOCN4SMWL8M84IxZWnMlNodshGHe66dJPL3M3KK6I7au +Gg13yxDpSJdJwDAO/u+oQ8sXaQeYhxw/MvP+CTILg91x4xdp1wBvSxfUYgpmnTt/Mh1 ptUOCyR+L/3/QbN0ianVVqfl1yyY1EzbmpTorznVSk6wXtS5PLZ7NKDsgw4KvfvqTugO 4eHoGho3ymydRboxbZbhxWUgmRgJ6CgGhcQB5t8qPVtxxju5siJRkecD5se6dBe/h2N6 0LAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=nXYAuD6cJqilYclvO4FvsMZJybvzN9VYDs0VzjdhPnY=; b=Qi5lzr8QHSue+gu+Dr5KEV/d4El4F8PnSqMebmeS13YGl2LbdyDzQpTjpYZpe7CL+p /xxTTrHvk2DP7xVPT5B/j3FV71t/wVhzU/kJKMmBRoXCPzmUr3p5jdVbOvDBIfBIt/Le JG6bN/XmAtHEJOySYgek6B50KLincoBFTKOubVaiHsynuAUuVs4xRqeCFmxWlxwnC/eE /rrZ70an5d/f6mfM40aErHE8KDpKI4IJ+RHz0Sg4y2FMkD0fIztzKNcXFMyAD8sfWlOI 0Ai6Oqh0YHD8CAH3Wc9EOKWHznDKfDSctaWJmHWLKG/6/E/zBV4MbkKinnVlhJ/KC6Tj Hrag== X-Gm-Message-State: AOAM532Le5HehWA7zz9IbNTOQPyK0/noan4x8GP+tJBY20gFCnpmzvGj 9d8HZ9iGOkjkcFAQR2MSjBFR30d3El5rJov8IjIPNA== X-Received: by 2002:aa7:c944:: with SMTP id h4mr10040096edt.383.1591376944978; Fri, 05 Jun 2020 10:09:04 -0700 (PDT) MIME-Version: 1.0 References: <158889473309.2292982.18007035454673387731.stgit@dwillia2-desk3.amr.corp.intel.com> <2643462.teTRrieJB7@kreacher> In-Reply-To: <2643462.teTRrieJB7@kreacher> From: Dan Williams Date: Fri, 5 Jun 2020 10:08:53 -0700 Message-ID: Subject: Re: [RFT][PATCH] ACPI: OSL: Use rwlock instead of RCU for memory management To: "Rafael J. Wysocki" Cc: Rafael J Wysocki , stable , Len Brown , Borislav Petkov , Ira Weiny , James Morse , Erik Kaneda , Myron Stowe , Andy Shevchenko , Linux Kernel Mailing List , Linux ACPI , linux-nvdimm Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 5, 2020 at 7:06 AM Rafael J. Wysocki wrote: > > From: Rafael J. Wysocki > Subject: [PATCH] ACPI: OSL: Use rwlock instead of RCU for memory management > > The ACPI OS layer uses RCU to protect the list of ACPI memory > mappings from being walked while it is updated. Among other > situations, that list can be walked in non-NMI interrupt context, > so using a sleeping lock to protect it is not an option. > > However, performance issues related to the RCU usage in there > appear, as described by Dan Williams: > > "Recently a performance problem was reported for a process invoking > a non-trival ASL program. The method call in this case ends up > repetitively triggering a call path like: > > acpi_ex_store > acpi_ex_store_object_to_node > acpi_ex_write_data_to_field > acpi_ex_insert_into_field > acpi_ex_write_with_update_rule > acpi_ex_field_datum_io > acpi_ex_access_region > acpi_ev_address_space_dispatch > acpi_ex_system_memory_space_handler > acpi_os_map_cleanup.part.14 > _synchronize_rcu_expedited.constprop.89 > schedule > > The end result of frequent synchronize_rcu_expedited() invocation is > tiny sub-millisecond spurts of execution where the scheduler freely > migrates this apparently sleepy task. The overhead of frequent > scheduler invocation multiplies the execution time by a factor > of 2-3X." > > In order to avoid these issues, replace the RCU in the ACPI OS > layer by an rwlock. > > That rwlock should not be frequently contended, so the performance > impact of it is not expected to be significant. > > Reported-by: Dan Williams > Signed-off-by: Rafael J. Wysocki > --- > > Hi Dan, > > This is a possible fix for the ACPI OSL RCU-related performance issues, but > can you please arrange for the testing of it on the affected systems? Ugh, is it really this simple? I did not realize the read-side is NMI safe. I'll take a look.