Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp4272931rwb; Sun, 7 Aug 2022 20:01:52 -0700 (PDT) X-Google-Smtp-Source: AA6agR7xxwt/y0+XDnRgauboJW/ME/cRgVpWokiy28f5b6Khj5kJmuYhdw/YWcDwMJDtcC5fHEL+ X-Received: by 2002:a50:ec91:0:b0:440:9719:72ca with SMTP id e17-20020a50ec91000000b00440971972camr4137031edr.407.1659927712518; Sun, 07 Aug 2022 20:01:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659927712; cv=none; d=google.com; s=arc-20160816; b=LB246HuERPLnlcb74BgHQTtpw+GIfLBvTb9RIDOCdsOesndTIhHe74acuvBPlaLQgx 1NpGf+SHnYZPQ1xKNKE4JOCht+sXJ7yKrTk1WRHyp0YpU0nP66Qv0Vsxlt5Jj0BiEU4T +NnXsSJ3NMa3II7mNnW0OclhKBxQnzAedPEJebozbkOmtw00iCSx/O4rSYIGfD/2Y4Xl ZbDKUE0ij5L1n51dN9LMkdLnqHmmM/Rxpj9vCAAJxwEtnNAAYZpfhL7uUpgTXrzVrQjl LklNBjm8LGgWCBClLXmuC1EQqjoJ8RGa97WB+Pqfw4AtHvmfGqDtY+ySeaK1TDMiTpcI Rasg== 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=GVucidUOOwtQ2TJCPsgzEhLdwKKhX1FOI8GcU2GMl0g=; b=ziTwx7VSbzZYcLTX/CzRAWO2gyEOlc2zwnsyJwYxjkGPxle/bE1KmOs8NpcUMScKw3 e7ejyhmDoOX7gB5CnbJd03bFVRL0rjm+Nl84zgSRCBeGJTIVPf0H6LgIay3vBOU0eE74 lKNnYKEvJ3f8oAbOPEgea5DmxDM8/CqLBnm500DrVPIv56R5MCxwTxmsGACL0RFx4OHL KbO9cU4ufCUw23j1zaY7n+x1TOXwnCgearDZp4/fDRtQKZpVPrbEySBl+0/+4mtHZi5t GGGA4+PdbuvOjQDeRfUZRqobGquxFFrJKwzuP4GjB0zaMz8KR7/c4rLWznRe464q9WGe vDUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=ISaWvnuq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du5-20020a17090772c500b007309e3750acsi2106955ejc.652.2022.08.07.20.01.27; Sun, 07 Aug 2022 20:01:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=ISaWvnuq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242813AbiHHCmJ (ORCPT + 99 others); Sun, 7 Aug 2022 22:42:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241862AbiHHClj (ORCPT ); Sun, 7 Aug 2022 22:41:39 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACDCC25C7 for ; Sun, 7 Aug 2022 19:41:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=GVucidUOOwtQ2TJCPsgzEhLdwKKhX1FOI8GcU2GMl0g=; b=ISaWvnuqHzawQhPdc61l2Sxvkd WpOlQVvan5xH10oxr1v4QtaDOYTBgKIdnjePj3WSsmntzoVv1cZeDWgjqY9gf1YVBSR0GRg47zQ9C zNQOgZ3Pfx7iDHcwOroSP0crMagexUKgC5+fcakQ5ReQ98wNRNybzSv+B/Z8iZVI2y/ej2F0CHyod MalFPsk0dE2SI+lJDsOQx8Gta0gcdVWEd9luP4qK2SdlFQIrwn6JVx1Ar2x51Y+J5Rryb9k6iISEm YXr4cuPvSUtXF1nJVuZKJX9m081xfv6hWw/B+ty29iMyWhh7ex+QhBHUPjNS3BWkXQLwm6Ex8l4nz G/ykCLUg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1oKshy-00DVSf-OB; Mon, 08 Aug 2022 02:41:34 +0000 From: "Matthew Wilcox (Oracle)" To: linux-kernel@vger.kernel.org, pmladek@suse.com, Kent Overstreet Cc: x86@kernel.org Subject: [PATCH v5 26/32] x86/resctrl: Convert to printbuf Date: Mon, 8 Aug 2022 03:41:22 +0100 Message-Id: <20220808024128.3219082-27-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220808024128.3219082-1-willy@infradead.org> References: <20220808024128.3219082-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kent Overstreet 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 f276aff521e8..50c12711a249 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) -- 2.35.1