From owner-freebsd-hackers@FreeBSD.ORG Wed Mar 11 15:19:58 2015 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 99E3B813 for ; Wed, 11 Mar 2015 15:19:58 +0000 (UTC) Received: from mail-wg0-x235.google.com (mail-wg0-x235.google.com [IPv6:2a00:1450:400c:c00::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 22DDACAF for ; Wed, 11 Mar 2015 15:19:58 +0000 (UTC) Received: by wghk14 with SMTP id k14so9993716wgh.7 for ; Wed, 11 Mar 2015 08:19:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=5erSJKJNHKZqFqp5+9AUmm0Tlg6N00nhwRGzPHoQwp8=; b=P2Ki2GojbdldePb2s5iF8N1lOzDb5io86rTrtqml1oghGL5GPjIroYDJaDiU3Ov2tz GlYCryRvhVA2MgXtgEQk8mR4SDiMXH1yVNvB5r+6Yi1tKNU3vnbtLR6tEKrUCtYvMqEW emncimOsvXAgj60k8YZGNVA3Jj9Tr7s7BhFTrew+gXv+bBQ8f13joT2H1kLV3+qOORJz IafOYY7JJNMv81OlP0kPxKMLdvmkZUAQa/Wv5qoLA0a6VETIBrBuQ1gFEO5V7QVAVzUf CKDN7DA7ow8crsfKSjlWN8fvTPbFhrV/oPE+U0UqEuHKzTvnt1PqWOz10xmbZ2zKHdkQ yS9Q== MIME-Version: 1.0 X-Received: by 10.194.86.194 with SMTP id r2mr80640766wjz.41.1426087196349; Wed, 11 Mar 2015 08:19:56 -0700 (PDT) Sender: asomers@gmail.com Received: by 10.194.17.129 with HTTP; Wed, 11 Mar 2015 08:19:56 -0700 (PDT) In-Reply-To: <20150311095556.1ed29f5d@ernst.home> References: <9F2E1411-B517-4BC8-AF61-BB15EE35083C@me.com> <54FF1343.1020705@gmx.de> <20150311095556.1ed29f5d@ernst.home> Date: Wed, 11 Mar 2015 09:19:56 -0600 X-Google-Sender-Auth: MM_2iiozsyyxPw_pPNK6CVZyG2Q Message-ID: Subject: Re: detecting hyperthreading From: Alan Somers To: gljennjohn@gmail.com Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-hackers@freebsd.org" , "lokadamus@gmx.de" , "Pokala, Ravi" , Rui Paulo X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Mar 2015 15:19:58 -0000 On Wed, Mar 11, 2015 at 2:55 AM, Gary Jennejohn wrote: > On Tue, 10 Mar 2015 10:07:19 -0600 > Alan Somers wrote: > >> On Tue, Mar 10, 2015 at 10:02 AM, Freddie Cash wrote: >> > On Tue, Mar 10, 2015 at 8:56 AM, Pokala, Ravi wrote: >> > >> >> -----Original Message----- >> >> From: "lokadamus@gmx.de" >> >> Date: 2015-03-10, Tuesday at 08:52 >> >> To: Ravi Pokala , Rui Paulo >> >> Cc: "freebsd-hackers@freebsd.org" >> >> Subject: Re: detecting hyperthreading >> >> >> >> >Have you look at dmesg? >> >> >My system is a P4 with HTT. >> >> >dmesg |more >> >> [...] >> >> >CPU: Intel(R) Pentium(R) 4 CPU 3.00GHz (3000.00-MHz 686-class CPU) >> >> > Origin = "GenuineIntel" Id = 0xf29 Family = 0xf Model = 0x2 >> >> >Stepping = 9 >> >> > >> >> >Features=0xbfebfbff> >> >CA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE> >> >> > Features2=0x4400 >> >> >> >> Of course. :-) >> >> >> >> But there are two problems: >> >> >> >> (1) That just tells me HTT is supported by the CPU, not that if kernel is >> >> using it. >> >> (2) It's difficult to parse. >> >> >> >> Of the two, (1) is the bigger concern for my use-case. >> >> >> > >> > 6 lines or so below the Features line shows the kernel loading "cpu0 >> > (BSP)", and then "cpu1 (AP/HT)". >> > >> > Compare that to a system without HTT, where any extra cpus only show "(AP)". >> > >> > It's not perfect, but one could grep through /var/run/dmesg.boot looking >> > for "cpu" lines and checking for "(AP)" or "(AP/HT)". >> > >> > -- >> > Freddie Cash >> > fjwcash@gmail.com >> >> I always look at "sysctl kern.sched.topology_spec" to tell if >> hyperthreading is enabled. It's overkill, but it works. >> > [snip Ruby] > > Is this ULE-specific? This OID isn't present on my box using the > BSD scheduler. Something to be aware of. > > -- > Gary Jennejohn I never noticed because I don't use the BSD scheduler. But now that you mention it, yes it is. The OID is defined in kern/sched_ule.c.