Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1488543pxk; Fri, 25 Sep 2020 16:50:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvVbfNskmJEQgHcSWoqJAehKJAw0KDGH88CmWi2c0PNHhWq2yYX9KZyJpY4CMJiXx2G8Pz X-Received: by 2002:a50:ed94:: with SMTP id h20mr4096406edr.184.1601077854851; Fri, 25 Sep 2020 16:50:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601077854; cv=none; d=google.com; s=arc-20160816; b=lumlBZwIc7C2ynrXHFpSxsLmPqqKJMfGwmIWCGWKs5dV1Uvqy9k31YViB0dKTHpOfD cVixjjADoYXlH4mSmsclED+vvPYrmE/5F7va64XQVUQrhVbgh9B1ufOE3vyp9lUY0w5v Us0/5dHCMIFb02NIoLnPai1AU0HsDfyE3aoEzTt3N2EM03fp2MKRyKqv1j3RL65JqjHQ p3vrreBDHPUkWSgX7p7paetKLs6wBnM2vSANGBfvn0DrtQZ4XDpUhuhTzPP4m5KkOCi3 vuSvkRs48Gxuc0VItVLepUkffbk2ZW4MxRtbah0W128IzvYtEPVMVR9Fa9gr5DgbMcaZ esSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gfv5DwnuqxUK2/JI31FCljoAr6aY+o7ASwHVzd1SBv8=; b=xI7AiPOI3HTaahZPAppI67Aw++6uBhZR7VLN4F1kEWO2zzaswy/Y4AWd34POmNrNmn 040HfCNKzEFF+s7q0+7ucIrCucsoHFk4QyXvOX22ZSBMprog4sSwkrUP8fGGS5LWZ935 JucLnZFnU/DfBP4qLqFqxpNi6qYnsj+jnp3i8XiOGyhZE46e2rXHupujtFOCSfb7Lgau qKiUq2nO0Pb5qHixeWux2tpnb/O7UCMi0Dlt2YnJprUO19rG2n/gKbBVOpFf/x8R+o2M 5nlsn04NXKjhMbXbX490rpqJ2p0lKMx6+hwXdPj9esVAB8HrQBDnI60hs/ck7MTR6Ed5 D+aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=PJwBEwXo; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u20si2861705ejt.14.2020.09.25.16.50.32; Fri, 25 Sep 2020 16:50:54 -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=@linuxfoundation.org header.s=google header.b=PJwBEwXo; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729620AbgIYXrq (ORCPT + 99 others); Fri, 25 Sep 2020 19:47:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729186AbgIYXrj (ORCPT ); Fri, 25 Sep 2020 19:47:39 -0400 Received: from mail-ot1-x344.google.com (mail-ot1-x344.google.com [IPv6:2607:f8b0:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 140F5C0613D3 for ; Fri, 25 Sep 2020 16:47:39 -0700 (PDT) Received: by mail-ot1-x344.google.com with SMTP id c2so3918695otp.7 for ; Fri, 25 Sep 2020 16:47:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gfv5DwnuqxUK2/JI31FCljoAr6aY+o7ASwHVzd1SBv8=; b=PJwBEwXoDlmaOihq4USR91LUuIlycye+cnBxlxnV1BLnSK3jVHTq1ObnjeK00HjbYj fmQ2zYF0nxqhpSD4c7K2zriVY2/thFbvtpJATf9R80neccigNL8uIfa2XWuqWN102MO/ K9jTVJ9Hnm5kfYfWddAdxkp5M+bwFLUTSt/a4= 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=gfv5DwnuqxUK2/JI31FCljoAr6aY+o7ASwHVzd1SBv8=; b=F5e2z/L93uiuCspOI1Kh0hqaWbTPPWotUJgVA2sL63WXjtGDawu6/DzMdbNcoDWk8q Qw1wEis0aBn8wF/inUDMqudioIVz8QLNgmgrqcnvJugtIV3yHehw+k0gX77dA5PinR5y OLI05e77EzjDZTy2tW1OG0FkRrrXGqZFb1FMY+JOfceRbLONMQipCQf5TxAD+7jpwduo 4/00YUuS0MC68WFX9Mz8g1c+U+BwMp7L/mqaSbK9Ye8DrcktmwjJy9ZXs/MvwtsSJj/H qZbg7C5NeQcFJMcRDwnv6+bqweZelZ6B2VbeCBAJv+wJeAQKPcTNsfatjs1zM14Iel37 waYQ== X-Gm-Message-State: AOAM532iv2ynK6wCk+kuTtrzcHunuxjP0wllGTiYhyqOjQvqFxAzM1xd YrX+AoLtkBlEiRS+ifrJT4krgA== X-Received: by 2002:a9d:6b0d:: with SMTP id g13mr1975643otp.129.1601077658485; Fri, 25 Sep 2020 16:47:38 -0700 (PDT) Received: from shuah-t480s.internal (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id k3sm196219oof.6.2020.09.25.16.47.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Sep 2020 16:47:37 -0700 (PDT) From: Shuah Khan To: rafael@kernel.org, lenb@kernel.org, gregkh@linuxfoundation.org, keescook@chromium.org Cc: Shuah Khan , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 05/11] drivers/acpi: convert seqno counter_atomic32 Date: Fri, 25 Sep 2020 17:47:19 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org counter_atomic* is introduced to be used when a variable is used as a simple counter and doesn't guard object lifetimes. This clearly differentiates atomic_t usages that guard object lifetimes. counter_atomic* variables will wrap around to 0 when it overflows and should not be used to guard resource lifetimes, device usage and open counts that control state changes, and pm states. seqno is a sequence number counter for logging. This counter gets incremented. Unsure if there is a chance of this overflowing. It doesn't look like overflowing causes any problems since it is used to tag the log messages and nothing more. Convert it to use counter_atomic32. This conversion doesn't change the overflow wrap around behavior. Acked-by: Rafael J. Wysocki Signed-off-by: Shuah Khan --- drivers/acpi/acpi_extlog.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/acpi_extlog.c b/drivers/acpi/acpi_extlog.c index f138e12b7b82..d1e733f15cf5 100644 --- a/drivers/acpi/acpi_extlog.c +++ b/drivers/acpi/acpi_extlog.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -93,7 +94,7 @@ static struct acpi_hest_generic_status *extlog_elog_entry_check(int cpu, int ban static void __print_extlog_rcd(const char *pfx, struct acpi_hest_generic_status *estatus, int cpu) { - static atomic_t seqno; + static struct counter_atomic32 seqno; unsigned int curr_seqno; char pfx_seq[64]; @@ -103,7 +104,7 @@ static void __print_extlog_rcd(const char *pfx, else pfx = KERN_ERR; } - curr_seqno = atomic_inc_return(&seqno); + curr_seqno = counter_atomic32_inc_return(&seqno); snprintf(pfx_seq, sizeof(pfx_seq), "%s{%u}", pfx, curr_seqno); printk("%s""Hardware error detected on CPU%d\n", pfx_seq, cpu); cper_estatus_print(pfx_seq, estatus); -- 2.25.1