Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5684265imm; Tue, 18 Sep 2018 13:46:10 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb+EGJjw+km7627wsPsAZdyKBwVUpXKgANXt3UDhat85woU+EVJM8IaP/nkhdqfyt3a6NJi X-Received: by 2002:a63:5706:: with SMTP id l6-v6mr30164132pgb.118.1537303570400; Tue, 18 Sep 2018 13:46:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537303570; cv=none; d=google.com; s=arc-20160816; b=MgljfwPU63To07yJIxEk7QI1+P+VdJ6/5onTYyrPAwiJWv9a/lwOa3+5kdB0AG8Jok 2F8CrReQDmOsYKWM1/5R5OrwScvgmyr5q+zf16N1h8Y/XYSBbYOjeyNAoXdSu6pZ6meO lfzAddbatFx114995Lv9LV3UxFvu2VRbFC2P3Hm6hrXRNEgZJ15v/8nK5rJrDlg2Ugo2 stDT2Z/RDjq1SjiHHKOtianEScsNzpzwBytgAxy3E2Dzyb/H5U3aWsNh5ilUWJXkN7DP //tZvybz7zDeeufCvdcchI1Y8R++Tw80dozLRh/Rquly+kCgp5taGf/vr+vn6vebjaFC cZcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=wbcHJ5lQtLRpedku3j//CVBu5AxIwDlW+FymRYoh160=; b=Ml5mZf+rnuOH2B1bfC/pmedFiOmKfmzefw6sJ+iWFIXp6eey6f61UtCRp87eGUkAK8 CvDZwJyd+HW0z2rkCLw7jI975cbJGHR1SqmIVgAKo8rLu0McbO5B8oTOTtt4LEQJ5kFl YzJK796tfQEy7lcMX8SPIQikbRIRCkRuC/zpo2W/4Gojz75kMlRZm+bFODvSH1Bd8rQA AvKoJmo2uQJWRHEEWwsfBwJzKs8widj/0AQlvQ/k3RKQandOZbeStOod3jcEZpfUe2l1 ELt98SXgPofBMNkw1EwcQ+5XdRY3Yz+K6dwU1SFFiAVZgtBEjpWhnpcpogRqvyL7yoxS UTXg== 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 az1-v6si18470951plb.513.2018.09.18.13.45.55; Tue, 18 Sep 2018 13:46:10 -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; 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 S1730455AbeISCTA (ORCPT + 99 others); Tue, 18 Sep 2018 22:19:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:50130 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730134AbeISCTA (ORCPT ); Tue, 18 Sep 2018 22:19:00 -0400 Received: from gandalf.local.home (cpe-66-24-56-78.stny.res.rr.com [66.24.56.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DA0F62133F; Tue, 18 Sep 2018 20:44:37 +0000 (UTC) Date: Tue, 18 Sep 2018 16:44:34 -0400 From: Steven Rostedt To: Sai Prakash Ranjan Cc: Ingo Molnar , Laura Abbott , Kees Cook , Anton Vorontsov , Rob Herring , devicetree@vger.kernel.org, Colin Cross , Jason Baron , Tony Luck , Arnd Bergmann , Catalin Marinas , Will Deacon , Joel Fernandes , Masami Hiramatsu , Joe Perches , Jim Cromie , Rajendra Nayak , Vivek Gautam , Sibi Sankar , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Greg Kroah-Hartman , Ingo Molnar , Tom Zanussi , Prasad Sodagudi , tsoni@codeaurora.org, Bryan Huntsman , Tingwei Zhang Subject: Re: [PATCH 2/6] pstore: Add event tracing support Message-ID: <20180918164434.472294f3@gandalf.local.home> In-Reply-To: References: <20180917193426.41c99fd5@gandalf.local.home> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 18 Sep 2018 23:22:48 +0530 Sai Prakash Ranjan wrote: > On 9/18/2018 5:04 AM, Steven Rostedt wrote: > > > > It looks like pstore_event_call() gets called from a trace event. You > > can't call kmalloc() from one. One thing is that kmalloc has > > tracepoints itself. You trace those you just entered an infinite loop. > > > > > > Ok will remove it in v2. But any alternative way to do this? I think I describe it below. > > >> + > >> + event_call = fbuffer->trace_file->event_call; > >> + if (!event_call || !event_call->event.funcs || > >> + !event_call->event.funcs->trace) > >> + goto fail_event; > >> + > >> + event = &fbuffer->trace_file->event_call->event; > >> + > >> + spin_lock_irqsave(&psinfo->buf_lock, flags); > >> + > >> + trace_seq_init(&iter->seq); > >> + iter->ent = fbuffer->entry; > > > > I guess what you are doing is needing to translate the raw data into > > ascii output, and need the trace_iterator to do so. > > > > You are already under a psinfo->buf_lock. Add a dummy iterator to that > > and use it instead. > > > > trace_seq_init(&psinfo->iter->seq); > > > >> + event_call->event.funcs->trace(iter, 0, event); > > > > (psinfo->iter, 0 , event); > > > > etc. > > > > Sure, will update in v2. > > >> + trace_seq_putc(&iter->seq, 0); > >> + > >> + if (seq->size > psinfo->bufsize) > >> + seq->size = psinfo->bufsize; > >> + > >> + s = &iter->seq; > >> + seq = &s->seq; > >> + > >> + record.buf = (char *)(seq->buffer); > >> + record.size = seq->len; > >> + psinfo->write(&record); > >> + > >> + spin_unlock_irqrestore(&psinfo->buf_lock, flags); > > > > You may also need to convert these spin_locks into raw_spin_locks as > > when PREEMPT_RT enters the kernel you don't want them to turn into > > mutexes. > > > > But that can be another patch. > > > > I will change this in v2, but can't we have it in same patch? I suggested a separate patch because buf_lock is used elsewhere. Changing it to "raw_spin_lock" will affect more than just what this patch series does. Thus, I recommend making it a separate patch to keep this patch series from being more intrusive than it needs to be. Thanks! -- Steve