From patchwork Wed Jul 27 15:08:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 9249981 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 92C9E60757 for ; Wed, 27 Jul 2016 15:11:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84DD3269B2 for ; Wed, 27 Jul 2016 15:11:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7895326D06; Wed, 27 Jul 2016 15:11:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D91B6269B2 for ; Wed, 27 Jul 2016 15:11:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932108AbcG0PJq (ORCPT ); Wed, 27 Jul 2016 11:09:46 -0400 Received: from mail-pa0-f65.google.com ([209.85.220.65]:36181 "EHLO mail-pa0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932100AbcG0PJn (ORCPT ); Wed, 27 Jul 2016 11:09:43 -0400 Received: by mail-pa0-f65.google.com with SMTP id ez1so1903395pab.3; Wed, 27 Jul 2016 08:09:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=41BnkffMvVl1ZFhfXpu7V8Igw0nH7KcSdcdAMkWhIV4=; b=BZIOmmJ0pO6K4rG4s6miDSaf3DY+8Ws5aR8gjOvPik/yiAFdqI5Z/ubXcARey2zmli ePDE28eHZ7tPR5YZDOVvXk3wenwheH1Wat3+ndjdo6B3hJEGZrUQNyDscRPnh9LZwrZv auRfVJbyYaN1Wi+pxFKXL2eIFJv2nSgqwwSb7NjbGc9nwS+3z9NqfexwCiVdNwzBjOCN PYCyUSN4FI9r+67QydW5bb3tqw8hESvLts31KlmXHfbpwf8LvDowwu6cqJZ9RbTzCMGx /9zwTk5TrEPNtnWL4lAXAhgn6VRXT2kDKvc82UmfVH8VpNhnMZCCRnGuep8eclQvoypv Hrkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=41BnkffMvVl1ZFhfXpu7V8Igw0nH7KcSdcdAMkWhIV4=; b=b43Jnczqxm6cj45p/t5eShsdWyUKDznFc+g0pWqdJM+SefzhUp3lzYXMUvZgQ3c6r7 4Ola08iwxQpK7KvPLIRbOUJK64YA+xSGM2ErIcxflRsLAP+o4ScsrgBF8ZCFnS4dod1n wm/McwAm4SJ17n8rFMHvnd7sToJvgKmbe3SgiGar7TVQrb0rMpj9GWgTSwEMtUKp/eg/ xRvhMIzxysF12RDBUgPrs/saLVxnImrn3j2+rJu3vnDDQPiEz2cNPbN7fGUAmZvn7+9i WmOTVCf7Ff9v7Z+V20yvwgas4szaSNQ5dmmzXecKGEzQebBE1+dP5iV8g4+Y2odoaGt4 Rs3w== X-Gm-Message-State: AEkoousiVXu1NGogiJ4yGEJU7ao1nrWW+imgQCpkGL1EEggNdip4qeg7LYd2rFVJsIYjDA== X-Received: by 10.66.7.199 with SMTP id l7mr50103034paa.136.1469632182728; Wed, 27 Jul 2016 08:09:42 -0700 (PDT) Received: from danjae.aot.lge.com ([210.100.147.61]) by smtp.gmail.com with ESMTPSA id 15sm10058488pfz.36.2016.07.27.08.09.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 27 Jul 2016 08:09:42 -0700 (PDT) From: Namhyung Kim To: kvm@vger.kernel.org, qemu-devel@nongnu.org, virtualization@lists.linux-foundation.org Cc: LKML , Anton Vorontsov , Colin Cross , Kees Cook , Tony Luck , "Rafael J. Wysocki" , Len Brown , Matt Fleming , linux-acpi@vger.kernel.org, linux-efi@vger.kernel.org Subject: [PATCH 1/7] pstore: Split pstore fragile flags Date: Thu, 28 Jul 2016 00:08:25 +0900 Message-Id: <1469632111-23260-2-git-send-email-namhyung@kernel.org> X-Mailer: git-send-email 2.8.0 In-Reply-To: <1469632111-23260-1-git-send-email-namhyung@kernel.org> References: <1469632111-23260-1-git-send-email-namhyung@kernel.org> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds new PSTORE_FLAGS for each pstore type so that they can be enabled separately. This is a preparation for ongoing virtio-pstore work to support those types flexibly. The PSTORE_FLAGS_FRAGILE is changed to PSTORE_FLAGS_DMESG to preserve the original behavior. Cc: Anton Vorontsov Cc: Colin Cross Cc: Kees Cook Cc: Tony Luck Cc: "Rafael J. Wysocki" Cc: Len Brown Cc: Matt Fleming Cc: linux-acpi@vger.kernel.org Cc: linux-efi@vger.kernel.org Signed-off-by: Namhyung Kim --- drivers/acpi/apei/erst.c | 2 +- drivers/firmware/efi/efi-pstore.c | 2 +- fs/pstore/platform.c | 17 ++++++++++------- fs/pstore/ram.c | 2 ++ include/linux/pstore.h | 7 ++++++- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c index f096ab3cb54d..ec4f507b524f 100644 --- a/drivers/acpi/apei/erst.c +++ b/drivers/acpi/apei/erst.c @@ -938,7 +938,7 @@ static int erst_clearer(enum pstore_type_id type, u64 id, int count, static struct pstore_info erst_info = { .owner = THIS_MODULE, .name = "erst", - .flags = PSTORE_FLAGS_FRAGILE, + .flags = PSTORE_FLAGS_DMESG, .open = erst_open_pstore, .close = erst_close_pstore, .read = erst_reader, diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c index 30a24d09ea6c..4daa5acd9117 100644 --- a/drivers/firmware/efi/efi-pstore.c +++ b/drivers/firmware/efi/efi-pstore.c @@ -362,7 +362,7 @@ static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count, static struct pstore_info efi_pstore_info = { .owner = THIS_MODULE, .name = "efi", - .flags = PSTORE_FLAGS_FRAGILE, + .flags = PSTORE_FLAGS_DMESG, .open = efi_pstore_open, .close = efi_pstore_close, .read = efi_pstore_read, diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index 16ecca5b72d8..76dd604a0f2c 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -659,13 +659,14 @@ int pstore_register(struct pstore_info *psi) if (pstore_is_mounted()) pstore_get_records(0); - pstore_register_kmsg(); - - if ((psi->flags & PSTORE_FLAGS_FRAGILE) == 0) { + if (psi->flags & PSTORE_FLAGS_DMESG) + pstore_register_kmsg(); + if (psi->flags & PSTORE_FLAGS_CONSOLE) pstore_register_console(); + if (psi->flags & PSTORE_FLAGS_FTRACE) pstore_register_ftrace(); + if (psi->flags & PSTORE_FLAGS_PMSG) pstore_register_pmsg(); - } if (pstore_update_ms >= 0) { pstore_timer.expires = jiffies + @@ -689,12 +690,14 @@ EXPORT_SYMBOL_GPL(pstore_register); void pstore_unregister(struct pstore_info *psi) { - if ((psi->flags & PSTORE_FLAGS_FRAGILE) == 0) { + if (psi->flags & PSTORE_FLAGS_PMSG) pstore_unregister_pmsg(); + if (psi->flags & PSTORE_FLAGS_FTRACE) pstore_unregister_ftrace(); + if (psi->flags & PSTORE_FLAGS_CONSOLE) pstore_unregister_console(); - } - pstore_unregister_kmsg(); + if (psi->flags & PSTORE_FLAGS_DMESG) + pstore_unregister_kmsg(); free_buf_for_compression(); diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index 47516a794011..ba19a74e95bc 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -624,6 +624,8 @@ static int ramoops_probe(struct platform_device *pdev) goto fail_clear; } + cxt->pstore.flags = PSTORE_FLAGS_ALL; + err = pstore_register(&cxt->pstore); if (err) { pr_err("registering with pstore failed\n"); diff --git a/include/linux/pstore.h b/include/linux/pstore.h index 899e95e84400..069b96faf478 100644 --- a/include/linux/pstore.h +++ b/include/linux/pstore.h @@ -74,7 +74,12 @@ struct pstore_info { void *data; }; -#define PSTORE_FLAGS_FRAGILE 1 +#define PSTORE_FLAGS_DMESG (1 << 0) +#define PSTORE_FLAGS_CONSOLE (1 << 1) +#define PSTORE_FLAGS_FTRACE (1 << 2) +#define PSTORE_FLAGS_PMSG (1 << 3) + +#define PSTORE_FLAGS_ALL ((1 << 4) - 1) extern int pstore_register(struct pstore_info *); extern void pstore_unregister(struct pstore_info *);