Received: by 10.223.164.202 with SMTP id h10csp1637190wrb; Mon, 27 Nov 2017 05:32:42 -0800 (PST) X-Google-Smtp-Source: AGs4zMaMDS3L6E0J1ddYbADH5LDH0E63v/HGonQlh2uCbdiBba6eRpkZVSiUoPSQrVsZUZJEJCsE X-Received: by 10.99.113.91 with SMTP id b27mr36737350pgn.351.1511789562110; Mon, 27 Nov 2017 05:32:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511789562; cv=none; d=google.com; s=arc-20160816; b=TtgYaMQ/8CBYiqNZXZNWF49fGXcO1HclTNnOmnYow9MGmcfheZ6A6SIevWcbiJEJoU FlhmvSv1zN5mUPVmX/p50wNDG/fnh3NJ8U8UEm/LosV/dMZIqTZqjCdfgw6BXQ131xyG 8fCvi5EJEBygY60vn6K4QZMp32xjmS7L2PBGsNlCoLUQD/CBJ2R3HT0yCRM0VgbNle70 u+guuT4qYz4MSgRjyIwcrPuOwlrzZTUYsVTbnOvw7HviJD/xvkgHlFAdB4VgRFtxfiDx fE2HtVCxBSC5yCFynihu7LoXIsLlaajK/ukdUTrX5dknQDfo+9B2iUjx0zMJX5tmH1/1 LwlA== 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:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:arc-authentication-results; bh=ejN5Mlt+QDKQELHZwZKN6GApaCo1mlSl7Q47Ulmn1aI=; b=QDVBNwMmtwwK2XW+SRNspbFf14mwa9SzfuTT2xC8LoUGt1GIO/B5nscU7HlffJaF1O 8YWgKY5ceGlPW4JIN54QHJ+ZacsOcyN8avo5dGgjZV8XgYYh3up8yf0gmeIPXif0KI/7 Crk4QVzUFdzHbMuE/bxwlRaMlPdTwRg1/J8F9NwjQmE4/b4YBUZpCKc2d8WelZzUTccL Eo6bjx+6p9lRrbsZH9J6/VFCeX7vW4RSeU52LRRssQCz6NAQCnfKxL2frgBWM7z6wd22 Ksy4Xhvx4AQOVHGsuFY9L7N74I3qkJWIUclavYLgVm7HMARJ7WL0HDp+eGojuUl/mLlR QRMw== 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=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y1si23550155plk.414.2017.11.27.05.32.30; Mon, 27 Nov 2017 05:32:42 -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=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752327AbdK0Nbu (ORCPT + 77 others); Mon, 27 Nov 2017 08:31:50 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:25595 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752227AbdK0Nbr (ORCPT ); Mon, 27 Nov 2017 08:31:47 -0500 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id vARDUtF4008195 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Nov 2017 13:30:56 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id vARDUtX6031066 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Nov 2017 13:30:55 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id vARDUt9W006381; Mon, 27 Nov 2017 13:30:55 GMT Received: from bostrovs-us.us.oracle.com (/10.152.32.65) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 27 Nov 2017 05:30:54 -0800 Subject: Re: Xen PV breakage after IRQ stack code refactoring To: Juergen Gross , Andy Lutomirski References: <2a0c08b6-9568-7542-f5db-0eb6c828e39f@suse.com> Cc: xen-devel , "linux-kernel@vger.kernel.org" From: Boris Ostrovsky Message-ID: Date: Mon, 27 Nov 2017 08:30:51 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <2a0c08b6-9568-7542-f5db-0eb6c828e39f@suse.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/27/2017 12:34 AM, Juergen Gross wrote: > On 27/11/17 05:03, Andy Lutomirski wrote: >> On Sun, Nov 26, 2017 at 9:10 AM, Boris Ostrovsky >> wrote: >>> Andy, >>> >>> (Can't find the original patch in my mailbox) >>> >>> This hunk from 1d3e53e8624a ("x86/entry/64: Refactor IRQ stacks and make >>> them NMI-safe") >>> >>> >>> diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S >>> index a9a8027..0d4483a 100644 >>> --- a/arch/x86/entry/entry_64.S >>> +++ b/arch/x86/entry/entry_64.S >>> @@ -447,6 +447,59 @@ ENTRY(irq_entries_start) >>> .endr >>> END(irq_entries_start) >>> >>> +.macro DEBUG_ENTRY_ASSERT_IRQS_OFF >>> +#ifdef CONFIG_DEBUG_ENTRY >>> + pushfq >>> + testl $X86_EFLAGS_IF, (%rsp) >>> + jz .Lokay_\@ >>> + ud2 >>> +.Lokay_\@: >>> + addq $8, %rsp >>> +#endif >>> +.endm >>> + >>> >>> makes Xen PV guests somewhat unhappy because IF flag will be set. >>> >>> I was hoping to use ALTERNATIVE instruction but when we hit this for the >>> first time we haven't rewritten instructions yet. Moving check_bugs() a bit >>> higher helps but because this is common code I don't know how well it will >>> work on other architectures (and, in fact, whether it is even safe on x86 in >>> general, although that can be verified). >>> >>> Another option is to also add a parameter to DEBUG_ENTRY_ASSERT_IRQS_OFF (or >>> to ENTER_IRQ_STACK) from xen_do_hypervisor_callback (which is where the >>> failure happens) but this looks pretty fragile in that it assumes that >>> xen_do_hypervisor_callback is the only place where we use this codepath >>> before alt instructions are set. >>> >>> Any other suggestions? >> Do we have a convenient asm way to access the save_fl pvop? > No, but adding it would be pretty straight forward. Its something like: > > #define SAVE_FLAGS(clobbers) \ > PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_save_fl), clobbers, \ > PV_SAVE_REGS(clobbers | CLBR_CALLEE_SAVE); \ > call PARA_INDIRECT(pv_irq_ops+PV_IRQ_save_fl); \ > PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);) > > similar to DISABLE_INTERRUPTS(), requiring just the definition of > PV_IRQ_save_fl in asm-offsets.c and the non-pvops definition of > SAVE_FLAGS() in irqflags.h. Hmm.. Indeed, I haven't thought of this for whatever reasons. I'll send the patch soon. Thanks. -boris From 1585196376668958117@xxx Mon Nov 27 05:37:50 +0000 2017 X-GM-THRID: 1585149410444720891 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread