Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp155379pxa; Tue, 4 Aug 2020 19:49:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPOuM7FbO35HdxWj6miCW1TkzPmbasSeIjRC26ZD599GwNER68aZC6FhPM5CvhAHqxGPMl X-Received: by 2002:a17:906:6bc9:: with SMTP id t9mr1090318ejs.372.1596595791939; Tue, 04 Aug 2020 19:49:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596595791; cv=none; d=google.com; s=arc-20160816; b=TRD00GzDElZMHUzen4Nhferrvhm8te1nanH/mMtvCN03KG2ZDyxoGpGLvnvKH2eVUS DUoLZ4GjZAJZ0xtuP9H0uGAGlD7Fv7TOyr7PfU5qqL+gaWYyxydnp8bgFjFItckF+UT/ lTOinQxYaJEdGCGHtxYpGsB0jMWtcEtc2CYKwH2IkhYuY2oz3k29I7rGnpIAm6koCS5i IXaJE0qG01jRn+aI2H23LNYsGvjpJ3b3z8GAp6bJxzadYKt+xtC2lKXa27oRFn0wVHm2 PqW9Uw5e39X/YrWF/MTCW5KLTWTy2l7MZRhz2BrjNvD4IUcykwVQ0AARhWA8OONtu8Uy slbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=5EfpsNXxVoEhN8BcLuYPO9f5oO2WJspR+NGXwJ3g6SU=; b=t9oLBlF+yBpwWjIlWUZ93HKzRik6xTqdQ3caS2CrF6rc5iQ1W0xMu6WSOeEYsHiOP3 cKNFam+qBqXPjsSvMbzF5gelwheoPtk6p8586U9tYvsqNQ0RHQC6ZdbNag/YRD0/3AQe Dp4r3bk11jrCVxucd6REMWLypec6egj/ljRHBOSAxGssbHNPBoQ1rHDvT2IXf7Yw9Fxm FfMQ2vit4WY1W/IsYDiL4cS6jJODf0Vd4sL4jfVW+Cuk7kFWc3GD74IGJ6tGTs+8P7ir y5O1YLq7vEOnyebY7pwLSMEeYgyMOJHr9C+yM08FI+Ejloph3v51reSGt02acUQ8zEzd r/CQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dm21si396370edb.602.2020.08.04.19.49.29; Tue, 04 Aug 2020 19:49:51 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727074AbgHECsO (ORCPT + 99 others); Tue, 4 Aug 2020 22:48:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726130AbgHECsO (ORCPT ); Tue, 4 Aug 2020 22:48:14 -0400 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2986C06174A; Tue, 4 Aug 2020 19:48:13 -0700 (PDT) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1k39TL-009Y7j-1q; Wed, 05 Aug 2020 02:48:07 +0000 Date: Wed, 5 Aug 2020 03:48:07 +0100 From: Al Viro To: Palmer Dabbelt Cc: macro@wdc.com, linux-riscv@lists.infradead.org, Paul Walmsley , aou@eecs.berkeley.edu, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH 1/2] riscv: ptrace: Use the correct API for `fcsr' access Message-ID: <20200805024807.GM1236603@ZenIV.linux.org.uk> References: <20200805020745.GL1236603@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 04, 2020 at 07:20:05PM -0700, Palmer Dabbelt wrote: > On Tue, 04 Aug 2020 19:07:45 PDT (-0700), viro@zeniv.linux.org.uk wrote: > > On Tue, Aug 04, 2020 at 07:01:01PM -0700, Palmer Dabbelt wrote: > > > > > > We currently have @start_pos fixed at 0 across all calls, which works as > > > > a result of the implementation, in particular because we have no padding > > > > between the FP general registers and the FP control and status register, > > > > but appears not to have been the intent of the API and is not what other > > > > ports do, requiring one to study the copy handlers to understand what is > > > > going on here. > > > > start_pos *is* fixed at 0 and it's going to go away, along with the > > sodding user_regset_copyout() very shortly. ->get() is simply a bad API. > > See vfs.git#work.regset for replacement. And ->put() is also going to be > > taken out and shot (next cycle, most likely). > > I'm not sure I understand what you're saying, but given that branch replaces > all of this I guess it's best to just do nothing on our end here? It doesn't replace ->put() (for now); it _does_ replace ->get() and AFAICS the replacement is much saner: static int riscv_fpr_get(struct task_struct *target, const struct user_regset *regset, struct membuf to) { struct __riscv_d_ext_state *fstate = &target->thread.fstate; membuf_write(&to, fstate, offsetof(struct __riscv_d_ext_state, fcsr)); membuf_store(&to, fstate->fcsr); return membuf_zero(&to, 4); // explicitly pad } user_regset_copyout() calling conventions are atrocious and so are those of regset ->get(). The best thing to do with both is to take them out of their misery and be done with that. Do you see any problems with riscv gdbserver on current linux-next? If not, I'd rather see that "API" simply go away... If there are problems, I would very much prefer fixes on top of what's done in that branch.