Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1612373imu; Wed, 9 Jan 2019 23:15:10 -0800 (PST) X-Google-Smtp-Source: ALg8bN7TKK6vh2wHur43slrhcQ659Ea9QvDpkN+XcV4+tIaOs/HcGYyDF2zOamGvDcE9yxa4xQxm X-Received: by 2002:a63:a91a:: with SMTP id u26mr8243909pge.349.1547104510145; Wed, 09 Jan 2019 23:15:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547104510; cv=none; d=google.com; s=arc-20160816; b=Up19cwpKCYUxjJAfjayAolqOsulGAZRV0er8iuYrwL5VJGO6qE3QfLNhIhb3yOj6k/ D4SKkBx5Xf5+3ckepV4bZojdeu0h/8vUeUle9CiPi3tH6kk6fMQEif1Qpafh2zHY3LSj LfVzd3dqKUQy9gEGeJI+kVRAztIoJfJ7P4SbRmrdeRw1iKy16tj1DOFNjbySbb2Gk/TB k+CEQyTjsXgFBalO+25I+tJnyMErOia4bWc1kEQfx17NsNC1jfM2xOtxEhdh7NWQZqwP xIuG+rMSdJ7y+RePqbZPuyJHw5UmklcFAhiTiHzbw13kFtcazoV0DqREGs7lPl2Inf7x u+rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=oYh2pk6F2N93fgKStblCLSkfY8pRw+12ZQ8vYdIXyW8=; b=C2wDRVsJw+eFLbcx3OR0TEVUXas4HbAQLAifMLNT71yv+yvlQp2KicnkkYbapDCiLU wDmqoUrQNuxg/0R/Y16WXTOa6e4fML22IGrxv2W2vYfgQQ+xSxcc3tf/4TWgiDO41g9x A1YDFLk0Ylvd1rBsyHJo5U90d+vIEZRicpXL5Obipw91Uhs4hiiQdY6oOhclsqTMNDd7 QIoK3vZctPyqEYrkB7ie7K1RkFaVf/OQIhTcnBL1BzdIu6kUn7U0Drb89U1xhXFOlhwJ kVD+9VGuYbdrWSQMffrm9/JgeMmxQB0vfKJkifRpyHySK/GQidwKW+OSkpVH32Pr3sma hqbQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x12si12008347pgf.454.2019.01.09.23.14.54; Wed, 09 Jan 2019 23:15:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727556AbfAJHNt (ORCPT + 99 others); Thu, 10 Jan 2019 02:13:49 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:38120 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727410AbfAJHNt (ORCPT ); Thu, 10 Jan 2019 02:13:49 -0500 Received: by mail-pf1-f194.google.com with SMTP id q1so4912788pfi.5 for ; Wed, 09 Jan 2019 23:13:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=oYh2pk6F2N93fgKStblCLSkfY8pRw+12ZQ8vYdIXyW8=; b=dxM1xaYF7Gah6S3SNFDw7y40q5lubFKAOb5+9L4ckdEOZG+xme6pwbT7xn0PgjHMSK aUkd2Tz0lBFERHmYN45ApUAJnVpStLI0bFpIdfLab3GF90qtUuVsNPZHSh/OYsbPw2jL aTk57nxMVecDtsAX6KY25ICT8F//j9NJslWtkCt5iGej860m6A+H/+1VFVZoRIOmGXEO rRkNIc+bThCN1rycjaBaJO73QsQ+wMAqqTW+nLdu1f/Rm2UMvkYs0bTAPG/E4tnFjniv pesp58K7wUoQ901mkNwlK0ZTpkTyHYebnkFnKrqxvJWiV/SDutgTRH/nOin7KVxqzfBO 41pg== X-Gm-Message-State: AJcUukdCWcgCFtQaHdxTZcqWsl9dzIOjN6qHT6+Bi891FNOsygEV7Zpx 3/sGEn8N0P5weimwVNdgOlw3Mw== X-Received: by 2002:a63:3507:: with SMTP id c7mr8385876pga.315.1547104428201; Wed, 09 Jan 2019 23:13:48 -0800 (PST) Received: from [192.168.1.6] ([122.177.131.230]) by smtp.gmail.com with ESMTPSA id x2sm105069338pfx.78.2019.01.09.23.13.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Jan 2019 23:13:47 -0800 (PST) Subject: Re: [PATCH 3/3] x86/platform/UV: use efi_runtime_sem to serialise BIOS calls To: Hedi Berriche , Ard Biesheuvel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" Cc: x86@kernel.org, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, Russ Anderson , Mike Travis , Dimitri Sivanich , Steve Wahl , bhsharma@redhat.com, Bhupesh SHARMA References: <20190109104541.25733-1-hedi.berriche@hpe.com> <20190109104541.25733-4-hedi.berriche@hpe.com> From: Bhupesh Sharma Message-ID: <134565bb-0f5e-27c7-199c-af6132dc0dc3@redhat.com> Date: Thu, 10 Jan 2019 12:43:38 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20190109104541.25733-4-hedi.berriche@hpe.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Hedi, Thanks for the patchset. I will give this a go on my sgi-uv300 machine and come back with more detailed inputs, but I wanted to ask about the hang/panic you mentioned in the cover letter when efi_scratch gets clobbered. Can you describe the same (for e.g. how to reproduce this). Nitpicks below: On 01/09/2019 04:15 PM, Hedi Berriche wrote: > Calls into UV firmware must be protected against concurrency, use the > now visible efi_runtime_sem lock to serialise them. > > Signed-off-by: Hedi Berriche > Reviewed-by: Russ Anderson > Reviewed-by: Mike Travis > Reviewed-by: Dimitri Sivanich > Reviewed-by: Steve Wahl > --- > arch/x86/include/asm/uv/bios.h | 3 ++- > arch/x86/platform/uv/bios_uv.c | 25 ++++++++++++++++++++++--- > 2 files changed, 24 insertions(+), 4 deletions(-) > > diff --git a/arch/x86/include/asm/uv/bios.h b/arch/x86/include/asm/uv/bios.h > index 4eee646544b2..33e94aa0b1ff 100644 > --- a/arch/x86/include/asm/uv/bios.h > +++ b/arch/x86/include/asm/uv/bios.h > @@ -48,7 +48,8 @@ enum { > BIOS_STATUS_SUCCESS = 0, > BIOS_STATUS_UNIMPLEMENTED = -ENOSYS, > BIOS_STATUS_EINVAL = -EINVAL, > - BIOS_STATUS_UNAVAIL = -EBUSY > + BIOS_STATUS_UNAVAIL = -EBUSY, > + BIOS_STATUS_ABORT = -EINTR > }; > > /* Address map parameters */ > diff --git a/arch/x86/platform/uv/bios_uv.c b/arch/x86/platform/uv/bios_uv.c > index cd05af157763..92f960798e20 100644 > --- a/arch/x86/platform/uv/bios_uv.c > +++ b/arch/x86/platform/uv/bios_uv.c > @@ -29,7 +29,8 @@ > > struct uv_systab *uv_systab; > > -s64 uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, u64 a4, u64 a5) > +s64 __uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, > + u64 a4, u64 a5) Can we make this static? > { > struct uv_systab *tab = uv_systab; > s64 ret; > @@ -44,13 +45,26 @@ s64 uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, u64 a4, u64 a5) > * If EFI_OLD_MEMMAP is set, we need to fall back to using our old EFI > * callback method, which uses efi_call() directly, with the kernel page tables: > */ > - if (unlikely(test_bit(EFI_OLD_MEMMAP, &efi.flags))) > + if (unlikely(efi_enabled(EFI_OLD_MEMMAP))) > ret = efi_call((void *)__va(tab->function), (u64)which, a1, a2, a3, a4, a5); > else > ret = efi_call_virt_pointer(tab, function, (u64)which, a1, a2, a3, a4, a5); > > return ret; > } > + > +s64 uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, u64 a4, u64 a5) > +{ > + s64 ret; > + > + if (down_interruptible(&efi_runtime_sem)) > + return BIOS_STATUS_ABORT; > + > + ret = __uv_bios_call(which, a1, a2, a3, a4, a5); > + up(&efi_runtime_sem); > + > + return ret; > +} > EXPORT_SYMBOL_GPL(uv_bios_call); > > s64 uv_bios_call_irqsave(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, > @@ -59,10 +73,15 @@ s64 uv_bios_call_irqsave(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, > unsigned long bios_flags; > s64 ret; > > + if (down_interruptible(&efi_runtime_sem)) > + return BIOS_STATUS_ABORT; > + > local_irq_save(bios_flags); > - ret = uv_bios_call(which, a1, a2, a3, a4, a5); > + ret = __uv_bios_call(which, a1, a2, a3, a4, a5); > local_irq_restore(bios_flags); > > + up(&efi_runtime_sem); > + > return ret; > } > Thanks, Bhupesh