Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp93585pxk; Tue, 22 Sep 2020 20:03:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxiNZJg5wQXsUbLzjX4blh0ilznRkwqHYC8JhkSqdLXUm4W3cFA+1cSAhy/GmEhxoPGyt+J X-Received: by 2002:a05:6402:1710:: with SMTP id y16mr7601326edu.197.1600830205065; Tue, 22 Sep 2020 20:03:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600830205; cv=none; d=google.com; s=arc-20160816; b=UmqrGFAHXKQvdhBNtiqXgYsb3cOYCbbYB99WADUaUvnEY9uBpX8/dRPPg43OwF5QQy lJYyPBrvnS1aBicw3Pl92EJlFcn+Nzt0dPYaQdqYp7x5uaKT/aJBTU+MfHbGxOu/bi9N AdpqkZIKI1MMyTodaYpd+T4nn2gviAjeUEDsBzyrYh9zhPLtwXW74Zwk0wdsN6b5V6Iw gEoqcVlZ0afXkUZvaxaLqrAR6ligSc+0ywqA7GZqAROMWlemclJ8R+hpcz6FT/O9pZI+ u5eH6L/cO0fcBTnKs9Co2OOIdcx2BD8Y4kqo9bs0K3vAfzn0p35FUdlUEXFgPcgQ55I7 g70w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=uouXaGqAMObDsmFkHzgkrpaRCiIZ0JKwlvvMyXtQekw=; b=RDhQLglMyAJYT04wV59Gj4rvD1e5x564YPuQdPalj/ovp1semr0kg8+miODmPBfwsx A/CDorCu2jH0NYzJZKzc4ySLE/tc/9uHUWJdCkgaTUhasbuQ+A8ctn4s1lYyKyoEYa1c czT7k7EF6XEg+6ur9h7VBHsCQ3DmFuFR6BYwZmzbGsg7LCoP1mZ7yJvciWrOqBJJg/HR kHpDFbUc5bRAcD2NtjgUVESTlFgw0zitWGlcK7Vz4FRSyvZduxHQqSSfQRteT1kOBvsl 1JB7OAz2Tu6Kpk9xbysI6/mvnjOGoLqddyrTrs5qdAAN3K+INh4+dpOtAQnmq2PIEb8o 95Kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zi5nibJF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id md20si11879721ejb.439.2020.09.22.20.03.01; Tue, 22 Sep 2020 20:03:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zi5nibJF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727250AbgIWChp (ORCPT + 99 others); Tue, 22 Sep 2020 22:37:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:60888 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726548AbgIWCho (ORCPT ); Tue, 22 Sep 2020 22:37:44 -0400 Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 238E4208E4; Wed, 23 Sep 2020 02:37:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600828664; bh=d4izl6dpSSYawdeLLlt3GvL/MMWMQbopA3NyOdIHh5A=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=zi5nibJFbvIqHGkgQMhexiquJmRx3G3mVy4JHZLSogWQROBEjHSpDHaF/GOSq8My6 vZDgDweFrVq4jP/hXMJRfBFKp9m2twROmTVq7Z4gYz7hIWSsUMO6+CBBpssxTgkobc V6NwSrcw8opA3zrPWHbrJ5nl6BZY7cARb9Lz899A= Received: by mail-lj1-f178.google.com with SMTP id c2so15859691ljj.12; Tue, 22 Sep 2020 19:37:44 -0700 (PDT) X-Gm-Message-State: AOAM530e9cC3t/LJMFtlbbZAfZeZJflDhSZ3WsMwot2c/mviw29EsPCb o4T3WilWl8OS6kmxpk2zCamKf6dsO4+X8QhUmIM= X-Received: by 2002:a2e:e1a:: with SMTP id 26mr2231873ljo.377.1600828662321; Tue, 22 Sep 2020 19:37:42 -0700 (PDT) MIME-Version: 1.0 References: <20200922091505.471-1-zhenzhong.duan@gmail.com> <20200922162901.GA3421308@ZenIV.linux.org.uk> <20200923002315.GC3421308@ZenIV.linux.org.uk> In-Reply-To: <20200923002315.GC3421308@ZenIV.linux.org.uk> From: Guo Ren Date: Wed, 23 Sep 2020 10:37:31 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] csky: Fix a size determination in gpr_get() To: Al Viro Cc: Zhenzhong Duan , Linux Kernel Mailing List , linux-csky@vger.kernel.org, Oleg Nesterov Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 23, 2020 at 8:23 AM Al Viro wrote: > > On Wed, Sep 23, 2020 at 08:03:20AM +0800, Guo Ren wrote: > > Thx Duan, > > > > Acked-by: Guo Ren > > > > Hi AI, > > > > I found the broken commit still has a question: > > > > > commit dcad7854fcce6a2d49b6a3ead5bbefeff047e559 > > > Author: Al Viro > > > Date: Tue Jun 16 15:28:29 2020 -0400 > > > > > csky: switch to ->regset_get() > > > > > NB: WTF "- what the fuck :(" is fpregs_get() playing at??? > > The fpregs_get() is for REGSET_FPR regset used by ptrace (gdb) and all > > fp regs are stored in threads' context. > > So, WTF question for? > > The part under > #if defined(CONFIG_CPU_HAS_FPUV2) && !defined(CONFIG_CPU_HAS_VDSP) > > What's going on there? The mapping is really weird - assuming > you had v0..v31 in the first 32 elements of regs->vr[], you > end up with > > v0 v1 v2 v3 v2 v3 v6 v7 v4 v5 v10 v11 v6 v7 v14 v15 > v8 v9 v18 v19 v10 v11 v22 v23 v12 v13 v26 v27 v14 v15 v30 v31 > > in the beginning of the output. Assuming it is the intended > behaviour, it's probably worth some comments... FPU & VDSP use the same regs. 32 FPU regs' width is 64b and 16 VDSP regs' width is 128b. vr[0], vr[1] = fp[0] & vr[0] vr[1], vr[2], vr[3] = vdsp reg[0] ... vr[60], vr[61] = fp[15] & vr[60] vr[61], vr[62], vr[63] = vdsp reg[15] vr[64], vr[65] = fp[16] vr[66], vr[67] = fp[17] ... vr[94], vr[95] = fp[31] Yeah, this is confusing and I'll add a comment later. -- Best Regards Guo Ren ML: https://lore.kernel.org/linux-csky/