Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp329435pxb; Fri, 8 Jan 2021 06:12:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJxmROZdIUTKw9YjxIJEA8B69yaUIGBip/KqT8PfmsVYuMz32t7uDP/PSTzwM1I2jxevmCk6 X-Received: by 2002:a17:906:edca:: with SMTP id sb10mr2893399ejb.284.1610115171351; Fri, 08 Jan 2021 06:12:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610115171; cv=none; d=google.com; s=arc-20160816; b=JWFyeuh8HakwvNZoK7QEJuAoAU2TQfo7nXUPnfw0ka382EZCeJ0T8xZl55ifHc1zmX c6w/yJn2Ca8V8Z3LJ+OB+adUtl2ZLOiKmbbkuG4tt+ER3pjbxPvhGN1R2mJURNuFa3YA vi3iUw839z3MrD02fObNsaKZ9CM0efvkOBJY8yazbclDIWYQ3KZ5qUGINXVzGJSudpgf GiQpaw1hZPZK0xFesuPqBdkEsteNGkud/AbEHUZMFMLkTQfT+v+vHm+TkXCdFvuqHbZ/ SYYIf5/bktDF6DJ6c6cdhc+jsDEbZ2XjfLxMxSxpfSxWk9OnbISMCvmzxyDoE3Pnhayi FOdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1nJeF0Qm75ArKvLXNJY1ZwCCv3tl4AeKTF2NJqbUljE=; b=Rgh3VcctAtPjagQrvGxjdIdJ/lYCnJUvruM59ZmK4gLL5FTsdd3uuapCeG7jqfIPXw fiCIaQ+pSCc/g3aT6DL+nKre6ylceD8qX/1z+U98uu44lioc47SiHfDJNQDYEXhd+iIC E2P19zvHyDfXrBf5KYyQiklQQH26krjhL4XVaicBDku4sAZ9MbiNBLME6bGivEN4p2Hi P0nLuVx6x9xHeSSanIQNIZITZvz5nABDEWBM1KMWyySrymYelP9u5Qe3SmW4JrvwYTyl LWwDDx5CER5fbNNqGCJqcGXf7zg6hUyP42EOaRfJ59mlWJ7zu8y39hxtGjO+SnwUTaRb 628Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nr8NhgHO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l26si3638596edv.316.2021.01.08.06.12.27; Fri, 08 Jan 2021 06:12:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nr8NhgHO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726761AbhAHOL1 (ORCPT + 99 others); Fri, 8 Jan 2021 09:11:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726469AbhAHOL0 (ORCPT ); Fri, 8 Jan 2021 09:11:26 -0500 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A1BBC0612F4; Fri, 8 Jan 2021 06:10:46 -0800 (PST) Received: by mail-ej1-x631.google.com with SMTP id 6so14685374ejz.5; 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=otsFHoByQtZfAp+WTUEXe5wvorXqRXXRKm/dMgCdUe2WVGB8rVFV0Wkoj1m8yRdVTQ qc92xuL0RY5F/WvKy2330M6seIl2md/lZUfbJGZ8HQsedrHXFDo4UEyitRluHf7M8V// rpYxf2WCpGXYJgw//mAlPx+a9vtZ8pCypk6R3JUMvWXDxr8bi3Wqk+gab1PdmNcfkQve wwxGnG0PIcwpl81APbkRdAgurrLADGQtJAQMhtXiwDrItlSd4xbNIbw5Om9XaNMn//wt 4xHHtwrBYIdCqLLVnAyfme4BPx/pF6eBCPeN1OnMA9Lqr3hI7pUSDF4Z6bg/j1jvFS5s SpBw== X-Gm-Message-State: AOAM533mWuQt6Esgg9B5ZQwiFaAkTuQjgztP3OYurhvK40Ck8SF2aAuK tJztu7yvThEnF+fMpchmNbc= 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 Cc: Greg Kroah-Hartman , 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: <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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <02c664f5-8107-7757-2e20-c446a0458539@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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