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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46F42D111B6 for ; Mon, 4 Nov 2024 07:35:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 555646B0083; Mon, 4 Nov 2024 02:35:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 504496B0085; Mon, 4 Nov 2024 02:35:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3CB7E6B0088; Mon, 4 Nov 2024 02:35:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 1E66D6B0083 for ; Mon, 4 Nov 2024 02:35:58 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 77CF61A14D0 for ; Mon, 4 Nov 2024 07:35:57 +0000 (UTC) X-FDA: 82747602966.04.4FAD75B Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by imf02.hostedemail.com (Postfix) with ESMTP id 582DA80007 for ; Mon, 4 Nov 2024 07:34:55 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b=B0RkwPn3; dmarc=pass (policy=none) header.from=quicinc.com; spf=pass (imf02.hostedemail.com: domain of quic_yingangl@quicinc.com designates 205.220.180.131 as permitted sender) smtp.mailfrom=quic_yingangl@quicinc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730705697; a=rsa-sha256; cv=none; b=2XPesGL8IqQ1rKyk42aJS4zhrOL0FN8IchrukuiVMsE6lLopkIdsD5M4O4i8NtuuLuS02e 18Wmp12EAMRt1MKO3TOpg90thXMzkMisgGn62G0CBw6wu2FXw/VGZYYcVJ5J5jN7zvA958 mkL4Y0mBt/YtY8rcLtOEeWPkr7IdgGs= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b=B0RkwPn3; dmarc=pass (policy=none) header.from=quicinc.com; spf=pass (imf02.hostedemail.com: domain of quic_yingangl@quicinc.com designates 205.220.180.131 as permitted sender) smtp.mailfrom=quic_yingangl@quicinc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730705697; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=v3l5DdxxAOARiur4tbayDd2e4oDk6ZXK0d4TJzUv5ms=; b=YwVNfshOu/1Q+YTqBMbELagypLdelsC2ebT0oCxmoxNljfN93aSeNddYzyBL01ypC2DtJb dv4lcCj5mKSPVrSR7T7MGBpRppVGPSC5mDySTft+iLawoQcrsvnRbtFrl/EdAzm3OLWlz5 B802VxCn+bAX5xqvlQ9JdM/k7PnyG5Q= Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A3NDUPP004484; Mon, 4 Nov 2024 07:35:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= v3l5DdxxAOARiur4tbayDd2e4oDk6ZXK0d4TJzUv5ms=; b=B0RkwPn3JpN4Qn/Z Q7QKui1NnPmlv7NN1wsd2GTETpBudNlwDq91CdjZLxJ7tr2nUuzMuqQbFNyaM2dW 2hoyRs4ChYIVHqzaCd4BVcy0jv3hZPZMbkrmJf92ES9N3GUc1gXHsQ4luEXg4vNG duqNwOwAauVNiHvVELe7VjLUT1CIbFxZ9pIUxz/r0BGW7B0FbTG6VN0pFB3VqQ6K DHyrkEOu6vq5/T+KReGnbanK3vdF64hKEzQSRCFBzYMKWYhmPwE88wtQqRzYr36K vzYMxxwceqV6tV7R/wBwhClTkFsIIdMjNCluXDIi12bZTLjY+qQ8cd8q/Y97bLzb UUHPPg== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 42ncyxud6y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 04 Nov 2024 07:35:45 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 4A47ZgbR005164 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 4 Nov 2024 07:35:42 GMT Received: from [10.232.65.248] (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Sun, 3 Nov 2024 23:35:40 -0800 Message-ID: <55f6332d-3b4c-4478-93f9-514a906e348d@quicinc.com> Date: Mon, 4 Nov 2024 15:35:37 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] trace/events/page_ref: add page info to page_ref trace event To: "Vlastimil Babka (SUSE)" , CC: , , , , , Matthew Wilcox References: <20241031024222.505844-1-quic_yingangl@quicinc.com> <8418b91e-04bb-4b74-96dd-a9489fbf9ba6@kernel.org> Content-Language: en-US From: Kassey Li quic In-Reply-To: <8418b91e-04bb-4b74-96dd-a9489fbf9ba6@kernel.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: q-RO3xvf1_qIewPAKvoIOf2H6y-5coX9 X-Proofpoint-GUID: q-RO3xvf1_qIewPAKvoIOf2H6y-5coX9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 bulkscore=0 impostorscore=0 priorityscore=1501 lowpriorityscore=0 mlxscore=0 phishscore=0 adultscore=0 mlxlogscore=999 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411040066 X-Rspam-User: X-Rspamd-Queue-Id: 582DA80007 X-Rspamd-Server: rspam11 X-Stat-Signature: xqsdhdexzzjrqh69zgixr6xnno9y8bcc X-HE-Tag: 1730705695-614112 X-HE-Meta: U2FsdGVkX1+NmvxMeXd45GeZ/RxPFLGbnwb+WcQyOrwd5YzjQg2K+cA/gJtmAOqYTDBT2QxUTLsDR7xg3DRlSFCz8CgwoDTetEyFN4y508OI0apEVVc0fc2J0+KXmZSoF4jG/x29yesEKwN8MKLud1BzLHTZzfoILCxk9lttoIaR9HojZDqCrnyx0kGSDWFBQZaz79maR1UjGyNjC3ZB23s6Us+aDDsBEx/3+IIop0dObloUq2dm/lI+hWjgg7SFkRr6kScV5RzNXqtEYPvaJEYmAPGci+RXh+I25ZwApWHD3Y0DkBb6whLXaugsEI9HIwo/LOPS+fP3ABnZEmUY3XoW0LVmJ2r7BkzU91t7oNxwOYImdbbmFGBIRB6D3giKozZNTN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vack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 2024/10/31 15:24, Vlastimil Babka (SUSE) wrote: > On 10/31/24 03:42, Kassey Li wrote: >> This followed >> commit 53d884a6675b ("mm, tracing: unify PFN format strings") >> to add page info. >> >> In many kernel code we are talking with page other than pfn, >> here we added page algin with pfn. > How exactly would this help you, what are you doing with the trace? we met some problem where filesystem held the page. we can show the page pointer other than pfn in filesystem code. > >> Signed-off-by: Kassey Li >> --- >> include/trace/events/page_ref.h | 10 ++++++++-- >> 1 file changed, 8 insertions(+), 2 deletions(-) >> >> diff --git a/include/trace/events/page_ref.h b/include/trace/events/page_ref.h >> index fe33a255b7d0..76df13b2a5b3 100644 >> --- a/include/trace/events/page_ref.h >> +++ b/include/trace/events/page_ref.h >> @@ -18,6 +18,7 @@ DECLARE_EVENT_CLASS(page_ref_mod_template, >> >> TP_STRUCT__entry( >> __field(unsigned long, pfn) >> + __field(const struct page *, page) >> __field(unsigned long, flags) >> __field(int, count) >> __field(int, mapcount) >> @@ -28,6 +29,7 @@ DECLARE_EVENT_CLASS(page_ref_mod_template, >> >> TP_fast_assign( >> __entry->pfn = page_to_pfn(page); > pfn is derived from the page, but not subject to KASLR, so in that sense is > better. > If you need to correlate the trace with some other data you obtained that > does contains page pointers, you will have to postprocess the trace with a > pfn_to_page() step, which is rather simple (but you'll need to obtain and > supply the randomized base) or have that other data source give you pfn too. > > The tracepoints should not reveal the randomized base as trivially as they > would do after this patch. ok, thanks for the suggest, I think generally we can try to handle the debug code in our local only. > >> + __entry->page = page; >> __entry->flags = page->flags; >> __entry->count = page_ref_count(page); >> __entry->mapcount = atomic_read(&page->_mapcount); >> @@ -36,8 +38,9 @@ DECLARE_EVENT_CLASS(page_ref_mod_template, >> __entry->val = v; >> ), >> >> - TP_printk("pfn=0x%lx flags=%s count=%d mapcount=%d mapping=%p mt=%d val=%d", >> + TP_printk("pfn=0x%lx page=%p flags=%s count=%d mapcount=%d mapping=%p mt=%d val=%d", >> __entry->pfn, >> + __entry->page, >> show_page_flags(__entry->flags & PAGEFLAGS_MASK), >> __entry->count, >> __entry->mapcount, __entry->mapping, __entry->mt, >> @@ -66,6 +69,7 @@ DECLARE_EVENT_CLASS(page_ref_mod_and_test_template, >> >> TP_STRUCT__entry( >> __field(unsigned long, pfn) >> + __field(const struct page *, page) >> __field(unsigned long, flags) >> __field(int, count) >> __field(int, mapcount) >> @@ -77,6 +81,7 @@ DECLARE_EVENT_CLASS(page_ref_mod_and_test_template, >> >> TP_fast_assign( >> __entry->pfn = page_to_pfn(page); >> + __entry->page = page; >> __entry->flags = page->flags; >> __entry->count = page_ref_count(page); >> __entry->mapcount = atomic_read(&page->_mapcount); >> @@ -86,8 +91,9 @@ DECLARE_EVENT_CLASS(page_ref_mod_and_test_template, >> __entry->ret = ret; >> ), >> >> - TP_printk("pfn=0x%lx flags=%s count=%d mapcount=%d mapping=%p mt=%d val=%d ret=%d", >> + TP_printk("pfn=0x%lx page=%p flags=%s count=%d mapcount=%d mapping=%p mt=%d val=%d ret=%d", >> __entry->pfn, >> + __entry->page, >> show_page_flags(__entry->flags & PAGEFLAGS_MASK), >> __entry->count, >> __entry->mapcount, __entry->mapping, __entry->mt,