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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 394E2C433EF for ; Thu, 11 Nov 2021 07:43:17 +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 E905561058 for ; Thu, 11 Nov 2021 07:43:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E905561058 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc: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=7IZwZ6IctwCmct13NT7GQicjTyIMVLbT/rW0qE0yC9k=; b=LdFoR6RnXSo5Pv vNCdd5OrF3vdRRHqoL1ZKPM4YgfxnCXqy+s9w1MDh8wY3xaqNKfLijp2H1Y8qzksTh1AT5/9U3g7b JEQFnDuf8l1Ta8loLynwZ4qr+YXGKXUjRDAWEXeF6jvgq4wcoPeufFn/wWbMGCcbOW4zV8UFETHLj LOFxbqh0iRHtpqjrVXaCxGxB4skb/JevH+2HLbFyVEetHeCx37lZysW+Ul78n5Kqr5ilCs4VWZPmA rKCoghTe4lNA+p6RRntAmUPw50orDFE9+uyh1Z+Eat5TLQxe2+Xb3uedOlw4altjVuxghszIO+H1A hu7npSQIyWLxNzhPszvg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ml4ig-007QT2-DL; Thu, 11 Nov 2021 07:42:02 +0000 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ml4ic-007QSQ-UG for linux-arm-kernel@lists.infradead.org; Thu, 11 Nov 2021 07:42:00 +0000 Received: by mail-pj1-x102e.google.com with SMTP id o6-20020a17090a0a0600b001a64b9a11aeso4030135pjo.3 for ; Wed, 10 Nov 2021 23:41:58 -0800 (PST) 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=7+rhcaTkRqGXrksV1KrkQX+/11lKGB4rSNkw6aZ3feU=; b=SFc7ApfTJo/1Id/bilYOpJHvAHSAz+s6B9HqcfeVfrUUYRyPpZj3qLLCnjaKTTzNEf aAd2HHp1mzE7IF1jFQGe8Jd95Azk6whOGcCJOmO/r0r4iMZIPfueKo4WVfhf54d4CPX+ tBx0Q/MZ3mdh8hyh6Ii7VHTG8ZGIUa0FFYMLlbGh3wFxQCFeGxIABy8CKYnU64kiMAXu 3+CjW+VOO72eBF77NBigzUUFlFC0AfzrCYLKA/ewLifK5ZZYFldJK5ZFB/CO7nhCUBzQ AkZHHKAH3WscI2iClltVcCb4H3whL1CI9Pn74WxlOTFJS5d9TwHcLm/0jJFzwFEI81JY eChg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=7+rhcaTkRqGXrksV1KrkQX+/11lKGB4rSNkw6aZ3feU=; b=G1j4ysPj6Da4JRQrzZ0loMwfv3KGk2iuQzhGpktXo2wO28vhxhKhfbfYfRalCQQVXr KPqaRYD1u9NlkiCd7qF+7CPKSxCMbY82G8uVgq8BpChvhPeTbljEXPxv7zaKCTfIF9Ug qMhevTV1VF91wEaGLGiI7Atz9e+AzuoPQni30wq2VRQEZNJHt5qVvpLcTRvJHEagUfVa NoieDc/UCwDY/KgbK+Nr2sXRDsAC0TtA5B6zvA9d9d2IG34xEd4COwHy8n6wxsx3GZ3O 3uYUZm02ELjRPoYMAEWFv+oEUdtM76NoZnOpcypkdUrqzG5XvUrr3TxahEQmlevIyL5D FT8Q== X-Gm-Message-State: AOAM531TLZHxBTH2gmn8JJQlFd6Dphb4tdEp/jd9ifPWq0NZKB3jd5PA 58dM4DVairv3JIq2qdWvRWMRvhxe1dBA3rpK X-Google-Smtp-Source: ABdhPJzuIlU+W1onfg7eZyNcx6d89upVYkvhKNj1FnFYAvaogiPWidlW0uXk6SFKaA431owxhypBbQ== X-Received: by 2002:a17:90b:1b4b:: with SMTP id nv11mr24510817pjb.131.1636616517931; Wed, 10 Nov 2021 23:41:57 -0800 (PST) Received: from leoy-ThinkPad-X240s ([148.163.172.147]) by smtp.gmail.com with ESMTPSA id u11sm2014209pfk.152.2021.11.10.23.41.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Nov 2021 23:41:57 -0800 (PST) Date: Thu, 11 Nov 2021 15:41:48 +0800 From: Leo Yan To: Namhyung Kim Cc: German Gomez , linux-kernel , linux-perf-users , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , John Garry , Will Deacon , Mathieu Poirier , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 4/4] perf arm-spe: Support hardware-based PID tracing Message-ID: <20211111074148.GC102075@leoy-ThinkPad-X240s> References: <20211109115020.31623-1-german.gomez@arm.com> <20211109115020.31623-5-german.gomez@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211110_234159_006029_73C3D33A X-CRM114-Status: GOOD ( 14.82 ) 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: , 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 Wed, Nov 10, 2021 at 11:28:48PM -0800, Namhyung Kim wrote: [...] > > +static void arm_spe_set_pid_tid_cpu(struct arm_spe *spe, > > + struct auxtrace_queue *queue) > > +{ > > + struct arm_spe_queue *speq = queue->priv; > > + pid_t tid; > > + > > + tid = machine__get_current_tid(spe->machine, speq->cpu); > > + if (tid != -1) { > > + speq->tid = tid; > > + thread__zput(speq->thread); > > + } else > > + speq->tid = queue->tid; > > + > > + if ((!speq->thread) && (speq->tid != -1)) { > > + speq->thread = machine__find_thread(spe->machine, -1, > > + speq->tid); > > + } > > + > > + if (speq->thread) { > > + speq->pid = speq->thread->pid_; > > + if (queue->cpu == -1) > > + speq->cpu = speq->thread->cpu; > > + } > > +} > > + > > +static int arm_spe_set_tid(struct arm_spe_queue *speq, pid_t tid) > > +{ > > + struct arm_spe *spe = speq->spe; > > + int err = machine__set_current_tid(spe->machine, speq->cpu, tid, tid); > > I think we should pass -1 as pid as we don't know the real pid. AFAICT, I observe one case for machine__set_current_tid() returning error is 'speq->cpu' is -1 (this is the case for per-thread tracing). In this case, if pass '-1' for pid/tid, it still will return failure. So here should return the error as it is. Am I missing anything? Thanks, Leo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel