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=-2.3 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_MUTT autolearn=ham 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 D430BC28CC0 for ; Wed, 29 May 2019 16:20:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A3C6923D53 for ; Wed, 29 May 2019 16:20:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="lxMf8L/a" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727020AbfE2QUR (ORCPT ); Wed, 29 May 2019 12:20:17 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:37454 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726062AbfE2QUR (ORCPT ); Wed, 29 May 2019 12:20:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=/8pC2Hn7gRhW5G0Og5+C55SRZVyXqzKThTaGW0BzRQ8=; b=lxMf8L/aCTixIWRtMg98J3Lxt b8PXSgP46mpHZs2t+m6S/RKL0XHFa38ogoVlvoC18znOIEd1gMvcsgBdCBDbXlYVQkXeUoWaC+DhZ SoSzdUMeNKu1XbZVTJejnUAqRcOG0kWUyMkkprH79Mt/xlf+tql3yS97Ms+yC4PxuWjnWX+mOESMM yLsmhZFxczk5jGZS2KnhsWE1lFqFiuswbg8dzxQrNdEDA2RmFVblVO165V3b5hHcWhU2AdBe3AtXm qeLOteZs9n92QWvjeS8zm7To5ABvL7uMBkqQYrhVRSM90M1q4L46RnFsYOBDfIwZpReHQpgXF02+7 f3hqBz0ZQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hW1J0-0002Dz-4p; Wed, 29 May 2019 16:19:58 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 0751D201CF1CB; Wed, 29 May 2019 18:19:56 +0200 (CEST) Date: Wed, 29 May 2019 18:19:55 +0200 From: Peter Zijlstra To: Will Deacon Cc: Young Xiao <92siuyang@gmail.com>, linux@armlinux.org.uk, mark.rutland@arm.com, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, x86@kernel.org, kan.liang@linux.intel.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, ravi.bangoria@linux.vnet.ibm.com, mpe@ellerman.id.au, acme@redhat.com, eranian@google.com, fweisbec@gmail.com, jolsa@redhat.com Subject: Re: [PATCH] perf: Fix oops when kthread execs user process Message-ID: <20190529161955.GZ2623@hirez.programming.kicks-ass.net> References: <20190528140103.GT2623@hirez.programming.kicks-ass.net> <20190528153224.GE20758@fuggles.cambridge.arm.com> <20190528173228.GW2623@hirez.programming.kicks-ass.net> <20190529091733.GA4485@fuggles.cambridge.arm.com> <20190529101042.GN2623@hirez.programming.kicks-ass.net> <20190529102022.GC4485@fuggles.cambridge.arm.com> <20190529125557.GU2623@hirez.programming.kicks-ass.net> <20190529130521.GA11023@fuggles.cambridge.arm.com> <20190529132515.GW2623@hirez.programming.kicks-ass.net> <20190529143510.GA11154@fuggles.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190529143510.GA11154@fuggles.cambridge.arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 29, 2019 at 03:35:10PM +0100, Will Deacon wrote: > On Wed, May 29, 2019 at 03:25:15PM +0200, Peter Zijlstra wrote: > > On Wed, May 29, 2019 at 02:05:21PM +0100, Will Deacon wrote: > > > On Wed, May 29, 2019 at 02:55:57PM +0200, Peter Zijlstra wrote: > > > > > > if (user_mode(regs)) { > > > > > > Hmm, so it just occurred to me that Mark's observation is that the regs > > > can be junk in some cases. In which case, should we be checking for > > > kthreads first? > > > > task_pt_regs() can return garbage, but @regs is the exception (or > > perf_arch_fetch_caller_regs()) regs, and for those user_mode() had > > better be correct. > > So what should we report for the idle task? If an interrupt hits the idle task, @regs would be !user_mode(regs), we'll find current->flags & PF_KTHREAD (idle not having passed through exec()) and therefore we'll take ABI_NONE for the user regs. Or am I not getting it? 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=-2.5 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, T_DKIMWL_WL_HIGH,USER_AGENT_MUTT autolearn=ham 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 737B2C28CC0 for ; Wed, 29 May 2019 16:20:14 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 3A7DE23D47 for ; Wed, 29 May 2019 16:20:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="SLvzpbUP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3A7DE23D47 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-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=bombadil.20170209; 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=JfecMD9o8gIfrxP9yY+FaUvpyBeObBdCcFflt3YGvwg=; b=SLvzpbUPyS7D15 bMbW6bV99rE7+OxG1/HHIMaLtfF7XJnpzx1aT+g6eHCds1eDQL8/D19RDu3wb3DA4IGg/S+qPpf28 w7jchTRWmpap2QQQ+6iqmzSIK/gRfi4hNwGNZXE1zhMXeMmkpYvNuQxTdznzikdcwji2QLXST1lar 0tn3XZlPno6G3JeW4C4QKWf5AinSnmM6g0CCipTjdYQLAXqJp4bv+ou+1pOSmnj639l3HFZbfsv5N ib8MRa5dpizOoCMPJquXp3z+BeVLcAQjoAiVomN7cm1Xf9fknj45nE5IpbxbJIbWhMjpYJsyk8tHM mVs4RQtEXrRoKKImPKNA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hW1J4-0002EJ-La; Wed, 29 May 2019 16:20:02 +0000 Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hW1J0-0002Dz-4p; Wed, 29 May 2019 16:19:58 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 0751D201CF1CB; Wed, 29 May 2019 18:19:56 +0200 (CEST) Date: Wed, 29 May 2019 18:19:55 +0200 From: Peter Zijlstra To: Will Deacon Subject: Re: [PATCH] perf: Fix oops when kthread execs user process Message-ID: <20190529161955.GZ2623@hirez.programming.kicks-ass.net> References: <20190528140103.GT2623@hirez.programming.kicks-ass.net> <20190528153224.GE20758@fuggles.cambridge.arm.com> <20190528173228.GW2623@hirez.programming.kicks-ass.net> <20190529091733.GA4485@fuggles.cambridge.arm.com> <20190529101042.GN2623@hirez.programming.kicks-ass.net> <20190529102022.GC4485@fuggles.cambridge.arm.com> <20190529125557.GU2623@hirez.programming.kicks-ass.net> <20190529130521.GA11023@fuggles.cambridge.arm.com> <20190529132515.GW2623@hirez.programming.kicks-ass.net> <20190529143510.GA11154@fuggles.cambridge.arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190529143510.GA11154@fuggles.cambridge.arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, Young Xiao <92siuyang@gmail.com>, mpe@ellerman.id.au, jolsa@redhat.com, x86@kernel.org, linux@armlinux.org.uk, eranian@google.com, linux-kernel@vger.kernel.org, acme@redhat.com, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, ravi.bangoria@linux.vnet.ibm.com, fweisbec@gmail.com, linux-arm-kernel@lists.infradead.org, kan.liang@linux.intel.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, May 29, 2019 at 03:35:10PM +0100, Will Deacon wrote: > On Wed, May 29, 2019 at 03:25:15PM +0200, Peter Zijlstra wrote: > > On Wed, May 29, 2019 at 02:05:21PM +0100, Will Deacon wrote: > > > On Wed, May 29, 2019 at 02:55:57PM +0200, Peter Zijlstra wrote: > > > > > > if (user_mode(regs)) { > > > > > > Hmm, so it just occurred to me that Mark's observation is that the regs > > > can be junk in some cases. In which case, should we be checking for > > > kthreads first? > > > > task_pt_regs() can return garbage, but @regs is the exception (or > > perf_arch_fetch_caller_regs()) regs, and for those user_mode() had > > better be correct. > > So what should we report for the idle task? If an interrupt hits the idle task, @regs would be !user_mode(regs), we'll find current->flags & PF_KTHREAD (idle not having passed through exec()) and therefore we'll take ABI_NONE for the user regs. Or am I not getting it? _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel