Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp468019imm; Wed, 17 Oct 2018 03:15:03 -0700 (PDT) X-Google-Smtp-Source: ACcGV62T+GwFlMRVXE2hYGA/BrP2R/2GZ3iuH11ssPkWg9xdDi2DyRAzMIlPx/qgQsbyoG6O28Sh X-Received: by 2002:a62:d717:: with SMTP id b23-v6mr17250841pfh.238.1539771303086; Wed, 17 Oct 2018 03:15:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539771303; cv=none; d=google.com; s=arc-20160816; b=FFw/ZxwBA+CHsG1XlqeJWpOZLl3f9i7HVQgQ88ziXy5mZqly2LINMjDgCzrCi2ZHEm sIt/DvJrb1haVxR28FP7ozhlkP4kP3HziqBELOLEDlrkSFJlmmJNOSOUOo/CwwAHoYDT HLuSScb2KmRC35flieFMLNUW1yKEagB+x5esFdFmMyp6cNhgqYqHTo7t7Kfc9vbfU+ze y0hqIdHD6tOgKwVSarPa2R+nEr0yWLkk8W3tXVUD2l4SaarqEdS138gCa5Cs6Gg+Tv1w QoIsW+3Osuf1BkvGcjSoMW4N98hngrIGBIgo/wRhxugXymK4wvTtoFciXo+FNaxDaRoH OZIA== 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:dkim-signature; bh=cC/01CYnU4eCV09wqICajD0UyDpnS446Kr0hex3xitk=; b=pMkd0whlY+tdiyhBw1bwPMCRrO0lvOM7xK+dq4pU99zPmJ6wF6B00kzcE/n/ZcGZYg 7NWvrwE74w8R6v38BsFjuHJ4aPd5g3iuqRvshbuTk62kpXKu22keFgmqnAPF6ekCcMOA 5QG8dRdeKKHev4CPws8HlKY9q6LX1nH9VasYMnplsiaIGAVwpeuzjdNzq3TkD20WWGxm MOUHWf7HFl0YAt0K73eMlWfXNxj4oKPpDqBuVm2fU3tA0qllvk2EtbqksrCvsvrmYpWz ljyxiU7z3EvOGSOZFc4UlH9YJG3v8F6Ukrt70w7m0XQ9wnKGn6Lwzebt+5kJ7UgQtv42 cKQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=OIxgDhHB; 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 f3-v6si16540501plf.415.2018.10.17.03.14.47; Wed, 17 Oct 2018 03:15:03 -0700 (PDT) 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; dkim=pass header.i=@joelfernandes.org header.s=google header.b=OIxgDhHB; 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 S1727127AbeJQSI6 (ORCPT + 99 others); Wed, 17 Oct 2018 14:08:58 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:44948 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726976AbeJQSI6 (ORCPT ); Wed, 17 Oct 2018 14:08:58 -0400 Received: by mail-pf1-f196.google.com with SMTP id r9-v6so12956805pff.11 for ; Wed, 17 Oct 2018 03:13:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=cC/01CYnU4eCV09wqICajD0UyDpnS446Kr0hex3xitk=; b=OIxgDhHBuQh2ggxEbIHTvtu44/G2RkHyQpt4KnKulZsbZUBcBrcXE9MU7eeAmFwDlz 5odO7QXxKfrr4HkMrCF+DKvD0hM2g8XXjKNtR2GcCsFasxbjZ35WKiHmp9Lhkuc0USJ5 JnZ8zXyEXOAXspx7km1ZmtvhP54ABv22Dbwa4= 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=cC/01CYnU4eCV09wqICajD0UyDpnS446Kr0hex3xitk=; b=dQtUBTRaGYEG171BWV+aFTzxIvKr/VumMEUqoVmPdrGEaXf2DnBBJvHWeJTG2Ni/4m a8bdzJyw2SQtYqYkKPqTTXik+2Ueu0ija0KoJqJ66NbjcZWgFARGmUhTt7OH9mhTSuND Woie1ulP02YivxUZoKiSjTGYrwf1YzXnZbv9494V+vCWeGIJ5D92JyX0sNXXkme0OKS0 0X6ae/xJQjw7w6M8lMpv0WLVy9IP4AGIo9RNbhOmJrCUxtShNe+7VMfC6lZndLifaVqq saBYicmBTazL4ZoCtu3jv7b6SKlXdOfj4dFpdF+3in/LDJb/hRghyIVTGFPbbhTkdd3P 2yWg== X-Gm-Message-State: ABuFfogn/dK1mfy/QRnmOVmjfKgT09hGiXX2fqV7FUq7G3UxPUx92hWu LjjGTdd/10qXZGsUdoXalLzgDw== X-Received: by 2002:a62:5103:: with SMTP id f3-v6mr25797667pfb.107.1539771237770; Wed, 17 Oct 2018 03:13:57 -0700 (PDT) Received: from localhost ([2620:0:1000:1601:3aef:314f:b9ea:889f]) by smtp.gmail.com with ESMTPSA id g87-v6sm15819023pfj.34.2018.10.17.03.13.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Oct 2018 03:13:56 -0700 (PDT) Date: Wed, 17 Oct 2018 03:13:55 -0700 From: Joel Fernandes To: Kees Cook Cc: Steven Rostedt , Sai Prakash Ranjan , Stephen Boyd , Bjorn Andersson , Andy Gross , David Brown , Jiri Slaby , "Ivan T. Ivanov" , Geliang Tang , Greg Kroah-Hartman , Pramod Gurav , linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, "open list:SERIAL DRIVERS" , LKML , Rajendra Nayak , Vivek Gautam , Sibi Sankar Subject: Re: Crash in msm serial on dragonboard with ftrace bootargs Message-ID: <20181017101355.GA230639@joelaf.mtv.corp.google.com> References: <1cae8f10-55f5-20ce-9105-30af6f88bd6e@codeaurora.org> <20181016112928.4b52afb5@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Kees, On Tue, Oct 16, 2018 at 10:02:53AM -0700, Kees Cook wrote: > On Tue, Oct 16, 2018 at 8:29 AM, Steven Rostedt wrote: > > On Tue, 16 Oct 2018 17:08:25 +0530 > > Sai Prakash Ranjan wrote: > >> One more thing is for pstore dmesg-ramoops, I had to change > >> late_initcall to postcore_initcall which brings the question as to why > >> we changed to late_initcall? > >> Simple git blame shows to support crypto compress api, but is it really > >> helpful? A lot of boottime issues can be caught with pstore enabled at > >> postcore_initcall rather than late_initcall, this backtrace > >> is just one example. Is there any way we could change this? > > > > Does it break if the crypto is not initialized? Perhaps add a command > > line flag to have it happen earlier: > > > > ramoops=earlyinit > > > > and add a postcore_initcall that checks if that flag is set, and if so, > > it does the work then, and the late_initcall() will do nothing. > > > > That way, you can still have unmodified kernels use pstore when it > > crashes at boot up. > > Even better, if we could find a way to make it work with a late > initialization of compression (i.e. postcore_initcall() by default > means anything caught would be uncompressed, but anything after > late_initcall() would be compressed). I'd be very happy to review > patches for that! What do you think about the (untested) patch below? It seems to me that it should solve the issue of missing early crash dumps, but I have not tested it yet. Sai, would you mind trying it out and let me know if you can see the early crash dumps properly now? ----8<--- From: "Joel Fernandes (Google)" Subject: [RFC] pstore: allocate compression during late_initcall ramoop's pstore registration (using pstore_register) has to run during late_initcall because crypto backend may not be ready during postcore_initcall. This causes missing of dmesg crash dumps which could have been caught by pstore. Instead, lets allow ramoops pstore registration earlier, and once crypto is ready we can initialize the compression. Reported-by: Sai Prakash Ranjan Signed-off-by: Joel Fernandes (Google) --- fs/pstore/platform.c | 13 +++++++++++++ fs/pstore/ram.c | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index 15e99d5a681d..f09066db2d4d 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -780,6 +780,19 @@ void __init pstore_choose_compression(void) } } +static int __init pstore_compression_late_init(void) +{ + /* + * Check if any pstore backends registered earlier but did not allocate + * for compression because crypto was not ready, if so then initialize + * compression. + */ + if (psinfo && !tfm) + allocate_buf_for_compression(); + return 0; +} +late_initcall(pstore_compression_late_init); + module_param(compress, charp, 0444); MODULE_PARM_DESC(compress, "Pstore compression to use"); diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index bbd1e357c23d..98e48d1a9776 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -940,7 +940,7 @@ static int __init ramoops_init(void) ramoops_register_dummy(); return platform_driver_register(&ramoops_driver); } -late_initcall(ramoops_init); +postcore_initcall(ramoops_init); static void __exit ramoops_exit(void) { -- 2.19.1.331.ge82ca0e54c-goog