Bug 225173

Summary: sysutils/devcpu-data broken
Product: Ports & Packages Reporter: Helge Oldach <freebsd>
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: Closed FIXED    
Severity: Affects Many People CC: clarkjc, freebsd, sbruno, swills, ultima
Priority: --- Flags: bugzilla: maintainer-feedback? (clarkjc)
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch to update rc script none

Description Helge Oldach 2018-01-15 05:25:33 UTC
ports r458987 is broken, as the naive removal of the "for in in ${cpus}" loop renders ${i} (used in "/dev/cpuctl${i}") undefined. So this command will always fail.

Secondly, the -e option of cpucontrol(1) is not available in STABLE and below, so it should be guarded with OSVERSION anyhow.
Comment 1 Steve Wills freebsd_committer freebsd_triage 2018-01-15 16:11:53 UTC
Created attachment 189751 [details]
patch to update rc script

This look OK?
Comment 2 Sean Bruno freebsd_committer freebsd_triage 2018-01-15 16:31:02 UTC
Thumbs up from me on this one.  I'm not positive what we should tell stable users to do at the moment.  Does upgrading on stable get the "-e" option for cpucontrol yet?
Comment 3 Helge Oldach 2018-01-15 16:49:25 UTC
base r327597 is not MFC'ed yet to STABLE (it says after 1 week but that is already 9 days ago as of today).

Apart from that the patch looks sensible to me.
Comment 4 Richard Gallamore freebsd_committer freebsd_triage 2018-01-15 16:56:46 UTC
> CPUCONTROL_UPDATED=$(cpucontrol -h 2>&1 | grep -q -- -e; echo $?)
> if [ ${CPUCONTROL_UPDATED} -ne 0 ]; then

Could be changed to this.

if ! cpucontrol -h 2>&1 | grep -q -- -e; then


> ${CMT} -e /dev/cpuctl0 >/dev/null 2>&1
> if [ $? -ne 0 ]; then

if ! ${CMT} -e /dev/cpuctl0 >/dev/null 2<&1; then
Comment 5 Helge Oldach 2018-01-15 17:02:53 UTC
I would prefer

if ! ${CMT} -e /dev/cpuctl0 >/dev/null 2>&1; then

over

if ! ${CMT} -e /dev/cpuctl0 >/dev/null 2<&1; then

:-)
Comment 6 Richard Gallamore freebsd_committer freebsd_triage 2018-01-15 17:04:41 UTC
(In reply to Helge Oldach from comment #5)
Was just about to comment on the typo, thanks! XD
Comment 7 commit-hook freebsd_committer freebsd_triage 2018-01-15 17:06:12 UTC
A commit references this bug:

Author: swills
Date: Mon Jan 15 17:05:38 UTC 2018
New revision: 459084
URL: https://svnweb.freebsd.org/changeset/ports/459084

Log:
  sysutils/devcpu-data: fix rc script

  PR:		225173
  Reviewed by:	sbruno
  Approved by:	portmgr (implicit)
  MFH:		2018Q1

Changes:
  head/sysutils/devcpu-data/Makefile
  head/sysutils/devcpu-data/files/microcode_update.in
Comment 8 Steve Wills freebsd_committer freebsd_triage 2018-01-15 17:07:39 UTC
(In reply to Richard Gallamore from comment #6)
I find that syntax a bit less readable personally. Let's go with what I had for now and let maintainer update later if preferred.
Comment 9 commit-hook freebsd_committer freebsd_triage 2018-01-15 17:28:49 UTC
A commit references this bug:

Author: swills
Date: Mon Jan 15 17:28:42 UTC 2018
New revision: 459102
URL: https://svnweb.freebsd.org/changeset/ports/459102

Log:
  sync up with HEAD

  MFH: r458664 r458792 r458943 r458987 r459084

  sysutils/devcpu-data follow up commit to 20180108 Intel microcode update.

  Run cpucontrol -e after microcode update to refresh cpu flags.  If running
  on an older system without -e, fail silently.

  Log any upgrade output via logger to /var/log/messages.

  Add an instructional pkg-message for users.

  Intel Release Notes:
  Intel Processor Microcode Package for Linux
  20180108 Release

  -- Updates upon 20171117 release --
  IVT C0          (06-3e-04:ed) 428->42a
  SKL-U/Y D0      (06-4e-03:c0) ba->c2
  BDW-U/Y E/F     (06-3d-04:c0) 25->28
  HSW-ULT Cx/Dx   (06-45-01:72) 20->21
  Crystalwell Cx  (06-46-01:32) 17->18
  BDW-H E/G       (06-47-01:22) 17->1b
  HSX-EX E0       (06-3f-04:80) 0f->10
  SKL-H/S R0      (06-5e-03:36) ba->c2
  HSW Cx/Dx       (06-3c-03:32) 22->23
  HSX C0          (06-3f-02:6f) 3a->3b
  BDX-DE V0/V1    (06-56-02:10) 0f->14
  BDX-DE V2       (06-56-03:10) 700000d->7000011
  KBL-U/Y H0      (06-8e-09:c0) 62->80
  KBL Y0 / CFL D0 (06-8e-0a:c0) 70->80
  KBL-H/S B0      (06-9e-09:2a) 5e->80
  CFL U0          (06-9e-0a:22) 70->80
  CFL B0          (06-9e-0b:02) 72->80
  SKX H0          (06-55-04:b7) 2000035->200003c
  GLK B0          (06-7a-01:01) 1e->22

  Reviewed by:	A bunch of folks on the review
  Sponsored by:	Limelight Networks
  Differential Revision:	https://reviews.freebsd.org/D13815

  Revert to previous Intel microcode archive (20171117).

  FreeBSD kernel changes to make use of the capabilities provided by the
  new microcode update have not yet been committed. Since we do not yet
  require them, allow more time for validation.

  Approved by:	emaste
  Sponsored by:	Limelight Networks

  sysutils/devcpu-data: Update AMD microcode, add cpu 17h microcode,
  drop malfunctioning individual "AMD-XXX" files.

  On the few machines that actually have microcode updates, chopping up the
  microcode is incorrect and results in a failure to update.  Don't do that.

  I personally run this on my FX-8150 and this has been tested by a few others.

  Sponsored by:	 Limelight Networks
  Differential Revision:	https://reviews.freebsd.org/D13832

  sysutils/devcpu-data:  Only run "cpucontrol -e" once.

  Submitted by:	kib
  Sponsored by:	Limelight Networks

  sysutils/devcpu-data: fix rc script

  PR:		225173
  Reviewed by:	sbruno
  Approved by:	portmgr (implicit)
  Approved by:	ports-secteam (implicit)

Changes:
_U  branches/2018Q1/
  branches/2018Q1/sysutils/devcpu-data/Makefile
  branches/2018Q1/sysutils/devcpu-data/distinfo
  branches/2018Q1/sysutils/devcpu-data/files/Makefile
  branches/2018Q1/sysutils/devcpu-data/files/microcode_update.in
  branches/2018Q1/sysutils/devcpu-data/pkg-message
  branches/2018Q1/sysutils/devcpu-data/pkg-plist
Comment 10 Steve Wills freebsd_committer freebsd_triage 2018-01-15 17:29:34 UTC
Update committed and merged.