Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752302AbdLMJfY (ORCPT ); Wed, 13 Dec 2017 04:35:24 -0500 Received: from mail-sn1nam02on0051.outbound.protection.outlook.com ([104.47.36.51]:17536 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752002AbdLMJfT (ORCPT ); Wed, 13 Dec 2017 04:35:19 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Christian.Koenig@amd.com; Subject: Re: [patch 1/2] mm, mmu_notifier: annotate mmu notifiers with blockable invalidate callbacks To: David Rientjes , Dimitri Sivanich Cc: Andrew Morton , Michal Hocko , Andrea Arcangeli , Benjamin Herrenschmidt , Paul Mackerras , Oded Gabbay , Alex Deucher , David Airlie , Joerg Roedel , Doug Ledford , Jani Nikula , Mike Marciniszyn , Sean Hefty , Dimitri Sivanich , Boris Ostrovsky , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20171212200542.GJ5848@hpe.com> From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: Date: Wed, 13 Dec 2017 10:34:59 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [2a02:908:1251:7981:e130:d897:7742:e10e] X-ClientProxiedBy: AM5PR0602CA0010.eurprd06.prod.outlook.com (10.175.46.148) To CY4PR12MB1304.namprd12.prod.outlook.com (10.168.168.141) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 1d3c1904-68a5-431b-c592-08d5420cd08c X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307);SRVR:CY4PR12MB1304; X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1304;3:p7BpW8jGIR+heqG7wIUVTIyYxUYo1r52jTlFqG3sKd6CKULrflQnswZ8CPz4h7Xpl2rghB1igvy+RBS519joG8g5JT+TRKbmLqyXDMZcg3zrzOW6hJHp5qEU918cKt8oC1NSSfUTsCPys2zGdoVJGJQyAYjgqtd2VgqDLt7agKUEMQG86iXzAkHnwmVZW8GGZqOSijmBv4RecQHXTf6G+UFVa/U3U67HlEyj19JZLFZ8/1WHc9k4G6e+coSPNR1C;25:Arnjj848RxHVwUahYbFqfOWOsatcioB5TAdr5NlbIDFWBYsfQYL8AMFaMHKANGLj3Ou/zou4yn8Az9vxid6RP1lBs8qWgwNYIogWRdtprL99sY25IZWtSIQg1ZdNhJ1AOd2Bkzxzp5dVuFEie3EKsrUABHKa4l253mMTnYEs2/M3Y/35rZM2flkhgMkFK73EXTcA9EQIzqLz6sjyJGsviGEtSUJoM1Kz7cXFI/PkPBJtTA1XTrKmD+wkFit5S9UCxb/J8hmp9e8T23EW/lYOkFjyDqHTqpSTtgYvZJOIfvwy29Py9tbFKPtzuiiqcxrk1MzkNvCB99tMeqgYH8vr8g==;31:dOfvKvYP+Lwq4+VSRI0akCpon9bbK0NKE5JY10GqW8ngbGbO/FgOcLdmnQsn26DD+ima8cWuP4MWqUgeJgBItW+I8P4v2Zdvp22tRz3OLUefnxi2+JQ0+N72e0/frLpI/U1FlkyMi5NWwHcYTiTM/KYt8vHkbgBxBe3mgEOPtfxSZWJAvPteeN1++xGhrI3Rd33uiy7xcauRltnu74GaXuVcCnGI2QrURPluiaRGCnU= X-MS-TrafficTypeDiagnostic: CY4PR12MB1304: X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1304;20:76u4X/AKb/vmll2wdMPf8CfJkLGgz1Wdq2Ca3t2CkoDIigmP451YdI03AjnYfRLw/5BgZ+dJI/qPMzqRFVDqC3+vHRYngrZWSJq9wJjB6l61VQtLXXuXEM0u9nDUpAPJ8hWxC63+1U5/zC2IJdqjykzEDfY95nhiCLeHyDHPnu1TsVDTWdA9kjehgY8itwEZKmxqYNzWtYLK6Hx20D32UJQdiiVgvuo5w8hDgaZfXscprsNXQXAO3St11d8fg6Ijl7VDxUxQPhWLZIhQbE+E4pbN7W+CWvXZSD/HDbKZoBvrtN6uei+FvImDI07v8J6/qH9E1kg3ODDcZStY4vA5DzWcYDZt00wqqO64YBSOFq360SaIGrlcuR2IhOOPx2jmqY9wMn3EIdh/ocn7fUJY+45XdCT8xyGSxs/1aB8bGURR2hOBjRKoZLJBZW94fS0FS8OA+jphGEgkvkutXRnjsLhM9r/jqjUy+S6M4Xr5HbqE1ElzvJg10u9haXAn+BdQ;4:KbWDKL11Ldn/GBU8ib2u+mFPHdWg79jr01DWcLCD/rqlWpVS0CzeGhZ1D9iJlSHFsT30PpiksH4cEnv/mQ+Vhf7Solr3YOtZx6UMj6Kl6pr6HinEKhhBMv6ZcvXOKuJ611C+SE9/nxs7yYuL8Ygp70rVqfthJvZAFHGqDqwFocbW8+JvziRuoHet/JZC105qdDEjkt8Uvut+epqbufhQro+u2jH2xSK2R6ySwPns3hTNCbJZc/mD+uFstLPa6G818G8IXbG4xYyrWgy1J14n2w== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(2401047)(5005006)(8121501046)(3002001)(3231023)(93006095)(93001095)(10201501046)(6055026)(6041248)(20161123558100)(20161123562025)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(6072148)(201708071742011);SRVR:CY4PR12MB1304;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:CY4PR12MB1304; X-Forefront-PRVS: 052017CAF1 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(376002)(366004)(39860400002)(346002)(199004)(189003)(24454002)(478600001)(47776003)(97736004)(8676002)(2906002)(31686004)(6666003)(81156014)(2950100002)(86362001)(4326008)(8936002)(81166006)(305945005)(58126008)(7736002)(316002)(36756003)(7416002)(72206003)(31696002)(110136005)(65826007)(54906003)(76176011)(5660300001)(53936002)(23676004)(2486003)(64126003)(67846002)(52116002)(230700001)(52396003)(68736007)(106356001)(50466002)(105586002)(83506002)(1706002)(6486002)(229853002)(59450400001)(6246003)(65956001)(6116002)(65806001)(39060400002)(25786009)(386003)(52146003);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR12MB1304;H:[IPv6:2a02:908:1251:7981:e130:d897:7742:e10e];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjEyTUIxMzA0OzIzOnh0RTRDQTV1S0FOUW14V1FuQkhBaWZiQWRM?= =?utf-8?B?VEh1eityaENPWmpwN3V2VHcxRythb2lVR0tPbVo0RGRla0l0OU9kNHM1aXVy?= =?utf-8?B?VldmWUNSZ1k3MS8xY05jckNmZTN0dzNkRkVRRHFndWtYWThnSUlGUW4wUnQw?= =?utf-8?B?RTJFQTlEWkFQN1QzN2FzcnhvdXZDdi8zNE5wT1R1MVNKU2ZvZTM3UWRzakkv?= =?utf-8?B?Zmp2cXl0eGZuaEJydk5kamFtSU1SbnU4L05ra24xR1MwYjVBTC9wVUpXQ25Q?= =?utf-8?B?YTdCbFBpNk1pejV2OG1GSkF3Ky9RaExWYkRnT3NoV0psamRZUmpwa3VFYW5p?= =?utf-8?B?TXVPU1JHbzlqZ1ZuNXJJRCtmZUtsZkFFOGlRYXhKNS9OaUNBZURGYVNjelBZ?= =?utf-8?B?bW1mRUhQVS9UaWUxc1YxYXdML25vZE9xbTQvOHBzYjA0MGI4b0NJbmMzazkx?= =?utf-8?B?TWhCSFIvd2lzMTNtbUtsMEpJVTA4Ty96bGc3V0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l6jSApY/5jmfmoNOMI=;24:4WTihsB0DYZbLadD8uHuAnfjqb+gCyUOaaGokWA4Y/v0YFd7X14NfpoiuktbEIj5t0ZnX0KeXtzUh+NNuUpCf/+Dr9vm5G4kZS5TuWS2x2U=;7:U7Eniq48+huQIMtzM8vx79OCbDqCSDWZDWNC7jLj5H5E79ACVCW7oOCS5oxqV4uj7hefhUi+WOTXEolKaE5YTcJqxVBANUdh6MXg5wpDTZtktDeACZSAg6l4VffItSfoPvdZKk2HKW92WucXjDZSDFgfigMQLVgyV+SiWPn2QnXtRYcI2nbci3HSJh3cnLUV6aKcP8v6w5kJJgnKelNYbFgSp9K9phzBxyeeWGpoXGR2Q+yO5I2Uo/NRIF7AR6Aa SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1304;20:78bPBL8Fq2cMV0+oGhybsI8bprg8aQ5UMHZmZzDzMmBIMJ8bkAUCAIHtYQT5Xysh36bcKXyLXMuGUth/YlHtx2ybev4UkFveRNjzFuGf5eOATsJ30SJZQ9mHpV2ag/IeXokW5KXls9k2AiOJg2AhDank0CxWiLU0zGY6ftufdaqx9CVT4t0rbcIdpvIq0Jvu0gHatJr0w1RFIpVhwr8tB0R/pFWd9fgRYfXPLpSGf8z5JK0ohC+aQTk2oEgdbSh6 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2017 09:35:10.8564 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1d3c1904-68a5-431b-c592-08d5420cd08c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1304 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1334 Lines: 34 Am 12.12.2017 um 22:28 schrieb David Rientjes: > On Tue, 12 Dec 2017, Dimitri Sivanich wrote: > >>> --- a/drivers/misc/sgi-gru/grutlbpurge.c >>> +++ b/drivers/misc/sgi-gru/grutlbpurge.c >>> @@ -298,6 +298,7 @@ struct gru_mm_struct *gru_register_mmu_notifier(void) >>> return ERR_PTR(-ENOMEM); >>> STAT(gms_alloc); >>> spin_lock_init(&gms->ms_asid_lock); >>> + gms->ms_notifier.flags = 0; >>> gms->ms_notifier.ops = &gru_mmuops; >>> atomic_set(&gms->ms_refcnt, 1); >>> init_waitqueue_head(&gms->ms_wait_queue); >>> diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c >> There is a kzalloc() just above this: >> gms = kzalloc(sizeof(*gms), GFP_KERNEL); >> >> Is that not sufficient to clear the 'flags' field? >> > Absolutely, but whether it is better to explicitly document that the mmu > notifier has cleared flags, i.e. there are no blockable callbacks, is > another story. I can change it if preferred. Actually I would invert the new flag, in other words specify that an MMU notifier will never sleep. The first reason is that we have 8 blocking notifiers and 5 not blocking if I counted right. So it is actually more common to sleep than not to. The second reason is to be conservative and assume the worst, e.g. that the flag is forgotten when a new notifier is added. Regards, Christian.