From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FF37C433E0 for ; Sun, 28 Jun 2020 17:23:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D7F01206C3 for ; Sun, 28 Jun 2020 17:23:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593364988; bh=SvTCp7lGAkbY1agYXc1vO5JUEFEVoz1JamVwaLi+tn8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=QBszUh1oF2aezCK5+lKPEd9+ueN5ZWLEIxvSG0GJFzBqzhZDqwHtBTMtT7zeXvDOz DpBD/qYq5oNchRiatYuz61PnAmfOnFSQtEsPNb5OOtpdtob6++SvFO9dvCZ7IrbDrX 2wvQWRj6288rntDqfhz2mMQtNEtBSwFMAE/5ypk8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726075AbgF1RXI (ORCPT ); Sun, 28 Jun 2020 13:23:08 -0400 Received: from mail-ot1-f67.google.com ([209.85.210.67]:39196 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726059AbgF1RXH (ORCPT ); Sun, 28 Jun 2020 13:23:07 -0400 Received: by mail-ot1-f67.google.com with SMTP id 18so13375160otv.6; Sun, 28 Jun 2020 10:23:07 -0700 (PDT) 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=lJ/7Mwdioa+LkvwxDevBww4xCE/dU3bIOQYsqm3j9ng=; b=oSb8imbUlUT+MSUkhtwZwBrywq5pbdxjqJca3s8ZJomg+i8TFWb81E6lmQWyvZxQl6 dXnsX/KtTBVgLlMmMH2+EAOirRL73tRm7PbdyrIiHHiVvg/Ku0LeTScNuQLz7Olu4gku qCaFu8DCIaw4akGTJs7L1Jz+ogw1Jj8/6Ct8fITjNsSkmysOcTxa8cYr2cH5rqewnlS5 f82q3XxaGsIGOcHQbjMiJ/1Ogl9LoJWt0OzYrb1RLzT0xHvnUOGUsz1MWRe4BwTggMyZ w6sSzZauke828mN9/U6gI+r1L3sg7lIvjeVJxebUavfDZR80x7DFZS09tvkAxU2MR/jE aAHw== X-Gm-Message-State: AOAM530GI+xI+JfioiQF0VJQXouRjgXGlibPKALH1lEKbkQgDfG7aFDT fkirhJ8JVhUBYAtGSqX1r2aVDOS+49PsVsaQD3c= X-Google-Smtp-Source: ABdhPJxWeIRMAX90bePkgZ2eZsip3wobT0DgKId2QVtHye5EgsJU87W+GWkfAZOi33Iq2RFvZeSEGzQe1N1PGQe9zfE= X-Received: by 2002:a05:6830:10ca:: with SMTP id z10mr10078158oto.167.1593364986761; Sun, 28 Jun 2020 10:23:06 -0700 (PDT) MIME-Version: 1.0 References: <159312902033.1850128.1712559453279208264.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: From: "Rafael J. Wysocki" Date: Sun, 28 Jun 2020 19:22:55 +0200 Message-ID: Subject: Re: [PATCH 00/12] ACPI/NVDIMM: Runtime Firmware Activation To: Dan Williams Cc: "Rafael J. Wysocki" , "linux-nvdimm@lists.01.org" , Ira Weiny , Dave Jiang , "Rafael J. Wysocki" , Vishal Verma , Andy Shevchenko , Jonathan Corbet , Greg Kroah-Hartman , Len Brown , Len Brown , "Rafael J. Wysocki" , Pavel Machek , Stable , ACPI Devel Maling List , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On Fri, Jun 26, 2020 at 8:43 PM Dan Williams wrote: > > On Fri, Jun 26, 2020 at 7:22 AM Rafael J. Wysocki wrote: > > > > On Fri, Jun 26, 2020 at 2:06 AM Dan Williams wrote: > > > > > > Quoting the documentation: > > > > > > Some persistent memory devices run a firmware locally on the device / > > > "DIMM" to perform tasks like media management, capacity provisioning, > > > and health monitoring. The process of updating that firmware typically > > > involves a reboot because it has implications for in-flight memory > > > transactions. However, reboots are disruptive and at least the Intel > > > persistent memory platform implementation, described by the Intel ACPI > > > DSM specification [1], has added support for activating firmware at > > > runtime. > > > > > > [1]: https://docs.pmem.io/persistent-memory/ > > > > > > The approach taken is to abstract the Intel platform specific mechanism > > > behind a libnvdimm-generic sysfs interface. The interface could support > > > runtime-firmware-activation on another architecture without need to > > > change userspace tooling. > > > > > > The ACPI NFIT implementation involves a set of device-specific-methods > > > (DSMs) to 'arm' individual devices for activation and bus-level > > > 'trigger' method to execute the activation. Informational / enumeration > > > methods are also provided at the bus and device level. > > > > > > One complicating aspect of the memory device firmware activation is that > > > the memory controller may need to be quiesced, no memory cycles, during > > > the activation. While the platform has mechanisms to support holding off > > > in-flight DMA during the activation, the device response to that delay > > > is potentially undefined. The platform may reject a runtime firmware > > > update if, for example a PCI-E device does not support its completion > > > timeout value being increased to meet the activation time. Outside of > > > device timeouts the quiesce period may also violate application > > > timeouts. > > > > > > Given the above device and application timeout considerations the > > > implementation defaults to hooking into the suspend path to trigger the > > > activation, i.e. that a suspend-resume cycle (at least up to the syscore > > > suspend point) is required. > > > > Well, that doesn't work if the suspend method for the system is set to > > suspend-to-idle (for example, via /sys/power/mem_sleep), because the > > syscore callbacks are not invoked in that case. > > > > Also you probably don't need the device power state toggling that > > happens during regular suspend/resume (you may not want it even for > > some devices). > > > > The hibernation freeze/thaw may be a better match and there is some > > test support in there already that may be kind of co-opted for your > > use case. > > Hmm, yes I guess freeze should be sufficient to quiesce most > device-DMA in the general case as applications will stop sending > requests. It is expected to be sufficient to quiesce all of them. If that is not the case, the integrity of the hibernation image cannot be guaranteed on the system in question. > I do expect some RDMA devices will happily keep on > transmitting, but that likely will need explicit mitigation. It also > appears the suspend callback for at least one RDMA device > mlx5_suspend() is rather violent as it appears to fully teardown the > device context, not just suspend operations. > > To be clear, what debug interface were you thinking I could glom onto > to just trigger firmware-activate at the end of the freeze phase? Functionally, the same as for suspend, but using the hibernation interface, so "echo platform > /sys/power/pm_test" followed by "echo disk > /sys/power/state". But it might be cleaner to introduce a special "hibernation mode", ie. is one more item in /sys/power/disk, that will trigger what you need (in analogy with "test_resume").