From owner-svn-src-stable@freebsd.org Wed May 15 08:15:45 2019 Return-Path: Delivered-To: svn-src-stable@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 8262815AF2A9; Wed, 15 May 2019 08:15:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 28E2A8114C; Wed, 15 May 2019 08:15:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B3C06EC2; Wed, 15 May 2019 08:15:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4F8Fixj046235; Wed, 15 May 2019 08:15:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4F8Fi5s046234; Wed, 15 May 2019 08:15:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201905150815.x4F8Fi5s046234@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 15 May 2019 08:15:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r347612 - stable/12/sys/dev/cpuctl X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/dev/cpuctl X-SVN-Commit-Revision: 347612 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 28E2A8114C X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 May 2019 08:15:45 -0000 Author: kib Date: Wed May 15 08:15:44 2019 New Revision: 347612 URL: https://svnweb.freebsd.org/changeset/base/347612 Log: MFC r347368: x86: Put other CPUs into tight loop when updating Intel microcode from loaded OS. Modified: stable/12/sys/dev/cpuctl/cpuctl.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/cpuctl/cpuctl.c ============================================================================== --- stable/12/sys/dev/cpuctl/cpuctl.c Wed May 15 07:51:35 2019 (r347611) +++ stable/12/sys/dev/cpuctl/cpuctl.c Wed May 15 08:15:44 2019 (r347612) @@ -330,9 +330,26 @@ cpuctl_do_update(int cpu, cpuctl_update_args_t *data, return (ret); } +struct ucode_update_data { + void *ptr; + int cpu; + int ret; +}; + +static void +ucode_intel_load_rv(void *arg) +{ + struct ucode_update_data *d; + + d = arg; + if (PCPU_GET(cpuid) == d->cpu) + d->ret = ucode_intel_load(d->ptr, true, NULL, NULL); +} + static int update_intel(int cpu, cpuctl_update_args_t *args, struct thread *td) { + struct ucode_update_data d; void *ptr; int is_bound, oldcpu, ret; @@ -360,12 +377,11 @@ update_intel(int cpu, cpuctl_update_args_t *args, stru oldcpu = td->td_oncpu; is_bound = cpu_sched_is_bound(td); set_cpu(cpu, td); - critical_enter(); - - ret = ucode_intel_load(ptr, true, NULL, NULL); - - critical_exit(); + d.ptr = ptr; + d.cpu = cpu; + smp_rendezvous(NULL, ucode_intel_load_rv, NULL, &d); restore_cpu(oldcpu, is_bound, td); + ret = d.ret; /* * Replace any existing update. This ensures that the new update