Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2362971rwd; Mon, 15 May 2023 10:33:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5eoAmfeP5HTX1xU+zUYqmHnWBp0+jxzcKq80Z4m9sz6l1+NvgDUtGl4lamDxAG0PB87erE X-Received: by 2002:a05:6a20:8426:b0:101:90e:c0cb with SMTP id c38-20020a056a20842600b00101090ec0cbmr31212664pzd.59.1684172012445; Mon, 15 May 2023 10:33:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684172012; cv=none; d=google.com; s=arc-20160816; b=GzOfvI/Std2XPotF41o87McFBJRflTxtiHe4r25ahmRe+b7gc9l8kbd8c3c0tnHtgc 9kK/rUn1oxuLUxcea3f67A/9yF1Jl2K4ujIJA/ZuJ1+2s7GJtUwdy5Ku9uzNLNMnhd67 ByDKhBG2GLa05dr4JYhEmUuZebsMZ1Yn69tuVwx0F8rbLrH1LKhqqiZkrYQMNh2W9qcE 9H1siP/nGsH8OSoG0MQKn6Fz5sWUzpnGhcn8kAUvtPi4KhsjPpAh5/tZqz57TDPkt/5R Smsqqr4yiB2+DXJ20fZudwbI7QvT+87SFFPPQjeeI3L8VIKwXFLlNal4glXqrb4pdH5K ZezQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=HPSDCbAJaSJHqp9bvCCU6QEMLH8oL/k1JBrURKr01CE=; b=L0gprF4pqaS2e47NhSamxYQIE7QZpH8UjMn0vCs2am+/likArhNoKjCusotV5HTFMe 5wutSCiEROljcyTjMaAWFX6TFafxdB8De33vM2VF3Rw9xrW1lYlb1E04gPcSLMALc924 m8JaFZU0lPUsJvcEO4fOFvtDaHF0BbuZWCb/5qJ1NkBlXYu1l/sIwFGDdF+sEP0SC4tP R98AdPvc7BP0Uj9NERAttZyhsZ5sHHaiS6qEnVXu8XporG2GkdLOrulzZYE2CS1d118P 9IGr0QyG/7yfjpky6XaAwG6yAagIIKQpHh54AgSjsiXN5BYZrW0pjgrO8QQhDVFRVCFR azGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=TB4BLtFI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lb7-20020a17090b4a4700b002504e81b47fsi17060pjb.168.2023.05.15.10.33.20; Mon, 15 May 2023 10:33:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=TB4BLtFI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243766AbjEORLO (ORCPT + 99 others); Mon, 15 May 2023 13:11:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243742AbjEORKz (ORCPT ); Mon, 15 May 2023 13:10:55 -0400 Received: from mail-qt1-x832.google.com (mail-qt1-x832.google.com [IPv6:2607:f8b0:4864:20::832]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DA119EF4 for ; Mon, 15 May 2023 10:09:04 -0700 (PDT) Received: by mail-qt1-x832.google.com with SMTP id d75a77b69052e-3f51ea3a062so274811cf.1 for ; Mon, 15 May 2023 10:09:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1684170544; x=1686762544; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=HPSDCbAJaSJHqp9bvCCU6QEMLH8oL/k1JBrURKr01CE=; b=TB4BLtFI1tz91N9s2QNL8l0KaCb+S7VRtlq/WOORzRwH4RuLCH00uqSo1mhrgF3zfF 8dbtPA3e+3sJlkD/s1KPx644TpVTxY7wEyF7bch8f/kWX8liFN/wUd/kQg7Ehm0egOcQ QwVuogBvMd135SPuF/uXDEa26KDaYIWLecbLrj6A2FQsvRdisHMCvVMXwvpcbemYTldg dbOYyd2jrAcRU48ZJtK3djZqQqOG9auOxgGVq40DvEOoFYBFJUwxwN9uwDEUjSbCpYx4 fMY+TWtWPTr/Gw4h+bxqhZHsnpzqf3BqQBE06BmxkTFD9EoPajCPz9u6r5qlYY4Bs4V8 zz1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684170544; x=1686762544; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HPSDCbAJaSJHqp9bvCCU6QEMLH8oL/k1JBrURKr01CE=; b=E7Z9j0/fZMG1Z3rjJmLpcxYEuhlJWfTpS/IY97gcumAK5A+0ROKfzDnn4GLfEqfXQM L+Lvpn4mrFs680p12LssH13nuAar3NZid2Cf06zDY6tPz6BCwxpml8/EyMsrFgqCBRar BcHA63pg5hI0AwTr/R53nnn9fOHqxpXbo6eU9WFaMa6igbAB7fI3ZJCi0TfBXw8ONDiU dhktscb9hFuGMB1IWkMAHNJbnFgqHLkqDO3Bdf6nAFFDP0ShOfAsNvz9nAOT7OsAaXHh xIW1beKS5wnS5sCO3BYnalI44XOll79KokxCcMpFVZdNeOS4GnF8Zy7Dkqj+XHAGAg7w BXkQ== X-Gm-Message-State: AC+VfDwLp9tBAI2yIbvy+Z1YdGkaMqSSuPj8u+UG60OlVoYA6hOGgG+i RPNbstrcmQ3WsWemyghVzdjjnUm/P+R+wdAQ7kJ1Wg== X-Received: by 2002:a05:622a:1887:b0:3ed:210b:e698 with SMTP id v7-20020a05622a188700b003ed210be698mr1287918qtc.7.1684170543955; Mon, 15 May 2023 10:09:03 -0700 (PDT) MIME-Version: 1.0 References: <20230511062725.514752-1-namhyung@kernel.org> <20230511062725.514752-2-namhyung@kernel.org> In-Reply-To: <20230511062725.514752-2-namhyung@kernel.org> From: Ian Rogers Date: Mon, 15 May 2023 10:08:52 -0700 Message-ID: Subject: Re: [PATCH 2/3] perf annotate: Parse x86 SIB addressing properly To: Namhyung Kim Cc: Arnaldo Carvalho de Melo , Jiri Olsa , Adrian Hunter , Peter Zijlstra , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org, Andi Kleen Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 10, 2023 at 11:27=E2=80=AFPM Namhyung Kim = wrote: > > When the source argument of mov instruction is look like below, it didn't > parse the whole operand and just stopped at the first comma. > > mov (%rbx,%rax,1),%rcx > > Fix it by checking the parentheses and move it to the closing one. > > Signed-off-by: Namhyung Kim Acked-by: Ian Rogers Thanks, Ian > --- > tools/perf/util/annotate.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c > index ca9f0add68f4..6053ddf9c32d 100644 > --- a/tools/perf/util/annotate.c > +++ b/tools/perf/util/annotate.c > @@ -550,6 +550,19 @@ static int mov__parse(struct arch *arch, struct ins_= operands *ops, struct map_sy > return -1; > > *s =3D '\0'; > + > + /* > + * x86 SIB addressing has something like 0x8(%rax, %rcx, 1) > + * then it needs to have the closing parenthesis. > + */ > + if (strchr(ops->raw, '(')) { > + *s =3D ','; > + s =3D strchr(ops->raw, ')'); > + if (s =3D=3D NULL || s[1] !=3D ',') > + return -1; > + *++s =3D '\0'; > + } > + > ops->source.raw =3D strdup(ops->raw); > *s =3D ','; > > -- > 2.40.1.521.gf1e218fcd8-goog >