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=-11.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 42BC9C433E0 for ; Fri, 8 Jan 2021 08:01:41 +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 EC7E3233CF for ; Fri, 8 Jan 2021 08:01:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EC7E3233CF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.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-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=3P4V/SP8l6k8gM0S44fezA1JE/uplk/wOH98tPspMbg=; b=Gmtfh0eLpAtdthFSOyr12pm7K hWOPWD38Fz7hikg87a2gOnHx1SKVsyVRGBpmy0Q+yFup+AdWNPzfIvXImXYUnh7N7vpB236m4g3q+ NlSb9gw/xZ3Kv6vEmY2xfS7eIO5kOUkxpZvbPegZ+CsPOifCf5/pgWyR1qDtSb5dycOiuqq6qIk99 u6+Zr6nS9ZdFz2Z1X9LUeKmffjRBL8ewCEZUsVZhmI8z0vxUbLx5shN7+p36haMCcK0I+qsEIlG+L /RLn0e5WdrgO1ym0saNxbYH+CWuC+ao1vABEiFBu8aAIqVdxnqQzsVlwmCfDPTvcCF+dvFOGH9wVV suYLKaZ/w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kxmgB-00078V-Nj; Fri, 08 Jan 2021 07:59:27 +0000 Received: from mail-ed1-f53.google.com ([209.85.208.53]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kxmfY-0006k4-BO; Fri, 08 Jan 2021 07:58:49 +0000 Received: by mail-ed1-f53.google.com with SMTP id p22so10217170edu.11; Thu, 07 Jan 2021 23:58:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=XgxocXanKUK3WcPXgyk3GPEznii50h5p/rUjDFov25U=; b=tYKfp70+hZ6K8GQxnZX77gP5qoqb01M50/qEJM15IosGUjeOrLjC3D3jtIaqrLURs4 b2fZj8aD7kf1SUop4UjIMfrT03Q+LcZlja0G5lUu+ZfWPVcvxOFA5hvY8B6bL4wYlSjA 9pRNVb7nchy4eP1eueplJHa6/Emn8Gm6KlB14zBY+vK2+aWpq81+3cgYVKZJAQCniASN 7wWFbhNt/Tf0WvwVEUM/m7SEOquxg9jUGfgmJJ3TptAsOSuErRSJfpr75RiHXy9i6jnM bEI7NF0MwqcUZipaDMLgCyG9pE+5zH1qbvie8g2T6Vk30jvwWTwy7Ja9JG+bdDT94dxI E9gg== X-Gm-Message-State: AOAM532+Bj3GBp33cdKqTVXfzjlDAnqHNrs8kyL+Jz57HP566Z6pjcpR 9gaVB2M5sWotMxvTwgFPQV4= X-Google-Smtp-Source: ABdhPJxGkO9yrJAbN8iv6b2UqNFjlclNpzeu4rLyZ13WMxnHxbrNVfbXZuQk3HPAPONW6G0L7+4sDQ== X-Received: by 2002:a50:9ee6:: with SMTP id a93mr4504876edf.174.1610092719982; Thu, 07 Jan 2021 23:58:39 -0800 (PST) Received: from [192.168.1.49] (185-219-167-24-static.vivo.cz. [185.219.167.24]) by smtp.gmail.com with ESMTPSA id a10sm3259591ejk.92.2021.01.07.23.58.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Jan 2021 23:58:39 -0800 (PST) Subject: Re: [PATCH v2 1/1] tty: serial: owl: Add support for kernel debugger To: Cristian Ciocaltea , Greg Kroah-Hartman References: <036c09732183a30eaab230884114f65ca42ca3b9.1609865007.git.cristian.ciocaltea@gmail.com> <20210107181604.GA427955@BV030612LT> From: Jiri Slaby Message-ID: <02c664f5-8107-7757-2e20-c446a0458539@kernel.org> Date: Fri, 8 Jan 2021 08:58:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20210107181604.GA427955@BV030612LT> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210108_025848_498150_356668BC X-CRM114-Status: GOOD ( 19.60 ) 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 , =?UTF-8?Q?Andreas_F=c3=a4rber?= , linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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. thanks, -- js _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel