From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C4DD6C27C75 for ; Wed, 12 Jun 2024 20:05:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:References:Cc:To:From:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=/QPeIjovkvV/E5oIolQo/mIlJ+pmqKXHutHu0+C0FVs=; b=nl3HnCYODobRoUAUAjW+t9nx/X SB2elaLWfdcX48hTnYj13zsfhEJWbWhGBYMdAHb7JLb8JOITbA52s5o56vverUHWfvri3SJ5awvdF /kI2G0yl4pmwqGGHH9ILlWEbTJr0uJDsa/W5ZOEWhaYyAHAtd0EysJgh8ba4Q+qFU3BOh2d0kjvBe wCfeNVgTeKp+fanFt/r80zH5E5he0MhwxI9okd69N8dliFwiNnToV9kUE/x76ssVdYzj1iL+wYELb JVC3ba8z/KtueQKtMPHloFRPaAc1fBkjZnksO4rGuflGK25l0A2EN+AgtYGFDnMOrFCXSERuxIb5l r82yfeeA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHUDG-0000000DyJI-0gZG; Wed, 12 Jun 2024 20:04:54 +0000 Received: from omta034.useast.a.cloudfilter.net ([44.202.169.33]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHUDB-0000000DyHa-0Ih1 for linux-arm-kernel@lists.infradead.org; Wed, 12 Jun 2024 20:04:50 +0000 Received: from eig-obgw-6004a.ext.cloudfilter.net ([10.0.30.197]) by cmsmtp with ESMTPS id HP90sudAfxs4FHUCxsOmOc; Wed, 12 Jun 2024 20:04:35 +0000 Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with ESMTPS id HUCws1u7kuv6XHUCws1tl5; Wed, 12 Jun 2024 20:04:34 +0000 X-Authority-Analysis: v=2.4 cv=YbZ25BRf c=1 sm=1 tr=0 ts=6669ff52 a=1YbLdUo/zbTtOZ3uB5T3HA==:117 a=frY+GlAHrI6frpeK1MvySw==:17 a=IkcTkHD0fZMA:10 a=T1WGqf2p2xoA:10 a=wYkD_t78qR0A:10 a=xGRsDScCAAAA:8 a=pKTFDrzG_x3V9sfl7PQA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=zEVfNvAIcUWeczMkmY0T:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=embeddedor.com; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:References:Cc:To:From:Subject:MIME-Version:Date:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=/QPeIjovkvV/E5oIolQo/mIlJ+pmqKXHutHu0+C0FVs=; b=IaMH4JcelzjtzZ8l052lUZoo73 sI8xPNQtYOTq4SBbq7wbYV19M4bbN7/tIy0GGJ0daZKbJwwMBPgru1JOSJbZkKTTDHj0JkGj6CfDt hvpFYVQwNVSs+gUb3q2uK4cvQYtAxfknNNRP9/IGljJQJwQvF18bbmwdWdjPF3qHJVBySzDRqbMmP R/PTadZMsEQNP/1lFtMBtB/gWcW0n3l7fL+kWu3KgjClJyS963c82KeIRgpmL91Iheiihvd02mP7k A+x5MhXqNQVGRaXeDMCx8FkrVQayyvm0QZwzu0xmSKR1RFVQEvDn4K4AjQMI/Pc+P6Ek/OvMUyUID m04LJ4DQ==; Received: from [201.172.173.139] (port=40652 helo=[192.168.15.10]) by gator4166.hostgator.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96.2) (envelope-from ) id 1sHUCv-004Bhn-0e; Wed, 12 Jun 2024 15:04:33 -0500 Message-ID: Date: Wed, 12 Jun 2024 14:04:31 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] tty: mxser: Remove __counted_by from mxser_board.ports[] From: "Gustavo A. R. Silva" To: Jiri Slaby , Bill Wendling Cc: Greg Kroah-Hartman , Nathan Chancellor , Kees Cook , "Gustavo A. R. Silva" , Justin Stitt , linux-serial@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-hardening@vger.kernel.org, llvm@lists.linux.dev, patches@lists.linux.dev, stable@vger.kernel.org References: <20240529-drop-counted-by-ports-mxser-board-v1-1-0ab217f4da6d@kernel.org> <2024053008-sadly-skydiver-92be@gregkh> <09445a96-4f86-4d34-9984-4769bd6f4bc1@embeddedor.com> <68293959-9141-4184-a436-ea67efa9aa7c@kernel.org> <6170ad64-ee1c-4049-97d3-33ce26b4b715@kernel.org> <1313c7a5-d074-4a8f-9ab9-07e4a7716fb9@kernel.org> <4da5ba72-6dff-46f1-b596-158c62b34f18@embeddedor.com> Content-Language: en-US In-Reply-To: <4da5ba72-6dff-46f1-b596-158c62b34f18@embeddedor.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - lists.infradead.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 201.172.173.139 X-Source-L: No X-Exim-ID: 1sHUCv-004Bhn-0e X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([192.168.15.10]) [201.172.173.139]:40652 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 5 X-Org: HG=hgshared;ORG=hostgator; X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfAcdVrXOwGc+Wt0TyyB/Tso+1y6o75LUnCmZmKOmAMzMN1WeZBcMHLEUDrEnwpJ653Zrbar9Zl5zs15Feh4jfx5ll8DpTY4F6hJivfJxSqwrUxdeZLfx crJu7oM/f9MXdEF4JMG2vD2EQJl+VlWEssIMF2FlksPPcfxFkQdi17P4TUIE4WEj8MQUNkJTQnILPEeMyF5mfRCbfnbDnLTcBAgVZ7QlaIHjDVMyuH79bnEG X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240612_130449_256143_1EAD97A4 X-CRM114-Status: UNSURE ( 7.32 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 6/3/24 02:26, Gustavo A. R. Silva wrote: > >> FWIW undoing: >> commit 7391ee16950e772076d321792d9fbf030f921345 >> Author: Peter Hurley >> Date:   Sat Jun 15 09:36:07 2013 -0400 >> >>      tty: Simplify flip buffer list with 0-sized sentinel >> >> >> would do the job, IMO. > > So, not even _sentinel_ is actually needed? Awesome! > It seems that a clean revert is not possible at this point, as the original patch is more than a decade old. If _sentinel_ is not needed, and based on the original patch, would the following suffice? diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index 79f0ff94ce00..1b77019cc510 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c @@ -135,10 +135,7 @@ void tty_buffer_free_all(struct tty_port *port) llist_for_each_entry_safe(p, next, llist, free) kfree(p); - tty_buffer_reset(&buf->sentinel, 0); - buf->head = &buf->sentinel; - buf->tail = &buf->sentinel; - + buf->tail = NULL; still_used = atomic_xchg(&buf->mem_used, 0); WARN(still_used != freed, "we still have not freed %d bytes!", still_used - freed); @@ -578,9 +575,8 @@ void tty_buffer_init(struct tty_port *port) struct tty_bufhead *buf = &port->buf; mutex_init(&buf->lock); - tty_buffer_reset(&buf->sentinel, 0); - buf->head = &buf->sentinel; - buf->tail = &buf->sentinel; + buf->head = NULL; + buf->tail = NULL; init_llist_head(&buf->free); atomic_set(&buf->mem_used, 0); atomic_set(&buf->priority, 0); diff --git a/include/linux/tty_buffer.h b/include/linux/tty_buffer.h index 31125e3be3c5..75fb041e43fe 100644 --- a/include/linux/tty_buffer.h +++ b/include/linux/tty_buffer.h @@ -37,7 +37,6 @@ struct tty_bufhead { struct work_struct work; struct mutex lock; atomic_t priority; - struct tty_buffer sentinel; struct llist_head free; /* Free queue head */ atomic_t mem_used; /* In-use buffers excluding free list */ int mem_limit; Thanks -- Gustavo