Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5582616ybp; Tue, 8 Oct 2019 05:20:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqxcMRK+DAD6HcUKYnAVVQ0/E/dHSAYBn3c0vt2Y1OiccjzGjsOQQisae6/XMYvH2SklO6sc X-Received: by 2002:aa7:cb46:: with SMTP id w6mr35247390edt.238.1570537231052; Tue, 08 Oct 2019 05:20:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570537231; cv=none; d=google.com; s=arc-20160816; b=geMMtiG0nFsci2yqbFASc3JbWtfZPSD9Fs6hWAEhBWQjqkiZHu+k9fWhYGBHbnrLjx IoQI74TbitKyDYZ+76EwnK097+Njd8nQ14lF04IC15kD5n0VZr4Lx9YIikmUCOx/H7Qo Ki9xDOVlL9L3b7Uyhzywc7szjqpzvf4DFjp6DDrsqtVTUvV72IQnG2w09XHobBylCjuW 7hDk1JKZ24t1rnYGXYWz755lN+Kciyko08LJE9V9GFDMmszjg32Am/gxh7J/d6vxcBzq aDTBUUa2dXr5Qb353Idc1iZKLbKcCIrNiYKgDx+mZA4e3GO5EOXlRJhInydPIzWi/T7i Wr3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=GIG3/erJQ11vZy1ZvW+DrK2VeOVE/GSaMMKgSlpyZZM=; b=PI4zfXt0ctNx88r3Hjvns5qr7Xn9cV6ZkOEbH5OHzGhJJCSOY5JH/XJyd6/46XdonQ 1kEJ+6P3FSemWvSGSIAN/1I3vVpPLU/A3fBywBIE3EaFcdvuN/3QO/z1qk2exj6aI1VK gi78vmtdrXDq1SG/ViTIuZsj/UFbJDhnr+BdFDK7FSVfDaYGDgu64x1hPt6qljGHS2DO 6JWlYSoYEeWwZireIzQgNFHjU0fPqF0JURNkjNKdwaCexV4g9MtXVjwrTVmrqhZ/Z4Ln ruCEmZ3OtgDOrSEm5c10bb1v7tXMQ4QA2rWEWO6IHptVVCEYc8fsr4NtdJO2HJRuIFEk R9Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mvista-com.20150623.gappssmtp.com header.s=20150623 header.b=twHANZAs; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r8si8692205ejr.33.2019.10.08.05.20.06; Tue, 08 Oct 2019 05:20:31 -0700 (PDT) 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; dkim=pass header.i=@mvista-com.20150623.gappssmtp.com header.s=20150623 header.b=twHANZAs; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730683AbfJHMTt (ORCPT + 99 others); Tue, 8 Oct 2019 08:19:49 -0400 Received: from mail-oi1-f170.google.com ([209.85.167.170]:40960 "EHLO mail-oi1-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730249AbfJHMTt (ORCPT ); Tue, 8 Oct 2019 08:19:49 -0400 Received: by mail-oi1-f170.google.com with SMTP id w65so14561902oiw.8 for ; Tue, 08 Oct 2019 05:19:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mvista-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-disposition:in-reply-to:user-agent; bh=GIG3/erJQ11vZy1ZvW+DrK2VeOVE/GSaMMKgSlpyZZM=; b=twHANZAsI9ZGdyC0yiVIfRbHW/uHdB0ek8OO8I2YmwQCSctRjQmyKBPDcbgdQ/wnLz yDO7ZIuyUhSw6BH/VLK1JibAbSABc+fANVOqVHyvPe/RYjnuZBZm9UKwdEkCpj4FWSIF aY3ItNY+ZlOYc9llnQn5NOFZQHY3+KmYar8KfgA8a8QOKX+krkY2xu1lb+GhHZDVUU+E 1OTWdggfmkf7S4Lkf5nAjFWDeNmGlIEWSkCULequMVcaQmtP8kAHlRnAtsqlPODiBRrb 8NyA2lYpOp9BAECCRhf3fvWGXhL7G/seuKALWC8vzgRJi7CARNelhQyTLIdq1v4uwF8B 940g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:reply-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=GIG3/erJQ11vZy1ZvW+DrK2VeOVE/GSaMMKgSlpyZZM=; b=ec3XYOuiKY+bOPKeZye7kLiXgrCmZNm+JwDLx/jsbNNusRN5VcNwLkyzmgxthHcviV 6iM6OyS+J2V2a2EKwrr1iV1hcKb7mMX4pAFwF13YfmA/qxveyAmBITNrRqA9vUcQGRz+ 0xlqsBbwkK+hy2E9n+3+kzNcPGzstxoLTvEGWv5yb7OvfbMCbESKfNBj0eWKzquzbkAQ 4bfYsissoCS5Sb100CpMrihC8BMse1oZATPJOoS1WmVkMqG/EOCiub+Fznct3JW0RoIG PimfohbiAnBLhyHna2Sn1E5RqROx/Y0sNmTq8/chNgrGXb3h5COVpv8OpYjvwDxXWhGm 6V/A== X-Gm-Message-State: APjAAAWgVHsQZ1qZWzigY4j/KTlKXpeLVBgMGLl+gjpDbLDPtMVwbPbq jA+8IysfTK6TFpGcoKI5U0FehOgGQN8= X-Received: by 2002:a05:6808:4c3:: with SMTP id a3mr3708645oie.82.1570537183673; Tue, 08 Oct 2019 05:19:43 -0700 (PDT) Received: from t560 ([47.184.136.59]) by smtp.gmail.com with ESMTPSA id g8sm5115524otp.42.2019.10.08.05.19.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Oct 2019 05:19:42 -0700 (PDT) Date: Tue, 8 Oct 2019 07:19:41 -0500 From: Corey Minyard To: Pavel Machek , Tejun Heo Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Sasha Levin Subject: Re: [PATCH 4.19 012/106] ipmi_si: Only schedule continuously in the thread in maintenance mode Message-ID: <20191008121941.GA14232@t560> Reply-To: cminyard@mvista.com References: <20191006171124.641144086@linuxfoundation.org> <20191006171130.485953894@linuxfoundation.org> <20191008094915.GC608@amd> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191008094915.GC608@amd> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 08, 2019 at 11:49:15AM +0200, Pavel Machek wrote: > Hi! > > > @@ -1013,11 +1016,20 @@ static int ipmi_thread(void *data) > > spin_unlock_irqrestore(&(smi_info->si_lock), flags); > > busy_wait = ipmi_thread_busy_wait(smi_result, smi_info, > > &busy_until); > > - if (smi_result == SI_SM_CALL_WITHOUT_DELAY) > > + if (smi_result == SI_SM_CALL_WITHOUT_DELAY) { > > ; /* do nothing */ > > - else if (smi_result == SI_SM_CALL_WITH_DELAY && busy_wait) > > - schedule(); > > - else if (smi_result == SI_SM_IDLE) { > > + } else if (smi_result == SI_SM_CALL_WITH_DELAY && busy_wait) { > > + /* > > + * In maintenance mode we run as fast as > > + * possible to allow firmware updates to > > + * complete as fast as possible, but normally > > + * don't bang on the scheduler. > > + */ > > + if (smi_info->in_maintenance_mode) > > + schedule(); > > + else > > + usleep_range(100, 200); > > + } else if (smi_result == SI_SM_IDLE) { > > This is quite crazy code. usleep() will need to do magic with high > resolution timers to provide 200usec sleep... when all you want to do > is unload the scheduler. > > cond_resched() should be okay to call in a loop, can the code use that > instead? According to Tejun Heo, spinning in a loop sleeping was causing all sorts of issues with banging on scheduler locks on systems with lots of cores. I forgot to add him to the CC on the patch, adding him now for comment. If cond_resched() would work, though, I'd be happy with that, it's certainly simpler. -corey > > Best regards, > Pavel > > -- > (english) http://www.livejournal.com/~pavelmachek > (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html