Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Sep 2019 20:53:42 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r512986 - in head/sysutils/intel-pcm: . files
Message-ID:  <201909262053.x8QKrg1b049665@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Thu Sep 26 20:53:42 2019
New Revision: 512986
URL: https://svnweb.freebsd.org/changeset/ports/512986

Log:
  The code creates a lambda function that takes by reference the core_id local
  variable, and pass it to a thread that often executes after constructor has
  exited causing per-core thread to use a corrupted core_id.
  
  Depending on compiler and runtime execution (and whether executing over gdb),
  the tool might segfault or have incorrect behavior.
  
  This makes sure the lambda function takes copy of automatic variable in
  enclosing environment.
  
  Submitted upstream as https://github.com/opcm/pcm/pull/162
  
  Submitted by: Loic Prylli
  Sponsored by: Netflix, Inc
  Differential Revision: https://reviews.freebsd.org/D21804

Added:
  head/sysutils/intel-pcm/files/patch-cpucounters.cpp   (contents, props changed)
Modified:
  head/sysutils/intel-pcm/Makefile   (contents, props changed)

Modified: head/sysutils/intel-pcm/Makefile
==============================================================================
--- head/sysutils/intel-pcm/Makefile	Thu Sep 26 20:40:02 2019	(r512985)
+++ head/sysutils/intel-pcm/Makefile	Thu Sep 26 20:53:42 2019	(r512986)
@@ -3,6 +3,7 @@
 
 PORTNAME=	intel-pcm
 PORTVERSION=	201902
+PORTREVISION=   1
 CATEGORIES=	sysutils
 
 MAINTAINER=	imp@FreeBSD.org

Added: head/sysutils/intel-pcm/files/patch-cpucounters.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/intel-pcm/files/patch-cpucounters.cpp	Thu Sep 26 20:53:42 2019	(r512986)
@@ -0,0 +1,11 @@
+--- cpucounters.cpp
++++ cpucounters.cpp
+@@ -1617,7 +1617,7 @@ class CoreTaskQueue
+     CoreTaskQueue(CoreTaskQueue &) = delete;
+ public:
+     CoreTaskQueue(int32 core) :
+-        worker([&]() {
++        worker([=]() {
+             TemporalThreadAffinity tempThreadAffinity(core);
+             std::unique_lock<std::mutex> lock(m);
+             while (1) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909262053.x8QKrg1b049665>