From owner-svn-src-all@freebsd.org Thu Aug 2 15:50:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD514106AB1A; Thu, 2 Aug 2018 15:50:41 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3E76A8DD5A; Thu, 2 Aug 2018 15:50:41 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w72FoU88010029 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 2 Aug 2018 18:50:33 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w72FoU88010029 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w72FoUer010027; Thu, 2 Aug 2018 18:50:30 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 2 Aug 2018 18:50:30 +0300 From: Konstantin Belousov To: John Baldwin Cc: Ruslan Bukin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r337127 - head/sys/riscv/riscv Message-ID: <20180802155030.GA40119@kib.kiev.ua> References: <201808021213.w72CDqQV065424@repo.freebsd.org> <7842b7e4-d14e-805f-719e-b393fc80b74c@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7842b7e4-d14e-805f-719e-b393fc80b74c@FreeBSD.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Aug 2018 15:50:41 -0000 On Thu, Aug 02, 2018 at 08:16:59AM -0700, John Baldwin wrote: > On 8/2/18 5:13 AM, Ruslan Bukin wrote: > > Author: br > > Date: Thu Aug 2 12:13:52 2018 > > New Revision: 337127 > > URL: https://svnweb.freebsd.org/changeset/base/337127 > > > > Log: > > Don't overwrite tp in set_mcontext(). > > > > This makes libthr/swapcontext_test:swapcontext1 happy. > > > > Sponsored by: DARPA, AFRL > > This seems a bit odd. Is get_mcontext() not setting gp_tp correctly, or is > makecontext() not preserving it perhaps? > > In general I feel like we should be saving/restoring 'tp' in the trapframe > on kernel entry/exit like other GPRs instead of in the pcb and then > including it in 'struct reg'. This makes it possible for debuggers to > handle TLS variables more sanely (and in general we need to fix the various > struct reg in FreeBSD architectures to include TLS registers when possible, > such as adding fs_base and gs_base on x86). It would be nice if RISC-V > started off on the correct foot here. I wanted to do this on x86, but I gave up due to the ABI issues. When FSGSBASE instructions are supported on amd64, we save base on context switch and restore on return to usermode.