Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp5500060rdb; Sat, 16 Sep 2023 22:30:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFsZ/duV3sqaDKrrmMyw8igUVeBhu/wY81nIrGJWON1Bo8SFbCt0rV2qcZmJdh5HKGXvD8J X-Received: by 2002:a05:6e02:1ca5:b0:349:849d:bdf7 with SMTP id x5-20020a056e021ca500b00349849dbdf7mr8959285ill.17.1694928604462; Sat, 16 Sep 2023 22:30:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694928604; cv=none; d=google.com; s=arc-20160816; b=qYhmMmnG5JMySfAYQDWy9LIrG97pvCFLgRvPMwrW2flcCK7lR0T8vGdZubPIwNEj/B F73qt5/d/6m+8+P4UFx/fWA7emM+PMSmtRwSbnj1mzT8NCMh6uTwN73M/kgnAIW2X9mU DuRnDMkpFnxiWckp9zSQ3kg1MPzeJPnSzNahg7pNv1yoXD8yU9uM99uomAuubO5hinFo D/ft8k6V/6+zay9e9djDf+HI1O18OMKSYamnkz+5OCnLQiQ3bmrCWShUrQtEOucKpI0f pq4hABj1FkSnm7gxM/V3JyA6vx3xNxfjpDWhUaIld2xXXw2hwx/iR2KO9YsfjPCEriqN w9eA== 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; bh=SEgA8/O/Y795rlU53R+0E1gtTTzvBuS9hdfmlYnBixg=; fh=j1lfiP8DFHyCeKw1I9nSTJgVONJmpfKv11tm3YWZ3tw=; b=da+p/GAjU3ckf2TXazfT9z9wHXEB6kGf0WHKfdkOofTbFwShpyTX5UjFzup/f0EDTp 1xM/FTTt+ShxMjocDqGoJbqW6e/A98iytn7Am16tzqtyCV9VLTNOVBt4fZp7I0UAo7TQ DRbltxewFSBWCycn+RAoIJ/FjSYalrIXEVl+Jyoc0am/48AmA/Efta4lOdDUqh39s0qs hVJlerKJKyN68BbFosbpDbi7emaeXHUdSP5CWZsDiQWbHECnfbEI5pjYloqHNuU3UfNy BwRYEjp5BZdBg03PzXcNhGteus3yDgTRZ5kdroCXdPE03/D7OVziIFe+8rcfy9UnVrCL MTrg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id b9-20020a633409000000b0055c786fbccesi6177714pga.157.2023.09.16.22.30.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 22:30:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id BC92482A8370; Sat, 16 Sep 2023 22:30:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231889AbjIQF3b convert rfc822-to-8bit (ORCPT + 99 others); Sun, 17 Sep 2023 01:29:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231315AbjIQF3C (ORCPT ); Sun, 17 Sep 2023 01:29:02 -0400 Received: from mail-io1-f45.google.com (mail-io1-f45.google.com [209.85.166.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61C961A1; Sat, 16 Sep 2023 22:28:57 -0700 (PDT) Received: by mail-io1-f45.google.com with SMTP id ca18e2360f4ac-79536bc6697so118412239f.1; Sat, 16 Sep 2023 22:28:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694928536; x=1695533336; 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=/MHIZkZeAIKnnl1lZGJ/D+rrsmVGORmOG4/glxjZ15E=; b=TfoM8lcHe1ADxDB8c9W1HYknxELZ/3auTLDY2k99+u0zHQyj2U76x4W5xP1AzV2Ek2 w0x0P/L0tUmgW8nqDTq5Lqzqhgt9UlBQRbXJhrhz9wYEI5qYqq8zPV8fleNrgiiTaztG /zZsDhQB/Y6Ru1PLQEnDhYVIJXZCoWC/RXd7DHSeys9UKltIHmiLp3epfGT5mMAjCeOi 7VCULjoiR8ykTGswjoKztKhb8Qfrj5vNDbXpDoS7GxDHWATVOXs4uXizcRxjcb/Eak72 1uQKy7NdQ5Lt1iObObb5GpldXL1YiOSmqceUiecywRXcO97V0S7PXDUJz5yhjEW5mlZA M1bg== X-Gm-Message-State: AOJu0YwDF+UbAUDhHDJG5AxI4H22RyIeGLHrE0NWyOOjdbrkl4syGyQ6 AbCah43g9bB5TQNytfmE39I6CeO/f0yIAUtSCeE= X-Received: by 2002:a6b:5c18:0:b0:795:16b8:85fc with SMTP id z24-20020a6b5c18000000b0079516b885fcmr6619462ioh.0.1694928536589; Sat, 16 Sep 2023 22:28:56 -0700 (PDT) MIME-Version: 1.0 References: <20230908052216.566148-1-namhyung@kernel.org> In-Reply-To: From: Namhyung Kim Date: Sat, 16 Sep 2023 22:28:44 -0700 Message-ID: Subject: Re: [PATCH] perf annotate: Add more x86 mov instruction cases To: Ian Rogers Cc: David Laight , Arnaldo Carvalho de Melo , Jiri Olsa , Adrian Hunter , Peter Zijlstra , Ingo Molnar , LKML , "linux-perf-users@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Sat, 16 Sep 2023 22:30:01 -0700 (PDT) On Wed, Sep 13, 2023 at 4:24 PM Ian Rogers wrote: > > On Wed, Sep 13, 2023 at 2:14 PM Namhyung Kim wrote: > > > > On Mon, Sep 11, 2023 at 1:12 AM David Laight wrote: > > > > > > From: Namhyung Kim > > > > Sent: 09 September 2023 00:56 > > > > > > > > Hi Ian, > > > > > > > > On Thu, Sep 7, 2023 at 11:24 PM Ian Rogers wrote: > > > > > > > > > > On Thu, Sep 7, 2023 at 10:22 PM Namhyung Kim wrote: > > > > > > > > > > > > Instructions with sign- and zero- extention like movsbl and movzwq were > > > > > > not handled properly. As it can check different size suffix (-b, -w, -l > > > > > > or -q) we can omit that and add the common parts even though some > > > > > > combinations are not possible. > > > > > > > > > > > > Signed-off-by: Namhyung Kim > > > > > > --- > > > > > > tools/perf/arch/x86/annotate/instructions.c | 9 ++++++--- > > > > > > 1 file changed, 6 insertions(+), 3 deletions(-) > > > > > > > > > > > > diff --git a/tools/perf/arch/x86/annotate/instructions.c > > > > b/tools/perf/arch/x86/annotate/instructions.c > > > > > > index 5f4ac4fc7fcf..5cdf457f5cbe 100644 > > > > > > --- a/tools/perf/arch/x86/annotate/instructions.c > > > > > > +++ b/tools/perf/arch/x86/annotate/instructions.c > > > > > > @@ -74,12 +74,15 @@ static struct ins x86__instructions[] = { > > > > > > { .name = "movdqa", .ops = &mov_ops, }, > > > > > > { .name = "movdqu", .ops = &mov_ops, }, > > > > > > { .name = "movsd", .ops = &mov_ops, }, > > > > > > - { .name = "movslq", .ops = &mov_ops, }, > > > > > > { .name = "movss", .ops = &mov_ops, }, > > > > > > + { .name = "movsb", .ops = &mov_ops, }, > > > > > > + { .name = "movsw", .ops = &mov_ops, }, > > > > > > + { .name = "movsl", .ops = &mov_ops, }, > > > > > > > > > > In Intel's manual some of these names are "Move Data From String to > > > > > String" operations, movsb and movsw in particular. These instructions > > > > > can be used to make simple memcpy loops. Could it be the past omission > > > > > was deliberate due to the different way the addressing works in the > > > > > instructions? > > > > > > > > I don't know but in terms of instruction parsing, they are the same > > > > "MOVE" with two operands. I'm not aware of anything in perf with > > > > the operands of these instructions. So I guess it'd be fine to add > > > > these instructions even if they have different underlying behaviors. > > > > > > I'm pretty sure that 'rep movs[bwlq]' (aka while (cx--) *di++ = *si++) > > > is likely to be missing the memory argument parameters. > > > There is also 'fun and games' with one variant - iirc 'rep movsd' > > > what has been used for 64bit, but got hijacked by one of the SIMD sets. > > > > It seems perf annotate don't process the rep prefix yet. > > So I think there should be no functional change now. > > Reading the code, I also think it should be okay. Doing: > ``` > $ objdump -d /usr/lib/x86_64-linux-gnu/libc.so.6 |grep rep > 2650a: f3 ab rep stos %eax,%es:(%rdi) > 33b76: f3 48 a5 rep movsq %ds:(%rsi),%es:(%rdi) > ... > ``` > The mov parsing logic doesn't appear to care about src and dest, and > the formatting above matches other mov cases. > > Reviewed-by: Ian Rogers Applied to perf-tools-next, thanks! Namhyung