Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1610259
| Path | csiph.com!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v8 3/3] printk: fix double printing with earlycon |
| Date | Tue, 28 Mar 2017 04:10:02 +0200 |
| Message-ID | <tpOK6-DA-3@gated-at.bofh.it> (permalink) |
| References | <tlevv-6jJ-5@gated-at.bofh.it> <tn2qd-3a9-11@gated-at.bofh.it> <tpDF0-QR-19@gated-at.bofh.it> <tpFGN-2pv-21@gated-at.bofh.it> |
| X-Original-To | Aleksey Makarov <aleksey.makarov@linaro.org> |
| 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:user-agent; bh=4VqxDyjJxgf0VqaDTPebU03W1GZmDtipulbNpVd9BtU=; b=Mrw8c4Y5bD/81d5soKNCwSVRGJvNvoVZf/f1Uvt7SYvgD4Fksu4LX3V68vYX1kcwl8 BHC8k64YEEgPq2Jv2ZHqGU+F6fEcCB1mjz9NoEqX0S0NcVaOsCQ4TeKohoM/hcC3Htf2 YNWP4jyvwgtJWCK84+bG9VlGyVSw9b/J3qo4p/fkQaEkEpiRXc3GfBNjZczcjDLH1wX/ WrsErEZZb9OhM/8xk3TMH87POgqYMzVTdMNrKyMryNk7PZaBJOeCl1a+PJjvSZ6SL8M2 tIsHkTdhcUi2ZoTYVL92FbScd1H/MeIfdJEUiUO1gSTfcQ20SoWgChVswBz7QmPkE+sX GoFA== |
| 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:user-agent; bh=4VqxDyjJxgf0VqaDTPebU03W1GZmDtipulbNpVd9BtU=; b=PNOs8CbkPxaUOZ6isW0CPmihPgfhcnO3jusMyyzBFqDsIPyyZn59LfVqhigoerQhQ8 ROJnspF+mqlCngOWyScFlXpagHUQ/2ETqe//W9eXlz3Y7mD0x2FPP2j759Ho5WaFINo3 Lkx8+sGHnOl2CZV3rU5ny3hzRPTC5cZQkSDyO7f4tZhTy75R/e5cMwH3PlgpuHwjrCz2 NtSRyrkRDxe+eIuItD7WRmekdeNnW0q1DyBkYNq1cTWBG+UfveziLq1uyhOrSax+KzcO mA60JOpcIWglEfDElQEFXlyDBsR71Kc3Xcekt2gaPaEiF3+JS3z5fXKixsE6I5rKP6kX di0Q== |
| X-Gm-Message-State | AFeK/H0nWLAfVe01oFkBDbITMEepcGAYnB6QMxJpJAr3cim2spQSgjfXbfJx0Jm23jxtuQ== |
| X-Received | by 10.98.33.68 with SMTP id h65mr29046324pfh.214.1490666645363; Mon, 27 Mar 2017 19:04:05 -0700 (PDT) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| User-Agent | Mutt/1.8.0 (2017-02-23) |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 63 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Petr Mladek <pmladek@suse.com>, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Sudeep Holla <sudeep.holla@arm.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Peter Hurley <peter@hurleysoftware.com>, Jiri Slaby <jslaby@suse.com>, Robin Murphy <robin.murphy@arm.com>, Steven Rostedt <rostedt@goodmis.org>, "Nair, Jayachandran" <Jayachandran.Nair@cavium.com>, Sergey Senozhatsky <sergey.senozhatsky@gmail.com> |
| X-Original-Date | Tue, 28 Mar 2017 11:04:04 +0900 |
| X-Original-Message-ID | <20170328020404.GA10573@jagdpanzerIV.localdomain> |
| X-Original-References | <20170315102854.1763-1-aleksey.makarov@linaro.org> <20170320100302.8656-1-aleksey.makarov@linaro.org> <20170327141432.GH2846@pathway.suse.cz> <4b561f81-67af-f6a3-76c9-d0d8499c52bd@linaro.org> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1610259 |
Show key headers only | View raw
On (03/27/17 19:28), Aleksey Makarov wrote:
[..]
> > > + /*
> > > + * Maintain an invariant that will help to find if
> > > + * the matching console is preferred, see
> > > + * register_console():
> > > + *
> > > + * The last non-braille console is always
> > > + * the preferred one.
> > > + */
> > > + for (last = MAX_CMDLINECONSOLES - 1;
> > > + last >= 0 && !console_cmdline[last].name[0];
> > > + last--)
> > > + ;
> >
> > This is a rather non-trivial code to find the last element.
> > I might make sense to count it in a global variable.
> > Then we might remove the check for console_cmdline[i].name[0]
> > also in the other for cycles and make them better readable.
>
> Having an additional variable console_cmdline_last pointing to the last element
> would require maintaining consistency between this variable and
> contents of console_cmdline. For the code we have it is not hard, but when code
> is changed we need to check this. Also there exists preferred_console that
> has almost the same meaning but it points not to the last element, but to the
> last non-braille element. Also we need to have a special value (-1) for this
> variable for empty array. So I personally would instead try to rewrite this:
>
> for (last = MAX_CMDLINECONSOLES - 1; last >= 0; last--)
> if (console_cmdline[last].name[0])
> break;
>
> Is it better? If not, I will send a version with console_cmdline_last.
personally I'm fine with the nested loop. the latest version
"for (last = MAX_CMDLINECONSOLES - 1; last >= 0;..."
is even easier to read.
so we do not just iterate console_cmdline anymore, but also modify it.
this, probably, has impact on the following scenario
CPU0 CPU1
add_preferred_console() add_preferred_console()
__add_preferred_console() __add_preferred_console()
swap(i1, last) swap(i2, last)
temp1 = i1
i1 = last temp2 = i2
last = temp1 i2 = last
last = temp2
so both i1 and i2 will point to 'last' now, IOW, we will have two
identical entries in console_cmdline, while i1 or i2 will be lost.
neither add_preferred_console() nor __add_preferred_console() have any
serialization. and I assume that we can call add_preferred_console()
concurrently, can't we?
-ss
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v5 0/3] printk: fix double printing with earlycon Aleksey Makarov <aleksey.makarov@linaro.org> - 2017-03-15 11:40 +0100
[PATCH v6 3/3] printk: fix double printing with earlycon Aleksey Makarov <aleksey.makarov@linaro.org> - 2017-03-17 12:50 +0100
Re: [PATCH v6 3/3] printk: fix double printing with earlycon Aleksey Makarov <aleksey.makarov@linaro.org> - 2017-03-17 14:50 +0100
[PATCH v7 3/3] printk: fix double printing with earlycon Aleksey Makarov <aleksey.makarov@linaro.org> - 2017-03-17 14:50 +0100
Re: [PATCH v7 3/3] printk: fix double printing with earlycon Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-03-20 07:20 +0100
[PATCH v8 3/3] printk: fix double printing with earlycon Aleksey Makarov <aleksey.makarov@linaro.org> - 2017-03-20 11:10 +0100
Re: [PATCH v8 3/3] printk: fix double printing with earlycon Petr Mladek <pmladek@suse.com> - 2017-03-27 16:20 +0200
Re: [PATCH v8 3/3] printk: fix double printing with earlycon Aleksey Makarov <aleksey.makarov@linaro.org> - 2017-03-27 18:30 +0200
Re: [PATCH v8 3/3] printk: fix double printing with earlycon Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-03-28 04:10 +0200
Re: [PATCH v8 3/3] printk: fix double printing with earlycon Petr Mladek <pmladek@suse.com> - 2017-03-28 15:00 +0200
Re: [PATCH v8 3/3] printk: fix double printing with earlycon Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-03-30 08:00 +0200
Re: [PATCH v8 3/3] printk: fix double printing with earlycon Petr Mladek <pmladek@suse.com> - 2017-04-04 13:20 +0200
Re: [PATCH v8 3/3] printk: fix double printing with earlycon Aleksey Makarov <aleksey.makarov@linaro.org> - 2017-04-05 20:30 +0200
[PATCH v9 3/3] printk: fix double printing with earlycon Aleksey Makarov <aleksey.makarov@linaro.org> - 2017-04-05 22:30 +0200
Re: [PATCH v9 3/3] printk: fix double printing with earlycon Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-04-06 00:00 +0200
Re: [PATCH v9 3/3] printk: fix double printing with earlycon Aleksey Makarov <aleksey.makarov@linaro.org> - 2017-04-06 06:50 +0200
Re: [PATCH v9 3/3] printk: fix double printing with earlycon Petr Mladek <pmladek@suse.com> - 2017-04-10 16:30 +0200
csiph-web