From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37267C4727E for ; Wed, 30 Sep 2020 14:42:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 076AE2076B for ; Wed, 30 Sep 2020 14:42:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730642AbgI3Omn (ORCPT ); Wed, 30 Sep 2020 10:42:43 -0400 Received: from mga05.intel.com ([192.55.52.43]:53894 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727426AbgI3Omn (ORCPT ); Wed, 30 Sep 2020 10:42:43 -0400 IronPort-SDR: jcRoI6q5SGmoDIK/6abdi1VB7I6Kh25udhnZq4yTEJqJ3If5t4ZiOrdzgQQt7QjkCim6j6gpGK ZrgMgUr6UZbw== X-IronPort-AV: E=McAfee;i="6000,8403,9759"; a="247188301" X-IronPort-AV: E=Sophos;i="5.77,322,1596524400"; d="scan'208";a="247188301" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Sep 2020 07:42:42 -0700 IronPort-SDR: UoY+gP3YeAAFCcBqgTkKLX15Btld3HEbt6FeqVgXAaTx0FHtAsUUmMXWae7kd7cAYBwZsAlTl2 CqM8ZjKSfolA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,322,1596524400"; d="scan'208";a="339111960" Received: from linux.intel.com ([10.54.29.200]) by fmsmga004.fm.intel.com with ESMTP; 30 Sep 2020 07:42:42 -0700 Received: from [10.255.228.167] (kliang2-MOBL.ccr.corp.intel.com [10.255.228.167]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by linux.intel.com (Postfix) with ESMTPS id 9670B58033E; Wed, 30 Sep 2020 07:42:40 -0700 (PDT) Subject: Re: [PATCH V8 1/4] perf/core: Add PERF_SAMPLE_DATA_PAGE_SIZE To: Stephane Eranian Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , LKML , Mark Rutland , Alexander Shishkin , Jiri Olsa , Andi Kleen , Dave Hansen , kirill.shutemov@linux.intel.com, Michael Ellerman , benh@kernel.crashing.org, Paul Mackerras References: <20200921152653.3924-1-kan.liang@linux.intel.com> <20200921152653.3924-2-kan.liang@linux.intel.com> From: "Liang, Kan" Message-ID: <4e974520-6d0f-68af-7eb8-fa52d95ba77b@linux.intel.com> Date: Wed, 30 Sep 2020 10:42:38 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/30/2020 3:15 AM, Stephane Eranian wrote: >> +static u64 perf_get_page_size(unsigned long addr) >> +{ >> + unsigned long flags; >> + u64 size; >> + >> + if (!addr) >> + return 0; >> + >> + /* >> + * Software page-table walkers must disable IRQs, >> + * which prevents any tear down of the page tables. >> + */ >> + local_irq_save(flags); >> + >> + size = __perf_get_page_size(current->active_mm, addr); >> + > When I tested on my kernel, it panicked because I suspect > current->active_mm could be NULL. Adding a check for NULL avoided the > problem. But I suspect this is not the correct solution. > I guess the NULL active_mm should be a rare case. If so, I think it's not bad to add a check and return 0 page size. Thanks, Kan