From owner-freebsd-hackers@FreeBSD.ORG Sun Sep 23 05:55:43 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BD153106566B; Sun, 23 Sep 2012 05:55:43 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) by mx1.freebsd.org (Postfix) with ESMTP id 8EC948FC0A; Sun, 23 Sep 2012 05:55:43 +0000 (UTC) Received: from JRE-MBP-2.local (c-50-143-149-8.hsd1.ca.comcast.net [50.143.149.8]) (authenticated bits=0) by vps1.elischer.org (8.14.5/8.14.5) with ESMTP id q8N5taRb015881 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sat, 22 Sep 2012 22:55:36 -0700 (PDT) (envelope-from julian@freebsd.org) Message-ID: <505EA457.6070906@freebsd.org> Date: Sat, 22 Sep 2012 22:55:35 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 MIME-Version: 1.0 To: Andriy Gapon References: <50587635.8070007@FreeBSD.org> <505DF965.2020506@FreeBSD.org> In-Reply-To: <505DF965.2020506@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers Subject: Re: cpu_spinwait in cngetc X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 05:55:43 -0000 On 9/22/12 10:46 AM, Andriy Gapon wrote: > on 18/09/2012 16:25 Andriy Gapon said the following: >> (Why[*]) Would anyone object to a change like this? >> >> diff --git a/sys/kern/kern_cons.c b/sys/kern/kern_cons.c >> index 5346bc3..d17846a 100644 >> --- a/sys/kern/kern_cons.c >> +++ b/sys/kern/kern_cons.c >> @@ -384,7 +384,7 @@ cngetc(void) >> if (cn_mute) >> return (-1); >> while ((c = cncheckc()) == -1) >> - ; >> + cpu_spinwait(); >> if (c == '\r') >> c = '\n'; /* console input is always ICRNL */ >> return (c); >> >> [*] :-) >> > I would to re-ping with this question. > Is there any architecture where a cpu_spinwait could cause a surprise? > Or is universally safe? > > The most visible place which this change can affect is ddb prompt. > > looks like the right thing to do