From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754703Ab0INTRk (ORCPT ); Tue, 14 Sep 2010 15:17:40 -0400 Received: from smtp1.linux-foundation.org ([140.211.169.13]:49048 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753370Ab0INTRj (ORCPT ); Tue, 14 Sep 2010 15:17:39 -0400 Date: Tue, 14 Sep 2010 12:17:21 -0700 From: Andrew Morton To: Timur Tabi Cc: linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org, benh@kernel.crashing.org, kumar.gala@freescale.com, amit.shah@redhat.com Subject: Re: [PATCH] hvc_console: fix dropping of characters when output byte channel is full Message-Id: <20100914121721.c8671ed8.akpm@linux-foundation.org> In-Reply-To: <1282329921-24394-1-git-send-email-timur@freescale.com> References: <1282329921-24394-1-git-send-email-timur@freescale.com> X-Mailer: Sylpheed 2.4.8 (GTK+ 2.12.9; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 20 Aug 2010 13:45:21 -0500 Timur Tabi wrote: > hvc_console_print() calls the HVC client driver's put_chars() callback > to write some characters to the console. If the callback returns 0, that > indicates that no characters were written (perhaps the output buffer is > full), but hvc_console_print() treats that as an error and discards the > rest of the buffer. > > So change hvc_console_print() to just loop and call put_chars() again if it > returns a 0 return code. Seems rather dangerous. The upper layer will sit there chewing 100% CPU for as long as the lower layer is congested. > This change makes hvc_console_print() behave more like hvc_push(), which > does check for a 0 return code and re-schedules itself. Yes, hvc_push() reschedules. It doesn't sit in a tight loop burning electrons! Can we do something safer&smarter here? From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp1.linux-foundation.org (smtp1.linux-foundation.org [140.211.169.13]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "smtp.linux-foundation.org", Issuer "CA Cert Signing Authority" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id 4A379B6F07 for ; Wed, 15 Sep 2010 05:17:28 +1000 (EST) Date: Tue, 14 Sep 2010 12:17:21 -0700 From: Andrew Morton To: Timur Tabi Subject: Re: [PATCH] hvc_console: fix dropping of characters when output byte channel is full Message-Id: <20100914121721.c8671ed8.akpm@linux-foundation.org> In-Reply-To: <1282329921-24394-1-git-send-email-timur@freescale.com> References: <1282329921-24394-1-git-send-email-timur@freescale.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Cc: amit.shah@redhat.com, linuxppc-dev@ozlabs.org, kumar.gala@freescale.com, linux-kernel@vger.kernel.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Fri, 20 Aug 2010 13:45:21 -0500 Timur Tabi wrote: > hvc_console_print() calls the HVC client driver's put_chars() callback > to write some characters to the console. If the callback returns 0, that > indicates that no characters were written (perhaps the output buffer is > full), but hvc_console_print() treats that as an error and discards the > rest of the buffer. > > So change hvc_console_print() to just loop and call put_chars() again if it > returns a 0 return code. Seems rather dangerous. The upper layer will sit there chewing 100% CPU for as long as the lower layer is congested. > This change makes hvc_console_print() behave more like hvc_push(), which > does check for a 0 return code and re-schedules itself. Yes, hvc_push() reschedules. It doesn't sit in a tight loop burning electrons! Can we do something safer&smarter here?