From owner-freebsd-hackers@freebsd.org Thu Jan 24 16:33:12 2019 Return-Path: Delivered-To: freebsd-hackers@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 4EACA14B4B70 for ; Thu, 24 Jan 2019 16:33:12 +0000 (UTC) (envelope-from zbeeble@gmail.com) Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1A85C71876 for ; Thu, 24 Jan 2019 16:33:11 +0000 (UTC) (envelope-from zbeeble@gmail.com) Received: by mail-io1-xd2b.google.com with SMTP id s8so5190687iob.13 for ; Thu, 24 Jan 2019 08:33:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=6n/YT1cMd3SBt1DmBIq/5qF1CPjhFPbhPxw9XHfSiZk=; b=j5hRJcj2oCSRrxWDd/dasf+6qZsnVkEO7U7QFhgcZi4ts3kj2LyhFXbe85XVWzJpcS U0jVCG/8rmP1I9WCjiqI7UIHxW6HzKieoKX/Oc4MkBHtkZUSNH0Gt91locoYT/NXkV/7 o387s/sRjlqaCMaQUFarVE9PJOU605NWsIG6uCjmSw5UPzeuCfe+LLJcoY2mmWE2hGkM 2sg7Snd/WYHFfjuqwLvFv5oiIDdrVdGVEPaCCkASJ/9+9Lo5RYcgP+cz/4gqdMICLcSf zxIf5XTzuf25lJgrqjEyXi5jhUyVJLDgmctY7/FAMiq5YgWw/FqLFuVcSZk46PNS/GlD a+cA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=6n/YT1cMd3SBt1DmBIq/5qF1CPjhFPbhPxw9XHfSiZk=; b=jOJeABYkA78PvWj5fI/rG/DhH242o4OfLz2ZRjbjNqzIMfgO5ny1L+Coy0O2unCS/V X7rMNr57cjunqk2I2aa52UM6pvSN8FWq0zVVZJWnSqpXAzytkdvLHM3zz6Cl4VK6sdTx UlULcawLZbLLahrh42AcDbt0WxoCQKn4H8k81GDWusdtdJlKXXjygsAHpdONUqtj4sRV nRCjfdEVCHziB6U9lBYF1cwjtzuhnu5M/SS92/CacwM7sL/gMM6u+ZSwBhqvg9qNpK3a lL+ToqFwCNyWj0Vg3vDLhknxjelSIJcnAMx+RAmtMRYNu7F1EBJDE3SZKVATzZAItoOu 6SKA== X-Gm-Message-State: AHQUAuaodC+clD6QlcgVYE7tc1xY7b1lBnkrE/IrlnzdHmw0Iz/t2dXX YF2DG7rWVYGEF5l/YW9QhdZ5vfvARx03+vyP9BPyo78= X-Google-Smtp-Source: ALg8bN4Sbe5aouHNBmgMOPjzNosNr5N/4/7ZozJ3Rmkwh+ZEGtq6EKfaHuitf+T0DjV3+kq+w7AXaCPD0bpX6kA+QaI= X-Received: by 2002:a5e:c802:: with SMTP id y2mr4172408iol.198.1548347590074; Thu, 24 Jan 2019 08:33:10 -0800 (PST) MIME-Version: 1.0 From: Zaphod Beeblebrox Date: Thu, 24 Jan 2019 11:32:59 -0500 Message-ID: Subject: Scheduled ideas: Two threads with one "stone" To: FreeBSD Hackers X-Rspamd-Queue-Id: 1A85C71876 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=j5hRJcj2; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of zbeeble@gmail.com designates 2607:f8b0:4864:20::d2b as permitted sender) smtp.mailfrom=zbeeble@gmail.com X-Spamd-Result: default: False [-6.59 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCPT_COUNT_ONE(0.00)[1]; RCVD_TLS_LAST(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[b.2.d.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; IP_SCORE(-2.69)[ip: (-8.98), ipnet: 2607:f8b0::/32(-2.48), asn: 15169(-1.91), country: US(-0.08)]; NEURAL_HAM_SHORT(-0.89)[-0.894,0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Jan 2019 16:33:12 -0000 W.R.T. hyperthreading, it's come to my attention that FreeBSD has had some recommendations for awhile --- namely hyperthreading is bad for secure systems. That-is-to-say this is not about recent vulnerabilities of recent Intel flavoured CPUs, but rather some thoughts on a different solution to a different problem. I was building world on my laptop when I noticed how sucky it had become. Now... I well know this is due to the fact that even a "nice -19 make -j32 buildworld" will slow the normal priority userland down by about 1/2 because the thread that is "me" on the CPU is competing with one of the threads that is saturating the CPU. My normal priority thread will get scheduled, but it competes equally for resources with threads at much lower priority. It then struck me that the fix for this problem would also address the hyperthreading side channel attack. It struck me that two simple rules would apply to scheduling hyperthreads (rather than the global "turn them off for security" ... To be scheduled on a paired hyperthread, the candidate thread should: 1. Belong to the same user 2. Be the same (or the same within a margin) effective priority My argument here for (1) is that it makes the hyperthreading side channel attack moot. The same user has many ways to access the other process... the hyperthreading attack would just be a waste of time. My argument for (2) is that it would restore the experience of responsiveness the local machine that we have on non-hyperthreading processors.