From patchwork Mon Jun 20 00:42:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 12886921 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23241C43334 for ; Mon, 20 Jun 2022 00:43:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B07EC8D0002; Sun, 19 Jun 2022 20:43:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A91D38D0001; Sun, 19 Jun 2022 20:43:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 90A758D0002; Sun, 19 Jun 2022 20:43:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 780DF8D0001 for ; Sun, 19 Jun 2022 20:43:39 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 53FC480206 for ; Mon, 20 Jun 2022 00:43:39 +0000 (UTC) X-FDA: 79596766158.23.C7F5556 Received: from mail-qv1-f50.google.com (mail-qv1-f50.google.com [209.85.219.50]) by imf01.hostedemail.com (Postfix) with ESMTP id E6D5740010 for ; Mon, 20 Jun 2022 00:43:38 +0000 (UTC) Received: by mail-qv1-f50.google.com with SMTP id cs6so9536528qvb.6 for ; Sun, 19 Jun 2022 17:43:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+Vdy/3q0z+zupAiyg6Yh4GOKkpWfVuARDkMzaW4uflk=; b=lBJ/nMwGEn+uWKxFE6E0xhdfP4zJLmfjV2Nrc5Ovw3Fi6FKL38hoxWIThEo3s2IhA9 FJeOSspstzISx+42nRSaO8wVE9bJg4lXJNahcHxa2GW4NFD8Nprgv81TdWCyNqgydSSV w8KSIKhlYbrHt1XFl5TwkpjD3sUFMh2VRYTtXn/H8IpMePgGHHVxwT14A08+bS7szPKo ybAZX1rthru7tk0HirpC5pKjoJMH5L2UKtPDX0+Q8otXr+EHMp8mcm5nuss2+P2AEVjA tK34nsw1diiQ5kkI2D0CvD85QpKnLH3mqDx2x7Z6cL01Dsy3vnz5FBqybvFZ1+zAeGzk F6fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+Vdy/3q0z+zupAiyg6Yh4GOKkpWfVuARDkMzaW4uflk=; b=XbccZ4fw3yaIVwEBQmn9GSAuTYjnSlQmgic6kQxWZQ87H9X3AKSaY3HIhtrI9DJN1Y Q4O7BD+ovIKV4bcTaHghsJ8kqKmEuufrIp9jegXODKKxsv1HpoZ7KzpRzVX53oxc/scv E7eHdmEdkTQ3/sSl5IF7gnSuAuRRKUiUwOA81MstFx30xqsntdnexgKxl3UNtU7gJc59 2ji0PJASjrO3ySOV/Nzlm6wyflXMN2qHjzir/GjFJkYNQioIkL80Iefuwfp0WhDD7LD3 pK4Y9+cSTd6SXqyJeJKRPCzbY0W7EerxKRkTQiiU01X+r8rqUn+w04AXZLnDWF21EUdd 7xXw== X-Gm-Message-State: AJIora9EhlwAqd0kiM42T36IrhGO3wRoU8ZbNinLLJYCCIxsqmsyEIv6 v4viXPTVhiybLuVzxo+xbw== X-Google-Smtp-Source: AGRyM1tS4spvl8xZaQS5aL6s94wW+yGTeZDkgIKbZLzYbzrC5075+0KCox5+j5QeYPUegh322eL+9g== X-Received: by 2002:a05:6214:21e5:b0:46d:82b5:b1a2 with SMTP id p5-20020a05621421e500b0046d82b5b1a2mr17234499qvj.116.1655685818521; Sun, 19 Jun 2022 17:43:38 -0700 (PDT) Received: from localhost (c-73-219-103-14.hsd1.vt.comcast.net. [73.219.103.14]) by smtp.gmail.com with ESMTPSA id z9-20020ac84549000000b0030515374a6asm9759352qtn.51.2022.06.19.17.43.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jun 2022 17:43:37 -0700 (PDT) From: Kent Overstreet To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, pmladek@suse.com Cc: Kent Overstreet , rostedt@goodmis.org, enozhatsky@chromium.org, linux@rasmusvillemoes.dk, willy@infradead.org, x86@kernel.org Subject: [PATCH v4 28/34] x86/resctrl: Convert to printbuf Date: Sun, 19 Jun 2022 20:42:27 -0400 Message-Id: <20220620004233.3805-29-kent.overstreet@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620004233.3805-1-kent.overstreet@gmail.com> References: <20220620004233.3805-1-kent.overstreet@gmail.com> MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655685819; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=+Vdy/3q0z+zupAiyg6Yh4GOKkpWfVuARDkMzaW4uflk=; b=ozxxSd9zlJ+tF9B+lyaBzazWnihjWIfztWW6cRhE26Xj7wI3qWbAgkvLJNSuHjYfsHZqQu AQfNQiBKhgLtWnLDitVL69ZDgfNv1FgGdIJv3oHQu1VVeDSLT7b2w/B7paaPtVe81KDjN5 NdDYku/iO9HThCjC5skpziGm7pEJeyk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655685819; a=rsa-sha256; cv=none; b=h/Thdk8AlFuNn261Hv1BCPQXUCWVyQU7eiS5d/APqmeE5T4oWQcvJLTtM4X93tS7/oo5ea 4N4cgU7zFfdQWeviZjCEuaT6X+NYYLg2HQaBlm7yOqdC1Hf7MOTIgb6B6O0euqsOeQ0E6g SCo4ZqEf6YUCV4p5daRM7ASXN+89o0I= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="lBJ/nMwG"; spf=pass (imf01.hostedemail.com: domain of kent.overstreet@gmail.com designates 209.85.219.50 as permitted sender) smtp.mailfrom=kent.overstreet@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Stat-Signature: g576aq8obnyb5sw6adx7s5gbs11ukfs5 Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="lBJ/nMwG"; spf=pass (imf01.hostedemail.com: domain of kent.overstreet@gmail.com designates 209.85.219.50 as permitted sender) smtp.mailfrom=kent.overstreet@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Queue-Id: E6D5740010 X-Rspamd-Server: rspam02 X-Rspam-User: X-HE-Tag: 1655685818-245152 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This converts from seq_buf to printbuf. We're using printbuf in external buffer mode, so it's a direct conversion, aside from some trivial refactoring in cpu_show_meltdown() to make the code more consistent. Signed-off-by: Kent Overstreet Cc: x86@kernel.org --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 83f901e2c2..5b6720b6a4 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include #include @@ -51,7 +51,7 @@ static struct kernfs_node *kn_mongrp; /* Kernel fs node for "mon_data" directory under root */ static struct kernfs_node *kn_mondata; -static struct seq_buf last_cmd_status; +static struct printbuf last_cmd_status; static char last_cmd_status_buf[512]; struct dentry *debugfs_resctrl; @@ -59,13 +59,13 @@ struct dentry *debugfs_resctrl; void rdt_last_cmd_clear(void) { lockdep_assert_held(&rdtgroup_mutex); - seq_buf_clear(&last_cmd_status); + printbuf_reset(&last_cmd_status); } void rdt_last_cmd_puts(const char *s) { lockdep_assert_held(&rdtgroup_mutex); - seq_buf_puts(&last_cmd_status, s); + prt_str(&last_cmd_status, s); } void rdt_last_cmd_printf(const char *fmt, ...) @@ -74,7 +74,7 @@ void rdt_last_cmd_printf(const char *fmt, ...) va_start(ap, fmt); lockdep_assert_held(&rdtgroup_mutex); - seq_buf_vprintf(&last_cmd_status, fmt, ap); + prt_vprintf(&last_cmd_status, fmt, ap); va_end(ap); } @@ -833,7 +833,7 @@ static int rdt_last_cmd_status_show(struct kernfs_open_file *of, int len; mutex_lock(&rdtgroup_mutex); - len = seq_buf_used(&last_cmd_status); + len = printbuf_written(&last_cmd_status); if (len) seq_printf(seq, "%.*s", len, last_cmd_status_buf); else @@ -3248,8 +3248,8 @@ int __init rdtgroup_init(void) { int ret = 0; - seq_buf_init(&last_cmd_status, last_cmd_status_buf, - sizeof(last_cmd_status_buf)); + last_cmd_status = PRINTBUF_EXTERN(last_cmd_status_buf, + sizeof(last_cmd_status_buf)); ret = rdtgroup_setup_root(); if (ret)