From patchwork Sat Mar 23 04:20:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dexuan Cui X-Patchwork-Id: 10866759 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 86C0B139A for ; Sat, 23 Mar 2019 04:20:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 622C62A94F for ; Sat, 23 Mar 2019 04:20:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 55C3E2A95D; Sat, 23 Mar 2019 04:20:41 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0EF6F2A94F for ; Sat, 23 Mar 2019 04:20:41 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 8FCDD211E9FB0; Fri, 22 Mar 2019 21:20:40 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4864:20::744; helo=mail-qk1-x744.google.com; envelope-from=dexuan.cui@gmail.com; receiver=linux-nvdimm@lists.01.org Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 66513211E95B2 for ; Fri, 22 Mar 2019 21:20:39 -0700 (PDT) Received: by mail-qk1-x744.google.com with SMTP id b74so2452349qkg.9 for ; Fri, 22 Mar 2019 21:20:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cEfoMWMXtV4me6P5oRx2UkgAu2VOmPX/Bt3nkztq25o=; b=SoN0EsktNb2vKowgn3C8JaMKJb0a8GMOtqrFvdrpW9jIpW11VcgK8qp3045Y56wVa/ uyRXQO0QflEpAZagMjiReMqcMJKk3oPHba+H0knP3lP2DLb9dWFAVDGmUw36OS1AJtB7 Gqud3hrUYBgpuze73CUDs+byYP7wQWn/9p5uQlgoj11rT3lnEA9Sw8fmdtXYWdAV4Ln4 OQaYZDSRNvHzHGKiYFfFjPJHwKpP9aG1nVAaAE6IdI19X5o4u7TvPOfaoMGUoZKhMGUz /HroOUTaD6WoCcv8kW/0F0ipJOwYl+EEy+G/1rvE6IroeAD1hU0KLg5o5IxQ31kOeVTb dSRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cEfoMWMXtV4me6P5oRx2UkgAu2VOmPX/Bt3nkztq25o=; b=AOCxD5jPxWYhCgEFMehClbt+ws+lBkXV5zaVs3kVMSwYOL2wuQw3Ek47yMvV9M2bc4 AzfnBihrgMJmqsv16YFDNmdpMkIRf7O/zkriX5rsFpoIpJ7e94uEhnXuRN3J4bpE4gOm y/D7TZsy5Xq50jFGZOeaJc19E7PyWI0JPZpoFEfg+O/mxJllFJNhOXtf4kvLzaW4muEc FQyUhhygMNtgMlKTd9dGZXiG3dtmNk3VgdJxHY53F836F0C3B2twHqN3CJUhC3ZIdlEq ZHCIc7NYih47GSb3GxidbhrLeZsEYEnJOMs6XY0cWau9c5cqAv5kPLqPick093/+i7gu zghw== X-Gm-Message-State: APjAAAWKowwVNK1Tv6XOs5MACg7xfrUrGUZv01r61+DnIpYdriE8TjIX r3RxqZK31aB1tQ8/TeAWWnI= X-Google-Smtp-Source: APXvYqxlHC6VcdQ9vpsaK+l+1HPcX4irKpnZxny52vdN+Z5edAXHdoG1aBxs9akgrZw2zbeKBBKw/g== X-Received: by 2002:ae9:e21a:: with SMTP id c26mr10920342qkc.293.1553314838643; Fri, 22 Mar 2019 21:20:38 -0700 (PDT) Received: from linuxonhyperv2.linuxonhyperv.com (ip-107-180-71-197.ip.secureserver.net. [107.180.71.197]) by smtp.gmail.com with ESMTPSA id k12sm6919699qti.38.2019.03.22.21.20.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Mar 2019 21:20:38 -0700 (PDT) From: Dexuan Cui X-Google-Original-From: Dexuan Cui To: vishal.l.verma@intel.com, dan.j.williams@intel.com, dave.jiang@intel.com, linux-nvdimm@lists.01.org, mikelley@microsoft.com Subject: [ndctl PATCH v3 3/5] ndctl, monitor: Don't require the support of ND_CMD_SMART_THRESHOLD Date: Sat, 23 Mar 2019 04:20:27 +0000 Message-Id: <20190323042028.4310-4-decui@microsoft.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190323042028.4310-1-decui@microsoft.com> References: <20190323042028.4310-1-decui@microsoft.com> MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qi.fuli@fujitsu.com Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP When a NVDIMM doesn't support ND_CMD_SMART_THRESHOLD, it may support ND_CMD_SMART or a variant of ND_CMD_SMART. Allow such a NVDIMM to work with "ndctl monitor". Signed-off-by: Dexuan Cui --- ndctl/monitor.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/ndctl/monitor.c b/ndctl/monitor.c index 43b2abe..346a6df 100644 --- a/ndctl/monitor.c +++ b/ndctl/monitor.c @@ -275,17 +275,13 @@ static void filter_dimm(struct ndctl_dimm *dimm, struct util_filter_ctx *fctx) err(&monitor, "%s: no smart support\n", name); return; } - if (!ndctl_dimm_is_cmd_supported(dimm, ND_CMD_SMART_THRESHOLD)) { - err(&monitor, "%s: no smart threshold support\n", name); - return; - } - if (!ndctl_dimm_is_flag_supported(dimm, ND_SMART_ALARM_VALID)) { + if (!ndctl_dimm_is_cmd_supported(dimm, ND_CMD_SMART_THRESHOLD)) { + dbg(&monitor, "%s: no smart threshold support\n", name); + } else if (!ndctl_dimm_is_flag_supported(dimm, ND_SMART_ALARM_VALID)) { err(&monitor, "%s: smart alarm invalid\n", name); return; - } - - if (enable_dimm_supported_threshold_alarms(dimm)) { + } else if (enable_dimm_supported_threshold_alarms(dimm)) { err(&monitor, "%s: enable supported threshold alarms failed\n", name); return; }