From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=0.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URG_BIZ autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70ABDECDE5F for ; Thu, 19 Jul 2018 06:45:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 24F9B20673 for ; Thu, 19 Jul 2018 06:45:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 24F9B20673 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=de.ibm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729215AbeGSH1N (ORCPT ); Thu, 19 Jul 2018 03:27:13 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:55102 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727348AbeGSH1N (ORCPT ); Thu, 19 Jul 2018 03:27:13 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w6J6e3Fq049912 for ; Thu, 19 Jul 2018 02:45:39 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2kaj4vfb2h-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 19 Jul 2018 02:45:39 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 19 Jul 2018 07:45:37 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 19 Jul 2018 07:45:34 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w6J6jXeh39256278 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 19 Jul 2018 06:45:34 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A0B084203F; Thu, 19 Jul 2018 09:45:51 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 45D684204F; Thu, 19 Jul 2018 09:45:51 +0100 (BST) Received: from oc7330422307.ibm.com (unknown [9.152.224.168]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 19 Jul 2018 09:45:51 +0100 (BST) Subject: Re: [RFC] Make need_resched() return true when rcu_urgent_qs requested To: paulmck@linux.vnet.ibm.com, David Woodhouse Cc: Peter Zijlstra , mhillenb@amazon.de, linux-kernel , kvm , Frederic Weisbecker References: <1531396842.8759.125.camel@infradead.org> <20180712125351.GP3593@linux.vnet.ibm.com> <20180712161704.GA20726@linux.vnet.ibm.com> <20180716154015.GA21419@linux.vnet.ibm.com> <1531815548.19223.23.camel@infradead.org> <20180717125653.GH12945@linux.vnet.ibm.com> <20180718153628.GA24359@linux.vnet.ibm.com> <1531929711.3414.29.camel@infradead.org> <20180718163712.GB12945@linux.vnet.ibm.com> <1531942865.3414.35.camel@infradead.org> <20180718201700.GN12945@linux.vnet.ibm.com> From: Christian Borntraeger Openpgp: preference=signencrypt Autocrypt: addr=borntraeger@de.ibm.com; prefer-encrypt=mutual; keydata= xsFNBE6cPPgBEAC2VpALY0UJjGmgAmavkL/iAdqul2/F9ONz42K6NrwmT+SI9CylKHIX+fdf J34pLNJDmDVEdeb+brtpwC9JEZOLVE0nb+SR83CsAINJYKG3V1b3Kfs0hydseYKsBYqJTN2j CmUXDYq9J7uOyQQ7TNVoQejmpp5ifR4EzwIFfmYDekxRVZDJygD0wL/EzUr8Je3/j548NLyL 4Uhv6CIPf3TY3/aLVKXdxz/ntbLgMcfZsDoHgDk3lY3r1iwbWwEM2+eYRdSZaR4VD+JRD7p8 0FBadNwWnBce1fmQp3EklodGi5y7TNZ/CKdJ+jRPAAnw7SINhSd7PhJMruDAJaUlbYaIm23A +82g+IGe4z9tRGQ9TAflezVMhT5J3ccu6cpIjjvwDlbxucSmtVi5VtPAMTLmfjYp7VY2Tgr+ T92v7+V96jAfE3Zy2nq52e8RDdUo/F6faxcumdl+aLhhKLXgrozpoe2nL0Nyc2uqFjkjwXXI OBQiaqGeWtxeKJP+O8MIpjyGuHUGzvjNx5S/592TQO3phpT5IFWfMgbu4OreZ9yekDhf7Cvn /fkYsiLDz9W6Clihd/xlpm79+jlhm4E3xBPiQOPCZowmHjx57mXVAypOP2Eu+i2nyQrkapaY IdisDQfWPdNeHNOiPnPS3+GhVlPcqSJAIWnuO7Ofw1ZVOyg/jwARAQABzTRDaHJpc3RpYW4g Qm9ybnRyYWVnZXIgKElCTSkgPGJvcm50cmFlZ2VyQGRlLmlibS5jb20+wsF4BBMBAgAiBQJO nDz4AhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRARe7yAtaYcfOYVD/9sqc6ZdYKD bmDIvc2/1LL0g7OgiA8pHJlYN2WHvIhUoZUIqy8Sw2EFny/nlpPVWfG290JizNS2LZ0mCeGZ 80yt0EpQNR8tLVzLSSr0GgoY0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9PvGWBmOXky7/bP6h96jFu9ZYzVgIkBP3UYW+Pb1a+b w4A83/5ImPwtBrN324bNUxPPqUWNW0ftiR5b81ms/rOcDC/k/VoN1B+IHkXrcBf742VOLID4 YP+CB9GXrwuF5KyQ5zEPCAjlOqZoq1fX/xGSsumfM7d6/OR8lvUPmqHfAzW3s9n4lZOW5Jfx bbkAEQEAAcLBXwQYAQIACQUCTpw8+AIbDAAKCRARe7yAtaYcfPzbD/9WNGVf60oXezNzSVCL hfS36l/zy4iy9H9rUZFmmmlBufWOATjiGAXnn0rr/Jh6Zy9NHuvpe3tyNYZLjB9pHT6mRZX7 Z1vDxeLgMjTv983TQ2hUSlhRSc6e6kGDJyG1WnGQaqymUllCmeC/p9q5m3IRxQrd0skfdN1V AMttRwvipmnMduy5SdNayY2YbhWLQ2wS3XHJ39a7D7SQz+gUQfXgE3pf3FlwbwZhRtVR3z5u aKjxqjybS3Ojimx4NkWjidwOaUVZTqEecBV+QCzi2oDr9+XtEs0m5YGI4v+Y/kHocNBP0myd pF3OoXvcWdTb5atk+OKcc8t4TviKy1WCNujC+yBSq3OM8gbmk6NwCwqhHQzXCibMlVF9hq5a FiJb8p4QKSVyLhM8EM3HtiFqFJSV7F+h+2W0kDyzBGyE0D8z3T+L3MOj3JJJkfCwbEbTpk4f n8zMboekuNruDw1OADRMPlhoWb+g6exBWx/YN4AY9LbE2KuaScONqph5/HvJDsUldcRN3a5V RGIN40QWFVlZvkKIEkzlzqpAyGaRLhXJPv/6tpoQaCQQoSAc5Z9kM/wEd9e2zMeojcWjUXgg oWj8A/wY4UXExGBu+UCzzP/6sQRpBiPFgmqPTytrDo/gsUGqjOudLiHQcMU+uunULYQxVghC syiRa+UVlsKmx1hsEg== Date: Thu, 19 Jul 2018 08:45:33 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180718201700.GN12945@linux.vnet.ibm.com> Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 18071906-0008-0000-0000-00000254EADA X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18071906-0009-0000-0000-000021BB445A Message-Id: <86d12d1a-46dd-d82a-96c2-e842ac5a2a6c@de.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-07-19_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807190073 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/18/2018 10:17 PM, Paul E. McKenney wrote: > On Wed, Jul 18, 2018 at 09:41:05PM +0200, David Woodhouse wrote: >> >> >> On Wed, 2018-07-18 at 09:37 -0700, Paul E. McKenney wrote: >>> On Wed, Jul 18, 2018 at 06:01:51PM +0200, David Woodhouse wrote: >>>> >>>> On Wed, 2018-07-18 at 08:36 -0700, Paul E. McKenney wrote: >>>>> >>>>> And I finally did get some near misses from an earlier commit, so we >>>>> should consider your patch to be officially off the hook. >>>> >>>> Yay, I like it when it's not my fault. I'll redo it with the ifdef >>>> CONFIG_NO_HZ_FULL. >>> >>> Hey, I didn't say it wasn't your fault, only that it -officially- wasn't >>> your fault.  ;-) >> >> I can live with being innocent until proven guilty. >> >>>> >>>> What should it do for the !CONFIG_NO_HZ_FULL case? The existing call in >>>> guest_enter_irqoff() clearly wasn't actually doing the right thing >>>> anyway, hence the need for the need_resched() patch in $SUBJECT... so >>>> should I just leave it doing nothing in guest_enter_irqoff()?  >>> >>> One starting point would be the combination of your patch and my >>> patch, with -rcu commit IDs and diff below.  But yes, it needs to be >>> !CONFIG_NO_HZ_FULL.  And no, I am not at all confident that I actually >>> found all the places needing change in the core code, so this needs some >>> serious review both by the KVM guys and the NO_HZ_FULL guys. >> >> Right, that looks fairly much like the version I'd ended up with. So my >> question was... >> >>> --- a/include/linux/context_tracking.h >>> +++ b/include/linux/context_tracking.h >>> @@ -118,12 +118,12 @@ static inline void guest_enter_irqoff(void) >>>    * one time slice). Lets treat guest mode as quiescent state, just like >>>    * we do with user-mode execution. >>>    */ >> >> ...if we change this to something like... >> >> #ifdef CONFIG_NO_HZ_FULL >>> + rcu_kvm_enter(); >> #else >>> if (!context_tracking_cpu_is_enabled()) >>> rcu_virt_note_context_switch(smp_processor_id()); >> #endif >> >> ... do you actually want me to keep the #else case there? It blatantly >> wasn't working anyway for us, perhaps because the condition was false? >> That's why I started fixing need_resched() in the first place, and that >> fix ought to cover whatever this call to rcu_virt_note_context_switch() >> was supposed to be doing? > > My thought would be something like this: > > if (context_tracking_cpu_is_enabled()) > rcu_kvm_enter(); > else > rcu_virt_note_context_switch(smp_processor_id()); In the past we needed that (when we introduced that). At least with every host interrupt we called this making an rcu event at least every HZ. Will the changes in need_resched make this part unnecessary?