Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp262792imp; Thu, 21 Feb 2019 00:39:24 -0800 (PST) X-Google-Smtp-Source: AHgI3IYvm1hBRtzXeih/FuKxZi77HYMo7GOPFwH3TXdYoIUvIW0zcrhyVNGG7eQQ4KbdJ3uS9CHH X-Received: by 2002:a63:a70b:: with SMTP id d11mr32918426pgf.213.1550738364475; Thu, 21 Feb 2019 00:39:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550738364; cv=none; d=google.com; s=arc-20160816; b=Gx274aIsh6anh8L+eJFtcDYfISkIHKvcHEPj48CxyVOFeEcYpN9BWSqH3+mN0Xi+tY Gt/G+iRNUAO75DvxzEtBWeESpOMccE23wMOYcFqc4B+V3DSwUTwZyeP2rNJIcNhdbFTk m1gRHbcrSRaqOb6GQUER0FgNhptqBKQEWHGEJcSYiOkPSallawx+pb/mOYkVXhyC3AKo eC41v7xK2L/XCAg0FLwjhfTvpeDXVGZXzJe686Qj/aboQjk08TWAAhpnmrBCxiejbkNg vSh4foFQphOsMBclJWPfiaaevITGkPGe4bYTdzlkeOojvbbXxz3G+pxte4mNe3xhwAb2 2fAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=72C54CMUWy+1m8ZlKAGUFmbEMyOVB1chudHqhUuh2Ok=; b=qmGxsHRBDwBJSAXEKDBdntZ63cQJLliVxTJFg/c8W7b+iGy72QZT+o2aQVAFUubqP6 W2kXmt97jjEYy0jmoarynSotK9qLazswmppa5oza3BCEHDjI3cLWuCF08Dmnssv3+MMy WWy8+D/4UeajPCoyOk6XreIucMToFT36FKbL9duRzd81faps2eHSRjrdoP5qkTHhJ8zB wteaRUv8KwP6scAaUVy6H1V9EhFflggzdYLnXbT873B4Ya+oOmnHdS926Fp9VMgMNUf6 P3+3RZVlqIK2Voe+PLqkIvG8Vl0t7pL2PDcbjc3PFHo35DkoCnsiE6pmKc+st61g3CiW /VQQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j127si15950312pgc.444.2019.02.21.00.39.09; Thu, 21 Feb 2019 00:39:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727340AbfBUIik (ORCPT + 99 others); Thu, 21 Feb 2019 03:38:40 -0500 Received: from mx2.suse.de ([195.135.220.15]:43494 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727286AbfBUIij (ORCPT ); Thu, 21 Feb 2019 03:38:39 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 9D9F8AC7A; Thu, 21 Feb 2019 08:38:37 +0000 (UTC) Date: Thu, 21 Feb 2019 09:38:35 +0100 From: Petr Mladek To: Andrea Parri Cc: Michael Ellerman , linuxppc-dev@ozlabs.org, akpm@linux-foundation.org, tj@kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, dyoung@redhat.com, sergey.senozhatsky@gmail.com, Steven Rostedt Subject: Re: [PATCH v3 1/7] dump_stack: Support adding to the dump stack arch description Message-ID: <20190221083835.pwwwcqtwfucxkday@pathway.suse.cz> References: <20190207124635.3885-1-mpe@ellerman.id.au> <20190211125035.GA1562@andrea> <20190211143859.dd2lkccxod3f2fwn@pathway.suse.cz> <20190219233925.GA5648@andrea> <87va1e7pw2.fsf@concordia.ellerman.id.au> <20190220134433.GA4932@andrea> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190220134433.GA4932@andrea> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 2019-02-20 14:44:33, Andrea Parri wrote: > > >> > > + * Order the stores above in vsnprintf() vs the store of the > > >> > > + * space below which joins the two strings. Note this doesn't > > >> > > + * make the code truly race free because there is no barrier on > > >> > > + * the read side. ie. Another CPU might load the uninitialised > > >> > > + * tail of the buffer first and then the space below (rather > > >> > > + * than the NULL that was there previously), and so print the > > >> > > + * uninitialised tail. But the whole string lives in BSS so in > > >> > > + * practice it should just see NULLs. > > >> > > > It is not my intention to support concurrent updates of the string. The > > idea is you setup the string early in boot. > > Understood, thanks for the clarification. > > > > The concern with a concurrent reader is simply that the string is dumped > > in the panic path, and you never really know when you're going to panic. > > Even if you only write to the string before doing SMP bringup you might > > still have another CPU go rogue and panic before then. > > > > But I probably should have just not added the barrier, it's over > > paranoid and will almost certainly never matter in practice. > > Oh, well, I can only echo you: if you don't care about the stores being > _observed_ out of order, you could simply remove the barrier; if you do > care, then you need "more paranoid" on the readers side. ;-) Hmm, the barrier might be fine and actually useful. The purpose is to make sure that the later '\0' is written before the existing one is replaced by ' '. The reader does not need the barrier as long as it reads the string sequentially. I would expect that it is always the case. But who knows with all the speculation-related CPU bugs around. In each case, any race could never crash the kernel. The dump_stack_arch_desc_str is zeroed out of box and the very last '\0' is never rewritten. Best Regards, Petr