From patchwork Fri Oct 14 23:58:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 13007532 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 8BEF4C433FE for ; Fri, 14 Oct 2022 23:58:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2D3616B0082; Fri, 14 Oct 2022 19:58:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2837C6B0087; Fri, 14 Oct 2022 19:58:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 172B16B0088; Fri, 14 Oct 2022 19:58:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id EC1AC6B0082 for ; Fri, 14 Oct 2022 19:58:51 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id C0D72160ADD for ; Fri, 14 Oct 2022 23:58:51 +0000 (UTC) X-FDA: 80021222862.19.69FCD41 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by imf20.hostedemail.com (Postfix) with ESMTP id 31B631C002F for ; Fri, 14 Oct 2022 23:58:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1665791931; x=1697327931; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Pn7FRJyA8KXjI8N8cdiRLRmRlb+h9sH/LZ3PlPzj0fI=; b=a845Xy0tmyNu+S0fhW2ZyK0gJDSKyLqs3gDMcb25s1zN9BPiB/UlU9c3 i/gI4BOliIHSf/zhM09rOLDourIr06fOKV+gKTfU1d9RHgv6K8+wCVgSO Qu10qECVA8mj7W/9p7Tni4C+5pFNgzfSZ/b+4ifffgCkWX+x0aOBeS68t 1tss65xuXnHdV5Jpu/wgdBjQRa7wJwVH1gGu/AX9VwX8CAGrnbmgD7U+N JuzBbmfzInJ6TjgHz/U7xjA3be4lqXzol8fXh4Ak5ibzSYiCSzxQsMIJm 5E36F5UPCgs4fIv0B276G7bBEjg7xVEvyOCeo4LnRn38uMoUrIsu38IxC g==; X-IronPort-AV: E=McAfee;i="6500,9779,10500"; a="391802540" X-IronPort-AV: E=Sophos;i="5.95,185,1661842800"; d="scan'208";a="391802540" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2022 16:58:50 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10500"; a="802798957" X-IronPort-AV: E=Sophos;i="5.95,185,1661842800"; d="scan'208";a="802798957" Received: from uyoon-mobl.amr.corp.intel.com (HELO dwillia2-xfh.jf.intel.com) ([10.209.90.112]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2022 16:58:49 -0700 Subject: [PATCH v3 19/25] devdax: Sparse fixes for vm_fault_t in tracepoints From: Dan Williams To: linux-mm@kvack.org Cc: kernel test robot , david@fromorbit.com, hch@lst.de, nvdimm@lists.linux.dev, akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org Date: Fri, 14 Oct 2022 16:58:49 -0700 Message-ID: <166579192919.2236710.12464252412504907962.stgit@dwillia2-xfh.jf.intel.com> In-Reply-To: <166579181584.2236710.17813547487183983273.stgit@dwillia2-xfh.jf.intel.com> References: <166579181584.2236710.17813547487183983273.stgit@dwillia2-xfh.jf.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665791931; a=rsa-sha256; cv=none; b=4bZxJhHt452gM2YKOlmocnMBqFTIPiZ302hRO9AjoaHwFK01SH7OVfcfdmh7TrIn1/sWPe EaB2AWRa5M/ZNbMLA/Ruh8ALCQyahvDIqk9N3/aWkpjQ4gj892yg6y46CZ+8eOyZp+iiz4 I9ys6FYTl7nQ4zhTXtjGsbLDEXyPjI0= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=a845Xy0t; spf=pass (imf20.hostedemail.com: domain of dan.j.williams@intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665791931; 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=xqPf/Eb/8V/604SxGwa9vHERYQ6URyTv+lvpfz+rHDA=; b=Ojm2L9M6pyWCCu3S02y+BpXu/AK7rI4H2mWKRA6y+9fCEWSbsIkUhz6S5unDLB3bWeA+zS 00dIXhee6v7u++hUY68B4b8xWuBETuPKbyebIebOvyCK8ujlpIs2Z3KkBM3JcRPvdUt2Xh Q5YKLkwwRF3lXfepOBwpENLhq8wMG0A= X-Stat-Signature: b853u7c3si3di5yqsbr5jr18qmyfuqyi X-Rspamd-Queue-Id: 31B631C002F X-Rspam-User: X-Rspamd-Server: rspam08 Authentication-Results: imf20.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=a845Xy0t; spf=pass (imf20.hostedemail.com: domain of dan.j.williams@intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (policy=none) header.from=intel.com X-HE-Tag: 1665791930-769931 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Now that the dax-mapping-entry code has moved to a common location take the opportunity to fixup some long standing sparse warnings. In this case the tracepoints have long specified the wrong type for the traced return code. Pass the correct type, but handle casting it back to 'unsigned int' inside the trace helpers as the helpers are not prepared to handle restricted types. Fixes: drivers/dax/mapping.c:1031:55: sparse: warning: incorrect type in argument 3 (different base types) drivers/dax/mapping.c:1031:55: sparse: expected int result drivers/dax/mapping.c:1031:55: sparse: got restricted vm_fault_t drivers/dax/mapping.c:1046:58: sparse: warning: incorrect type in argument 3 (different base types) drivers/dax/mapping.c:1046:58: sparse: expected int result drivers/dax/mapping.c:1046:58: sparse: got restricted vm_fault_t [assigned] [usertype] ret Reported-by: Reported-by: kernel test robot Link: http://lore.kernel.org/r/202210091141.cHaQEuCs-lkp@intel.com Signed-off-by: Dan Williams --- include/linux/mm_types.h | 26 +++++++++++++------------- include/trace/events/fs_dax.h | 16 ++++++++-------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 500e536796ca..910d880e67eb 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -891,19 +891,19 @@ enum vm_fault_reason { VM_FAULT_HWPOISON_LARGE | VM_FAULT_FALLBACK) #define VM_FAULT_RESULT_TRACE \ - { VM_FAULT_OOM, "OOM" }, \ - { VM_FAULT_SIGBUS, "SIGBUS" }, \ - { VM_FAULT_MAJOR, "MAJOR" }, \ - { VM_FAULT_WRITE, "WRITE" }, \ - { VM_FAULT_HWPOISON, "HWPOISON" }, \ - { VM_FAULT_HWPOISON_LARGE, "HWPOISON_LARGE" }, \ - { VM_FAULT_SIGSEGV, "SIGSEGV" }, \ - { VM_FAULT_NOPAGE, "NOPAGE" }, \ - { VM_FAULT_LOCKED, "LOCKED" }, \ - { VM_FAULT_RETRY, "RETRY" }, \ - { VM_FAULT_FALLBACK, "FALLBACK" }, \ - { VM_FAULT_DONE_COW, "DONE_COW" }, \ - { VM_FAULT_NEEDDSYNC, "NEEDDSYNC" } + { (__force unsigned int) VM_FAULT_OOM, "OOM" }, \ + { (__force unsigned int) VM_FAULT_SIGBUS, "SIGBUS" }, \ + { (__force unsigned int) VM_FAULT_MAJOR, "MAJOR" }, \ + { (__force unsigned int) VM_FAULT_WRITE, "WRITE" }, \ + { (__force unsigned int) VM_FAULT_HWPOISON, "HWPOISON" }, \ + { (__force unsigned int) VM_FAULT_HWPOISON_LARGE, "HWPOISON_LARGE" }, \ + { (__force unsigned int) VM_FAULT_SIGSEGV, "SIGSEGV" }, \ + { (__force unsigned int) VM_FAULT_NOPAGE, "NOPAGE" }, \ + { (__force unsigned int) VM_FAULT_LOCKED, "LOCKED" }, \ + { (__force unsigned int) VM_FAULT_RETRY, "RETRY" }, \ + { (__force unsigned int) VM_FAULT_FALLBACK, "FALLBACK" }, \ + { (__force unsigned int) VM_FAULT_DONE_COW, "DONE_COW" }, \ + { (__force unsigned int) VM_FAULT_NEEDDSYNC, "NEEDDSYNC" } struct vm_special_mapping { const char *name; /* The name, e.g. "[vdso]". */ diff --git a/include/trace/events/fs_dax.h b/include/trace/events/fs_dax.h index 97b09fcf7e52..adc50cf7b969 100644 --- a/include/trace/events/fs_dax.h +++ b/include/trace/events/fs_dax.h @@ -9,7 +9,7 @@ DECLARE_EVENT_CLASS(dax_pmd_fault_class, TP_PROTO(struct inode *inode, struct vm_fault *vmf, - pgoff_t max_pgoff, int result), + pgoff_t max_pgoff, vm_fault_t result), TP_ARGS(inode, vmf, max_pgoff, result), TP_STRUCT__entry( __field(unsigned long, ino) @@ -21,7 +21,7 @@ DECLARE_EVENT_CLASS(dax_pmd_fault_class, __field(pgoff_t, max_pgoff) __field(dev_t, dev) __field(unsigned int, flags) - __field(int, result) + __field(unsigned int, result) ), TP_fast_assign( __entry->dev = inode->i_sb->s_dev; @@ -33,7 +33,7 @@ DECLARE_EVENT_CLASS(dax_pmd_fault_class, __entry->flags = vmf->flags; __entry->pgoff = vmf->pgoff; __entry->max_pgoff = max_pgoff; - __entry->result = result; + __entry->result = (__force unsigned int) result; ), TP_printk("dev %d:%d ino %#lx %s %s address %#lx vm_start " "%#lx vm_end %#lx pgoff %#lx max_pgoff %#lx %s", @@ -54,7 +54,7 @@ DECLARE_EVENT_CLASS(dax_pmd_fault_class, #define DEFINE_PMD_FAULT_EVENT(name) \ DEFINE_EVENT(dax_pmd_fault_class, name, \ TP_PROTO(struct inode *inode, struct vm_fault *vmf, \ - pgoff_t max_pgoff, int result), \ + pgoff_t max_pgoff, vm_fault_t result), \ TP_ARGS(inode, vmf, max_pgoff, result)) DEFINE_PMD_FAULT_EVENT(dax_pmd_fault); @@ -151,7 +151,7 @@ DEFINE_EVENT(dax_pmd_insert_mapping_class, name, \ DEFINE_PMD_INSERT_MAPPING_EVENT(dax_pmd_insert_mapping); DECLARE_EVENT_CLASS(dax_pte_fault_class, - TP_PROTO(struct inode *inode, struct vm_fault *vmf, int result), + TP_PROTO(struct inode *inode, struct vm_fault *vmf, vm_fault_t result), TP_ARGS(inode, vmf, result), TP_STRUCT__entry( __field(unsigned long, ino) @@ -160,7 +160,7 @@ DECLARE_EVENT_CLASS(dax_pte_fault_class, __field(pgoff_t, pgoff) __field(dev_t, dev) __field(unsigned int, flags) - __field(int, result) + __field(unsigned int, result) ), TP_fast_assign( __entry->dev = inode->i_sb->s_dev; @@ -169,7 +169,7 @@ DECLARE_EVENT_CLASS(dax_pte_fault_class, __entry->address = vmf->address; __entry->flags = vmf->flags; __entry->pgoff = vmf->pgoff; - __entry->result = result; + __entry->result = (__force unsigned int) result; ), TP_printk("dev %d:%d ino %#lx %s %s address %#lx pgoff %#lx %s", MAJOR(__entry->dev), @@ -185,7 +185,7 @@ DECLARE_EVENT_CLASS(dax_pte_fault_class, #define DEFINE_PTE_FAULT_EVENT(name) \ DEFINE_EVENT(dax_pte_fault_class, name, \ - TP_PROTO(struct inode *inode, struct vm_fault *vmf, int result), \ + TP_PROTO(struct inode *inode, struct vm_fault *vmf, vm_fault_t result), \ TP_ARGS(inode, vmf, result)) DEFINE_PTE_FAULT_EVENT(dax_pte_fault);