Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4624779pxk; Wed, 30 Sep 2020 07:44:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztmuY3f6mMFxLJRQXqkSiUfp/cvSdZL07BDjhEn5q8hpiz/0qCkdt3tMjUH8LmXUWV4kmZ X-Received: by 2002:a17:906:9591:: with SMTP id r17mr3220991ejx.424.1601477093056; Wed, 30 Sep 2020 07:44:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601477093; cv=none; d=google.com; s=arc-20160816; b=dYBmrXKHc8/bxFfFAGYdl0OQwyrYYZNlQQ52RV8WGi6YPvmrC77kudO0NlxjAjPt65 r42Il7shG99soK+Sw/LMQPO99slj2aoW5X+vVsZQJUSFf+X+QDofaCwbkPQUFI4zZRnC JT9i7S7Gr+4NQv3meLnDx5Y+v4INQAYO9tAsfQyzfLuzCIAA+gjDf5gtgkZU4Ezy5joE eHGtskshySn8X9GhuA7iAt/kbKL+jpguB5jBT1Vva/AaJNkZ0OEmGbpCBDFkh5YDMHd0 yAzIE3SL3Q6m8Ji95n1rxAif+Mug8JQ0BMC6zw5R30C4dlAhT4Fewx1iZC9Hg2ME7HuH u5Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:ironport-sdr:ironport-sdr; bh=dX0W43favfVt2u0dSr8o3xjmvEyyYQHiQksEXBPsvQU=; b=qhDK0beKgsAZh7bI1s59W/4s3GUeSkgWuQmn5TfmLEjZmQWsBlIdSvbzRd2aC8jC1f NhD53fXFZMGKQOkUJAvCFj42wsUJnPlVvq5uHt53B7GCDqWwbtfqtp9lsP+Q5iwWWLyK /2fxY+TwNruT5FItqZLTBwYDamJJIgudvhrpe4i5Fga2HXF+zQ2f6Qhzsc1Pjl+36kWB 4WDWANi5saKcL4lyfjwlsyx/s05nSXSQt3CQHmXIQtdvZMqSemh3LyrpqWL3hNYnm2NI jRkOVFYY6Tof68SMrSaLL329J3OhLM8VFMRIq6bk38Mcvfa/LEPIhAeBWGZv3Po5kBWx V4xg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r16si1167881edt.192.2020.09.30.07.44.30; Wed, 30 Sep 2020 07:44:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730633AbgI3Omn (ORCPT + 99 others); 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