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=-4.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 A2A80C433C1 for ; Tue, 23 Mar 2021 10:55:05 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3055C619BA for ; Tue, 23 Mar 2021 10:55:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3055C619BA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=R3Pq6VrGZmj0TETaRhH4d+9NL03o1uFoGr1hPiRm9hg=; b=m9uqzX/Jpg8xRYy6IzrX+zPG7 UePsAwoOzLIcJf2z5Zxo89nh5P+Vksl+M4jO+QeHHc275cefuUl/MEHmXXby0sUsLilZj+uqOU407 YzF8YzKhcTBNL8bqbbtRqVT1BB3/dgzJkYC1WnaUHQXHXHKhPN6ELQKvapMNCjQnZYtBbRswpS18T 5I14tqtm0AHSQ5Iqn1xfo+WbpoNbEHlkkrkDUkv9DNAr8a9doxzwX1n2f04vHGYLyK7HTMzGWbosa ThEhMQvEfVBqHAHW69gLz+cNu/vWRXD3hnYfHMhCvva/IA9NxYiWln9j71uKSHrd6a8NRLy9Aki7i BnPYj8RQA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lOefG-00EfA7-Ag; Tue, 23 Mar 2021 10:53:34 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lOefA-00Ef9K-Vb for linux-arm-kernel@lists.infradead.org; Tue, 23 Mar 2021 10:53:30 +0000 Received: by mail-wr1-x435.google.com with SMTP id 61so20242995wrm.12 for ; Tue, 23 Mar 2021 03:53:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=WGlnCIX+gPkt5saLRl1AO/eSfyQX4KhnrSrkJYnpgYY=; b=lIV8cb4KFfS7wkzFGd10vbdRrumERBd84XwjQG3DjbGuRdwbmikbg0jk61DgpoawxN BBl7QlKsTaJXnPCOF2y6MKlpThqG96Zmz81Yrp+FEZ6nTCt8av7uCsN5iwc29SpdsQSl EiW8j9VDV469niDRLYcAmzwI0D62kxpgUkue6nlgB7GxWnCpKMJp7zKfYmw4LCttdy0W G+gypPOTuKhWasizmui5cLDWk8ApZ/QXiji5JiDhmE2Nqmn2He3ID9hBKFsjODY4B8Q9 b/M0eeC82xya4hZASNOjs2fKQtd+/3nIbS+1xCePGaJtlOEzWWikRqqdme5aVwM8jGf1 rxZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=WGlnCIX+gPkt5saLRl1AO/eSfyQX4KhnrSrkJYnpgYY=; b=OJ6w/vluDluKsIBkRrlm+hdE3IhSY5iKxyWIbLqzGSwR+6mRc8SE9vO/wKgjvo1AIv 6oWGHprpm58WV/gJoqS6ixjv6f4GMqEHJOd8cK2Ez2hj22auCMTCKiqSiv+4uFFNjaha yUqXPPSwqo3JjipaWfm7qUlryXWeshAs8hNf57NyTGYHXWEhCEPDmAtWdYL+pdsLRfSt gWEHwE0cadMm5HhXdzDr4R3ZTNghnIHQYFJA14Do0rY/GSloMyz+XodBys0WLWjx17th mgHJm2lHHuYr8Xog/ahVn/lNfWlhsiQzkeuPic7MW/UXwPmDuN4uD1mAwGVocJNKvxBm F7Mw== X-Gm-Message-State: AOAM532oNpVVdDE6dYnOzvbOekOfkoqUcnFZj6CZOuhoMc3U/pYqTPTc fLlq42aFozVgRqZomLYrIHr1Rg== X-Google-Smtp-Source: ABdhPJxsZ4rfGrv8Gu+78757z6bQt9fLbU/W53+clBFuohI6UOhnceZv0BUdjXF3LdKpnrW2LNNtVA== X-Received: by 2002:a5d:4d01:: with SMTP id z1mr3253375wrt.133.1616496808336; Tue, 23 Mar 2021 03:53:28 -0700 (PDT) Received: from myrica ([2001:1715:4e26:a7e0:116c:c27a:3e7f:5eaf]) by smtp.gmail.com with ESMTPSA id z1sm23063818wru.95.2021.03.23.03.53.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Mar 2021 03:53:27 -0700 (PDT) Date: Tue, 23 Mar 2021 11:53:10 +0100 From: Jean-Philippe Brucker To: "Raj, Ashok" Subject: Re: [PATCH v13 06/10] iommu: Add a page fault handler Message-ID: References: <20210302092644.2553014-1-jean-philippe@linaro.org> <20210302092644.2553014-7-jean-philippe@linaro.org> <20210303055727.GF1914@otc-nc-03> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210303055727.GF1914@otc-nc-03> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210323_105329_161463_C16BA4F8 X-CRM114-Status: GOOD ( 16.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: vivek.gautam@arm.com, guohanjun@huawei.com, zhukeqian1@huawei.com, will@kernel.org, joro@8bytes.org, wangzhou1@hisilicon.com, linux-acpi@vger.kernel.org, zhangfei.gao@linaro.org, lenb@kernel.org, devicetree@vger.kernel.org, kevin.tian@intel.com, jacob.jun.pan@linux.intel.com, eric.auger@redhat.com, robh+dt@kernel.org, linux-arm-kernel@lists.infradead.org, rjw@rjwysocki.net, shameerali.kolothum.thodi@huawei.com, iommu@lists.linux-foundation.org, sudeep.holla@arm.com, robin.murphy@arm.com, linux-accelerators@lists.ozlabs.org, baolu.lu@linux.intel.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Mar 02, 2021 at 09:57:27PM -0800, Raj, Ashok wrote: > > + ret = handle_mm_fault(vma, prm->addr, fault_flags, NULL); > > Should we add a trace similar to trace_page_fault_user() or kernel in > arch/x86/kernel/mm/fault.c Yes that would definitely be useful for debugging hardware and developping applications. I can send a separate patch to add tracepoints here and in the lower-level device fault path. > or maybe add a perf_sw_event() for device faults? It does seem like that would fit well alongside the existing PERF_COUNT_SW_PAGE_FAULTS, but I don't think it would be useful in practice, because we can't provide a context for the event. Since we're handling these faults remotely, the only way for a user to get IOPF events is to enable them on all CPUs and all tasks. Tracepoints can have 'pasid' and 'device' fields to identify an event, but the perf_sw_event wouldn't have any useful metadata apart from the faulting address. We could also add tracepoints on bind(), so users can get the PASID obtained with the PID they care about and filter fault events based on that. I've been wondering about associating a PASID with a PID internally, because we don't currently have anywhere to send SEGV signals for unhandled page faults. But I think it would be best to notify the device driver on unhandled fault and let them deal with it. They'll probably want that information anyway. Thanks, Jean _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel