[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 4/5] x86/mwait-idle: disable IBRS during long idle
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Date: Fri, 14 Oct 2022 10:03:31 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1Mt/24a6Tr+BU7pmDHNjy49cBDJ7c1U4GVoTq1Sp9fY=; b=LbOFcFFk59n8WHZniVBjP0xT9N7rKnDh/A57F2rmZhjP5lbWfnEvjNbSbEeU2yM08jUbiognF1+LJJE6/qlDTIogPkUcVoTeGkmivdRLiMxUcGww2H8PzBXD/vvyT9xhbGNY6Iuphc06n3rpghksg2C1/7VkJ6r9P252PjpIxG839QT0lbZVozF3kMqCo++b9UCnwYaE/D6Ur+lu/NnCzMu5/lSsmCVN3gY56oOBajUAqJR704Wzm6s2cLAFDmA7bY7tliHGp/1kKUfrFtx/pRLkP7RSkf/J2XLPPiR7XgCkBf5svVCY9Vq20WKz0P9/dHvoHg1BVqYjgWWrqbuQ6A==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OfdpqsAYHyc+vfXd4yQrZTJuqvO5c7v+wxBGCPSy6ItbqFBLK9GnPeEqESdZK3+LILfN79I42cmnuh3AJKmu+R6nPq0XUGgUomPzYdGWNjn529LqmMtNTit9trO3SaZwq6TFl5VCOXSUT5+7vaiSiEowIMoR8P1yB1gavJLA/4qSR1dVq/aYop4ULZN7aa2R2jb4bSvgtyTHYsBdh/45fLT2ltrde9lcJYCjgB0vFHC0aMaFHtpovaJxYDm8fo4sZ2hI7oMr8UvJXNEh9bvK5Qz9Rsot08mnkDtKxn9I1+tw1nOPkuahhFJ90eKeCF2i7thijoIKCX2GbJ8GOSDa7A==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
- Delivery-date: Fri, 14 Oct 2022 08:03:54 +0000
- Ironport-data: A9a23:b5vil6/Cy1IwklMwbPjWDrVtTnXE+AQUBUUsXf3Cpuox9vdTzo0SJWKXQww3xtKpvFycd/pdrF8U6HfgqX9rwR6pjUk4BYJenBXZgbeA2AY+f/LqHPO7FUIptKp4mmJ9IXoGkdpOwkJNaImnSNg8UnzzxMjFkEWfXhf+HC/HLh6XaA1v0rgsl3S3Er4TZ8haNlKW4lGcYUPamvKcBgNvE9HgFKNAbilWs6q/7s7kCmhaMj9lYhppNIr+L8YIB9Z9DBEr3fprrLFoYuVy2CH6fEBbmCEcR5UyJvkdGanj8yVOffuwt/caEx5SZO1zrj6Hk8UYnVV/64ktnoNEmGQx3SQjbxF7fdl5i0+CZam6j2W6I5F7ANJ7G2ISY/WQuYsLYBYx4ww/MSpbzq27HswBGmWn+zFnxufjpt2pCXJdlDk1Ao9OGMsx7bgxH8p44n0OtdjFJ+8al5xPfGYd9xn4rAIT0x5fsg1rlppSLqKMVQXSpdN7RWx+p6Jd3h85w5WZSQ0bktHXcUC+pIZ1q4BdVAkJVm5ZL6chdDeTLueRyPhkKVZZAWA6t5nYNo3qN6VwnAMu4kGYP7LC35F2L9wl6C+dyYLII/jT4w7JfJ+Q12ThE0rfFE3SEIdGq9YfOK/vtz4KnYrB0HYWteOb8pSte735Uu6CFtyX88nijPHOEe4g269qoehlJCiFB2viKhB4+hA+xjsW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Wx+g9f18uSjrTzMPPLa9Lok7PXtYcBzurNNM2hDTHLJFwQ7XR0GmP5HYQzfugnkBAHuji61mLJgcNsucn4imuO9OZCmrHk2gbOb00x5LxlQQRCuVNseajeLx7hlbtyh2D9EZQiqltDJN7KUIIUvyZX0A93qWMliUfuOSnZmmvnr21sMO/uT2R7awXoPdEqlTPKthxgnsmBEN9vzMaffc/rJQG3Z1tgehBDDTZ5n7TEYxJkGezE6pM95f0Zzm6uQl2DXFqcMZVCe26eMPp4T1Kb55Mg6zV6JnJ0/LLXgL9gp0mTg2XQYFUigIGLK9sytSwgT7JMrAcY9SDoi0AP8zUht3Tr2kyt0IBB5sUtccaPNNFuDSZdr32gOXF8+5eFWD2BzGh59wYaGiIGe0dw0ZXMDO49ufPN1VWAEM1ujur+Z5JrMikJd2EXp8JOWvt53Vo6Rpv36st0eWnc6mc5BtFgXQS4OorePEyyLw3bs6DL6G+YhNQekmEYbk7m9Pm3LJp3rMcJnKgmh4gm3HmeLuHkvbskEx/mtp0XvRSwDyyqKnJr/3ed5hvSkffpnecwnRg5f0jB6vkAwZLAi/BHbLBm269Bofdiyqat28Wdi//hs7RRY7PT2Uvafk8
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Thu, Oct 13, 2022 at 04:15:04PM +0200, Jan Beulich wrote:
> On 13.10.2022 15:10, Roger Pau Monné wrote:
> > On Thu, Oct 13, 2022 at 02:17:54PM +0200, Jan Beulich wrote:
> >> On 13.10.2022 14:03, Roger Pau Monné wrote:
> >>> On Thu, Aug 18, 2022 at 03:04:51PM +0200, Jan Beulich wrote:
> >>>> From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> >>>>
> >>>> Having IBRS enabled while the SMT sibling is idle unnecessarily slows
> >>>> down the running sibling. OTOH, disabling IBRS around idle takes two
> >>>> MSR writes, which will increase the idle latency.
> >>>>
> >>>> Therefore, only disable IBRS around deeper idle states. Shallow idle
> >>>> states are bounded by the tick in duration, since NOHZ is not allowed
> >>>> for them by virtue of their short target residency.
> >>>>
> >>>> Only do this for mwait-driven idle, since that keeps interrupts disabled
> >>>> across idle, which makes disabling IBRS vs IRQ-entry a non-issue.
> >>>>
> >>>> Note: C6 is a random threshold, most importantly C1 probably shouldn't
> >>>> disable IBRS, benchmarking needed.
> >>>>
> >>>> Suggested-by: Tim Chen <tim.c.chen@xxxxxxxxxxxxxxx>
> >>>> Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> >>>> Signed-off-by: Borislav Petkov <bp@xxxxxxx>
> >>>> Reviewed-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
> >>>> Signed-off-by: Borislav Petkov <bp@xxxxxxx>
> >>>> Origin: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> >>>> bf5835bcdb96
> >>>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> >>>
> >>> Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> >>
> >> Thanks.
> >>
> >>> One unrelated comment below.
> >>> [...]
> >>>> @@ -932,8 +939,6 @@ static void cf_check mwait_idle(void)
> >>>> pm_idle_save();
> >>>> else
> >>>> {
> >>>> - struct cpu_info *info = get_cpu_info();
> >>>> -
> >>>> spec_ctrl_enter_idle(info);
> >>>> safe_halt();
> >>>> spec_ctrl_exit_idle(info);
> >>>
> >>> Do we need to disable speculation just for the hlt if there's no
> >>> C state change?
> >>>
> >>> It would seem to me like the MSR writes could add a lot of latency
> >>> when there's no C state change.
> >>
> >> HLT enters (at least) C1, so is a C-state change to me as well. Plus
> >> we may remain there for a while, and during that time we'd like to
> >> not unduly impact the other thread.
> >
> > OK, but it's not a "deeper C state" as mentioned in the commit
> > message.
>
> Correct. But it's also code not being altered by this commit.
Indeed, that's why it's an unrelated comment. I was just wondering
whether we should drop those or not in a separate patch. I'm
concerned over hitting that path on a virtualized environment, where
changing the spec controls is likely not that cheap.
Thanks, Roger.
|