From owner-freebsd-current@FreeBSD.ORG Wed Apr 6 10:21:48 2011 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED335106566B; Wed, 6 Apr 2011 10:21:48 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 5140B8FC19; Wed, 6 Apr 2011 10:21:47 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p36ALivx046491 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 6 Apr 2011 13:21:44 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id p36ALiBE086780; Wed, 6 Apr 2011 13:21:44 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p36ALh0E086779; Wed, 6 Apr 2011 13:21:43 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 6 Apr 2011 13:21:43 +0300 From: Kostik Belousov To: Julian Elischer Message-ID: <20110406102143.GG78089@deviant.kiev.zoral.com.ua> References: <4D9BBED1.3070402@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="lJV3HQ6fE/Jb65V8" Content-Disposition: inline In-Reply-To: <4D9BBED1.3070402@freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_05, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: FreeBSD Current Subject: Re: kernel thread creation cleanup X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2011 10:21:49 -0000 --lJV3HQ6fE/Jb65V8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 05, 2011 at 06:16:01PM -0700, Julian Elischer wrote: > I was just looking in the thread creation code after most of a decade =20 > NOT looking at it.. > boy we really need to go through there with a broom.. the cobwebs are=20 > getting thick. > Like we always call the code to put an upcall, even though we don't=20 > have upcalls any more, cpu_set_upcall() probably could be renamed to cpu_init_thread(), and cpu_set_upcall_kse() is better named cpu_init_thread_for_user(). IMO, rename would only add a code churn. > and we always create an trap frame on the stack even when we are=20 > making kernel threads > that don't need it, actually, come to think of it DOES fork even need=20 > it? (need to go look) Trap frame for the new thread that is going to usermode after fork is definitely needed. Having fork trampoline executed for all threads is good, because it provides a convenient single point which is passed by all new threads. > and we go through the fork trampoline even when we are doing kthread=20 > creation and could just as well go > directly to the final function directly. (All of the above on amd64).. > May be slighly different on other hardware, though much of it is=20 > encoded in MI code so probably not. >=20 >=20 >=20 > This came from looking to see if I could somehow munge the stack to=20 > convince kgdb to damn well stop at > that point (still failed. if anyone has ideas... :-) Was it for amd64 ? I think the issue with kgdb is lack of the proper dwarf annotations for trampoline. --lJV3HQ6fE/Jb65V8 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk2cPrcACgkQC3+MBN1Mb4hbOwCfYpPG2Wv55PpHULAxErxmodT5 2U4AoMH9El6cFfmpwicOmHZKj9co49vb =rrFp -----END PGP SIGNATURE----- --lJV3HQ6fE/Jb65V8--