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 X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E892C433E0 for ; Thu, 7 Jan 2021 15:20:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 57B94233FD for ; Thu, 7 Jan 2021 15:20:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728107AbhAGPUU (ORCPT ); Thu, 7 Jan 2021 10:20:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:58916 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727292AbhAGPUQ (ORCPT ); Thu, 7 Jan 2021 10:20:16 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 959E6233FD; Thu, 7 Jan 2021 15:19:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610032776; bh=UB24bBL+xWXpFOs5afALQp6ryz62GM0B/ZX2FZZqhdY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DTZj75l7ly3oQmGCJ3VXkkiOn5CsPYPAleXdzsxBwkcQYg8zmzLzA4nN6KIOa/F5Y pALoC2R2Ms/63cLkG+OxX2TztMAFWAy82/s6kMcXEeR2PaprBOkY1DootAhnz5Dw+l NpQjkrqoR8E64HuHAnGfY8p4JKOoRv9MlWDkSQhI= Date: Thu, 7 Jan 2021 16:20:55 +0100 From: Greg Kroah-Hartman To: Cristian Ciocaltea Cc: Jiri Slaby , Andreas =?iso-8859-1?Q?F=E4rber?= , Manivannan Sadhasivam , linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-actions@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/1] tty: serial: owl: Add support for kernel debugger Message-ID: References: <036c09732183a30eaab230884114f65ca42ca3b9.1609865007.git.cristian.ciocaltea@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <036c09732183a30eaab230884114f65ca42ca3b9.1609865007.git.cristian.ciocaltea@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 05, 2021 at 07:02:02PM +0200, Cristian Ciocaltea wrote: > Implement 'poll_put_char' and 'poll_get_char' callbacks in struct > 'owl_uart_ops' that enables OWL UART to be used for kernel debugging > over serial line. > > Signed-off-by: Cristian Ciocaltea > --- > Changes in v2: > - Reverted unnecessary changes per Andreas feedback > - Optimized implementation for 'owl_uart_poll_get_char()' > and 'owl_uart_poll_put_char()' callbacks > > drivers/tty/serial/owl-uart.c | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) > > diff --git a/drivers/tty/serial/owl-uart.c b/drivers/tty/serial/owl-uart.c > index c149f8c30007..54b24669ebc5 100644 > --- a/drivers/tty/serial/owl-uart.c > +++ b/drivers/tty/serial/owl-uart.c > @@ -12,6 +12,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -461,6 +462,26 @@ static void owl_uart_config_port(struct uart_port *port, int flags) > } > } > > +#ifdef CONFIG_CONSOLE_POLL > + > +static int owl_uart_poll_get_char(struct uart_port *port) > +{ > + if (owl_uart_read(port, OWL_UART_STAT) & OWL_UART_STAT_RFEM) > + return NO_POLL_CHAR; > + > + return owl_uart_read(port, OWL_UART_RXDAT); > +} > + > +static void owl_uart_poll_put_char(struct uart_port *port, unsigned char ch) > +{ > + while (owl_uart_read(port, OWL_UART_STAT) & OWL_UART_STAT_TFFU) > + cpu_relax(); Unbounded loops? What could possibly go wrong? :( Please don't do that in the kernel, put a max bound on this. And are you _SURE_ that cpu_relax() is what you want to call here? thanks, greg k-h 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 X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AAECDC433DB for ; Thu, 7 Jan 2021 15:21:10 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4508D233FD for ; Thu, 7 Jan 2021 15:21:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4508D233FD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0iOySGqIwujbWLdqvfG27u1K/TAvScCXMNl0Tl2A6B4=; b=DxTmF5Ku4nQ+Re3AnuNTlT25J NKDXnb8FketeoFtGkUPwehQ99sC9pnYet+yunIN0qSwGvOKvum/aOvJcBMTwKW+2E0OanEAZE+56K 0zNJbjSBqb/N6O79I2iasC4angV3ktylbUfmaJZvdLIgu8phsFaeO1pvtLFjidk5RLgefnAVi+IOS v6VRtlcJI8HJSMpi1py+yG1YkBaxzsWSYzC0YuzYG4wxsS754wbtUaj9mTJUzRfB1+Z02uKhXT1kM EZJx7myMNQFxGv55TID5Ro2ZzPlG84pP7oJyUFem+GpUANRNmNEyv0qbX1kcypIoFPn/+A5boqutE t2HbifLEw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kxX4f-0000Bc-21; Thu, 07 Jan 2021 15:19:41 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kxX4c-0000B8-E9; Thu, 07 Jan 2021 15:19:39 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 959E6233FD; Thu, 7 Jan 2021 15:19:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610032776; bh=UB24bBL+xWXpFOs5afALQp6ryz62GM0B/ZX2FZZqhdY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DTZj75l7ly3oQmGCJ3VXkkiOn5CsPYPAleXdzsxBwkcQYg8zmzLzA4nN6KIOa/F5Y pALoC2R2Ms/63cLkG+OxX2TztMAFWAy82/s6kMcXEeR2PaprBOkY1DootAhnz5Dw+l NpQjkrqoR8E64HuHAnGfY8p4JKOoRv9MlWDkSQhI= Date: Thu, 7 Jan 2021 16:20:55 +0100 From: Greg Kroah-Hartman To: Cristian Ciocaltea Subject: Re: [PATCH v2 1/1] tty: serial: owl: Add support for kernel debugger Message-ID: References: <036c09732183a30eaab230884114f65ca42ca3b9.1609865007.git.cristian.ciocaltea@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <036c09732183a30eaab230884114f65ca42ca3b9.1609865007.git.cristian.ciocaltea@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210107_101938_556662_F40F3EEE X-CRM114-Status: GOOD ( 17.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-actions@lists.infradead.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Manivannan Sadhasivam , Jiri Slaby , Andreas =?iso-8859-1?Q?F=E4rber?= , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Jan 05, 2021 at 07:02:02PM +0200, Cristian Ciocaltea wrote: > Implement 'poll_put_char' and 'poll_get_char' callbacks in struct > 'owl_uart_ops' that enables OWL UART to be used for kernel debugging > over serial line. > > Signed-off-by: Cristian Ciocaltea > --- > Changes in v2: > - Reverted unnecessary changes per Andreas feedback > - Optimized implementation for 'owl_uart_poll_get_char()' > and 'owl_uart_poll_put_char()' callbacks > > drivers/tty/serial/owl-uart.c | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) > > diff --git a/drivers/tty/serial/owl-uart.c b/drivers/tty/serial/owl-uart.c > index c149f8c30007..54b24669ebc5 100644 > --- a/drivers/tty/serial/owl-uart.c > +++ b/drivers/tty/serial/owl-uart.c > @@ -12,6 +12,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -461,6 +462,26 @@ static void owl_uart_config_port(struct uart_port *port, int flags) > } > } > > +#ifdef CONFIG_CONSOLE_POLL > + > +static int owl_uart_poll_get_char(struct uart_port *port) > +{ > + if (owl_uart_read(port, OWL_UART_STAT) & OWL_UART_STAT_RFEM) > + return NO_POLL_CHAR; > + > + return owl_uart_read(port, OWL_UART_RXDAT); > +} > + > +static void owl_uart_poll_put_char(struct uart_port *port, unsigned char ch) > +{ > + while (owl_uart_read(port, OWL_UART_STAT) & OWL_UART_STAT_TFFU) > + cpu_relax(); Unbounded loops? What could possibly go wrong? :( Please don't do that in the kernel, put a max bound on this. And are you _SURE_ that cpu_relax() is what you want to call here? thanks, greg k-h _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel