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=-5.7 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 0ABC2C433E0 for ; Fri, 8 Jan 2021 14:13:08 +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 C0CF722A99 for ; Fri, 8 Jan 2021 14:13:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C0CF722A99 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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=wxvwHHOerPS9nHF0rI5k6Nwvz8uCUgmMgbZjanewZ/k=; b=wNp//D0p0ZY3pJzuokpWX8BRg yCE/LD+cF4RmBLyLyUdl4OXvGTt9yG/UJ+TVaT4dGx9ZAbDanE7DN4UNHGFHeJCBLgvvbQ100wHsm zQR8XFr9xHUMPXfz5OVf/ep2qORHULRMYHEjCRMR4ynDxVfuvUD9ATbqamEs2PI9LV1iEUVhtfCLu QNLRUhRCRTMbW6yJrlv2pWNoSo92sepwzzqwSEc7WB4uChhdKJaXq/DbbyWZqqv1aaxbQd506e8dv 7cjVMXccqxRpP8DsTMnWKTMQzsNmhsmpllijJH7TLPjcE0N7UBV+awfKFNLcvhEhp1LJE2865UeA2 hLZAR0Erg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kxsTv-0006WZ-T4; Fri, 08 Jan 2021 14:11:11 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kxsTW-0006Un-DY; Fri, 08 Jan 2021 14:10:48 +0000 Received: by mail-ej1-x630.google.com with SMTP id x16so14672386ejj.7; Fri, 08 Jan 2021 06:10:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=1nJeF0Qm75ArKvLXNJY1ZwCCv3tl4AeKTF2NJqbUljE=; b=nr8NhgHOTk1yj0Xb35+2HmT/bPGwV8v9uvl1fJ3irWurZRHEjydxBikcsMFu9KP0wO +cp4tpvemCVsnCcY7jT+BQeDYnb2XnnLbrMy7NBrxtOjoSDqsQl906BBBCdF5akayvik t1NNfIfxd0CkZTEZwQnaiWQ1osa1086JzTQOcP95oAQDuyIxx6/7s1mW63a6yWIQtt75 eum5PjoAwXtaXVJCu3I7Ltu4aIBQG+b/94ANzkd57+qd/qn6HAupiPXKEWGkZlWoSVGR s3fq/AA0D4KAM/wuthWHfxqNTid7XWeAewmdo2Pi+tzmTbKnLuYaL3GKB3fznsp7WsZ7 /EYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=1nJeF0Qm75ArKvLXNJY1ZwCCv3tl4AeKTF2NJqbUljE=; b=CDSngLVR0mgqW5FYW6WC3iTJO3RwbmrO/NLk4LzZPWhfui/Sjl3P1RyMkxz7h77gUi GmVM5qNwNmkGVLlDgVJ9UiOKxB0eIbK1Pk+feC7XBLTH1C0rORTZq5/iamLwnS0NrdQF Aa0dTrn119JCuNk1gPA+0SgcGytudMuDWbeGTL+gBMVTCp5/zTTfYq7t9FnXuunVBQUB kJCWNRA22qMHOJ85njscwRKafHkiHK3Jz23DnjHPpdBKkgPMWRp0PwlS7rRBNKEpCSBc KmDrwsS36p7MSehAHo3+HXrBh5E1gG8dHIDtMbr8p91+0MZ6a9Vv97BDiBz2lbl0pFrI Vfsg== X-Gm-Message-State: AOAM531viCur2XGCjfVs2d4P5FvQD99JlR7rYB4kLqIKoFqYqJf+n1uU 5t7oUf7VMb6ICTTTUom6bXQ= X-Google-Smtp-Source: ABdhPJyK4whluGdOyfhathde42YwE2i0ytkSh9A0RpUvvHVR8A0RgL+u/O3AJf3eeOiTA4AD50n5Vg== X-Received: by 2002:a17:906:1197:: with SMTP id n23mr2769028eja.359.1610115044816; Fri, 08 Jan 2021 06:10:44 -0800 (PST) Received: from ubuntu2004 ([188.24.159.61]) by smtp.gmail.com with ESMTPSA id e27sm3588390ejm.60.2021.01.08.06.10.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 06:10:43 -0800 (PST) Date: Fri, 8 Jan 2021 16:10:40 +0200 From: Cristian Ciocaltea To: Jiri Slaby Subject: Re: [PATCH v2 1/1] tty: serial: owl: Add support for kernel debugger Message-ID: <20210108141040.GA1081858@ubuntu2004> References: <036c09732183a30eaab230884114f65ca42ca3b9.1609865007.git.cristian.ciocaltea@gmail.com> <20210107181604.GA427955@BV030612LT> <02c664f5-8107-7757-2e20-c446a0458539@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <02c664f5-8107-7757-2e20-c446a0458539@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210108_091046_532725_037DB8AF X-CRM114-Status: GOOD ( 24.10 ) 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: Greg Kroah-Hartman , linux-actions@lists.infradead.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Manivannan Sadhasivam , 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 Fri, Jan 08, 2021 at 08:58:38AM +0100, Jiri Slaby wrote: > On 07. 01. 21, 19:16, Cristian Ciocaltea wrote: > > Hi Greg, > > > > Thank you for the review! > > > > On Thu, Jan 07, 2021 at 04:20:55PM +0100, Greg Kroah-Hartman wrote: > > > 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 > > > > [...] > > > > > > + > > > > +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. > > > > I didn't realize the issue since I had encountered this pattern in many > > other serial drivers, as well: altera_uart, arc_uart, atmel_serial, etc. > > > > > And are you _SURE_ that cpu_relax() is what you want to call here? > > > > I'm thinking of replacing the loop with 'readl_poll_timeout_atomic()', > > if that would be a better approach. > > It might be better, yes. Either way, if you add a bound to the loop, you > definitely need a more precise timing, so ndelay/udelay instead of > cpu_relax. I will use 1-5 us for the timing, but I'm not quite sure about the overall timeout - 10 ms would suffice? Thanks, Cristi > thanks, > -- > js _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel