From patchwork Wed Oct 31 23:03:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 149885 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp96599ljp; Wed, 31 Oct 2018 16:05:50 -0700 (PDT) X-Google-Smtp-Source: AJdET5fBG6oXtRu99JohfD3SaDAXB3WEcc/Tr+XWlOxoCtcdUSDvFndIXxhARAGoeozMyCu7F9mA X-Received: by 2002:a62:764e:: with SMTP id r75-v6mr5295787pfc.230.1541027150722; Wed, 31 Oct 2018 16:05:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541027150; cv=none; d=google.com; s=arc-20160816; b=fCxKGLNi+yuthnL99Nb+vBq9CdhjXtCkR3Er5hYe5ZkZSPi+/m4OVfUpOkzGomRNSi 3E2OiNhhD9txCB3ccygZawOEFBtJ3500+M0if9qCowQ+41fsuN51IeDwJOzISmt2NFtG /x+OSjBmgCoim+fMhqsOALa3NXHe3FKgpimZXhLA/HYGb6EBodrGJR6PYjXLpz3SBQKx rYFrNuU1cLEN/5JsV40+awB4ctjs4grA/9PY0yp2FmRXGlRkOrt5m5X3Dwq3nAecZJ50 AviQ2r9NVhB9dYYJH7wsqlVdAanaW0lekgHORCbYqeA8jNG8oisguXjhjcnKiANPKq/b AXsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=tj6iG4luhBGT7lbhLPEFvR9e3OmkqDUbq+DFF/qgcUE=; b=B5ewigyHyn5GOLJYQcAzZ11tSe/YUudREj3Mp4b47MexnbI+7zezw4DANqRFIXSaUg Rsg6216GMx6guKYcWK7skuN5bsU43encfSb7niQ9ycDnAIDCgl6tQXecNcRF4QN69or4 wNjDtGtCibMykLTfTqBJuBbwj/2mOhMdDfOGfMxJQk9jw83dPysgCdsFzyQkAv2F1ATy JGkysqlFcp3qH83f0OxBQrIgcz5FesF5lHO3XTptgYsvflhx8RJ8gvD7dstscgPiMflJ 1ktE6MCbzmKEYQM4FQe0TB64iCsUDzng6C9TS/iQ2nGIxaArmG3pN+d2tdJT0+6oSvNQ 4HDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="oUC1mT7/"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f66-v6si28931028pfc.35.2018.10.31.16.05.50; Wed, 31 Oct 2018 16:05:50 -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=@kernel.org header.s=default header.b="oUC1mT7/"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726522AbeKAIF5 (ORCPT + 32 others); Thu, 1 Nov 2018 04:05:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:52508 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725970AbeKAIFy (ORCPT ); Thu, 1 Nov 2018 04:05:54 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0E57E20821; Wed, 31 Oct 2018 23:05:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027144; bh=xAdmKk/JVjAvz92xh2DUBBvhRaMTlrBku1ZbuEwDElk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oUC1mT7/q5OrtL+fnakt+/wvQzYaog3uYmWrIZzLSfFwUBOlXLlWKIUuioBx/PFcE Zqj32zvhFY+IvEJnoIAebnz1gep/EWzyK05cSY/hQMWcBpln62TH1rMKA38f0GfGSp LGnMonyqyHz4viWw/49RbYBpl3hO3Df7ybZ9Bp60= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ivan Khoronzhuk , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL 4.19 002/146] net: ethernet: ti: cpsw: unsync mcast entries while switch promisc mode Date: Wed, 31 Oct 2018 19:03:17 -0400 Message-Id: <20181031230541.28822-2-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ivan Khoronzhuk [ Upstream commit 9737cc99dd14b5b8b9d267618a6061feade8ea68 ] After flushing all mcast entries from the table, the ones contained in mc list of ndev are not restored when promisc mode is toggled off, because they are considered as synched with ALE, thus, in order to restore them after promisc mode - reset syncing info. This fix touches only switch mode devices, including single port boards like Beagle Bone. Fixes: commit 5da1948969bc ("net: ethernet: ti: cpsw: fix lost of mcast packets while rx_mode update") Signed-off-by: Ivan Khoronzhuk Reviewed-by: Grygorii Strashko Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/ti/cpsw.c | 1 + 1 file changed, 1 insertion(+) -- 2.17.1 diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 832bce07c385..5dd838a67417 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -642,6 +642,7 @@ static void cpsw_set_promiscious(struct net_device *ndev, bool enable) /* Clear all mcast from ALE */ cpsw_ale_flush_multicast(ale, ALE_ALL_PORTS, -1); + __dev_mc_unsync(ndev, NULL); /* Flood All Unicast Packets to Host port */ cpsw_ale_control_set(ale, 0, ALE_P0_UNI_FLOOD, 1); From patchwork Wed Oct 31 23:03:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 149887 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp97171ljp; Wed, 31 Oct 2018 16:06:19 -0700 (PDT) X-Google-Smtp-Source: AJdET5dPDez5nAHZRQ6h05R6Rwe+rISXIhkiEz0zEd4JcQuPZ3SdhSYM+unaNvJ3UZPnQzwrgqbY X-Received: by 2002:a17:902:64:: with SMTP id 91-v6mr5258488pla.161.1541027178981; Wed, 31 Oct 2018 16:06:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541027178; cv=none; d=google.com; s=arc-20160816; b=m4C115WFMuI412+Mvmmo7y7OZPKYmdZ2iAdFbMPXUG+z3tiI6fpKrJsF6FTmAJRkIF DaMaCI4HPeYATG64ynQXRDCTUpqXaStRnr4nmub9CAkvznwACyzqlq84VG35YbJRLcV6 tlnUrZ7ENkKibkmv7k4Kp8f9lNDY9Iu74RiRLnVzdG7e9QmM7Zij31XmzjNIYhS+o/9r nzTujGx+roA123EN2PdX+9uB0Xy/MKL1K7vShW2M/Ns/OZd45BY+BK2cWo+Wa65F7mY8 D8VsddF0Sr1eILeM5bQpMlbtWtjDzLFX+CrCNbaof9WJpoNwGHahdyUNeurIsFlRf6a8 CeZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=I6I/+c4SD5rsUDUlMREsnggf5fF5Gg9VBpT0/rp9Ppk=; b=A0YrZ5zouHE5nAxg09tX5tq5bN0Kxt5KZaCpAo2NNJrdppUxs8INOxfZJEq7PoY7o/ zuT9DYXkHP+Xt5lR+UuolYjiKXt1/CLOovmnTbQr3dK5aX3+MImKL92r2wksJsmfRVOj ixeum0hUSd66qYXQZFkfN3zignRlMeXlNReykXGVL46QRu+3Dd+yUixqQ+zHBr8UIzrv T8I8RJcdKBndyWaImp6N+acbIrEbSvRRp7uxjC7Y/N/NWEyU91UNfB//2tCSxNZa9Ght pnT4MKjGq8c/nzDtaeuVZm6tPE6Ea6iE2Zt7ih+9A+EZuNHFSB9Gzn+HdiL2uaExmkx0 YD2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zIuYon3z; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n67-v6si28439631pga.290.2018.10.31.16.06.18; Wed, 31 Oct 2018 16:06:18 -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=@kernel.org header.s=default header.b=zIuYon3z; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728003AbeKAIG0 (ORCPT + 32 others); Thu, 1 Nov 2018 04:06:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:53318 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727945AbeKAIGZ (ORCPT ); Thu, 1 Nov 2018 04:06:25 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7466120838; Wed, 31 Oct 2018 23:06:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027174; bh=VBXsMqhmxXoiCeVeo9pOALxeXQzW0h+eRtgfqb5gFCs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zIuYon3zBfU3Zb2lNPOZsgia5ZVPO26/tVVOBa2YUWrXF0v25WZ5MlO62bQsRRSlY pA9J8rKQcr+23V8twL9pS4c5+cqpeWigiP1oywuXBWMGse+c5Zc5EORcZ7ZcdvIdvM fseenFEXfKJiHQS2cr7lGUegvLPpUDQjyiQ/K/1A= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Viresh Kumar , Sasha Levin Subject: [PATCH AUTOSEL 4.19 036/146] cpufreq: dt: Try freeing static OPPs only if we have added them Date: Wed, 31 Oct 2018 19:03:51 -0400 Message-Id: <20181031230541.28822-36-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Viresh Kumar [ Upstream commit 51c99dd2c06b234575661fa1e0a1dea6c3ef566f ] We can not call dev_pm_opp_of_cpumask_remove_table() freely anymore since the latest OPP core updates as that uses reference counting to free resources. There are cases where no static OPPs are added (using DT) for a platform and trying to remove the OPP table may end up decrementing refcount which is already zero and hence generating warnings. Lets track if we were able to add static OPPs or not and then only remove the table based on that. Some reshuffling of code is also done to do that. Reported-by: Niklas Cassel Tested-by: Niklas Cassel Signed-off-by: Viresh Kumar Signed-off-by: Sasha Levin --- drivers/cpufreq/cpufreq-dt.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) -- 2.17.1 diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index 0a9ebf00be46..e58bfcb1169e 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c @@ -32,6 +32,7 @@ struct private_data { struct device *cpu_dev; struct thermal_cooling_device *cdev; const char *reg_name; + bool have_static_opps; }; static struct freq_attr *cpufreq_dt_attr[] = { @@ -204,6 +205,15 @@ static int cpufreq_init(struct cpufreq_policy *policy) } } + priv = kzalloc(sizeof(*priv), GFP_KERNEL); + if (!priv) { + ret = -ENOMEM; + goto out_put_regulator; + } + + priv->reg_name = name; + priv->opp_table = opp_table; + /* * Initialize OPP tables for all policy->cpus. They will be shared by * all CPUs which have marked their CPUs shared with OPP bindings. @@ -214,7 +224,8 @@ static int cpufreq_init(struct cpufreq_policy *policy) * * OPPs might be populated at runtime, don't check for error here */ - dev_pm_opp_of_cpumask_add_table(policy->cpus); + if (!dev_pm_opp_of_cpumask_add_table(policy->cpus)) + priv->have_static_opps = true; /* * But we need OPP table to function so if it is not there let's @@ -240,19 +251,10 @@ static int cpufreq_init(struct cpufreq_policy *policy) __func__, ret); } - priv = kzalloc(sizeof(*priv), GFP_KERNEL); - if (!priv) { - ret = -ENOMEM; - goto out_free_opp; - } - - priv->reg_name = name; - priv->opp_table = opp_table; - ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table); if (ret) { dev_err(cpu_dev, "failed to init cpufreq table: %d\n", ret); - goto out_free_priv; + goto out_free_opp; } priv->cpu_dev = cpu_dev; @@ -282,10 +284,11 @@ static int cpufreq_init(struct cpufreq_policy *policy) out_free_cpufreq_table: dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table); -out_free_priv: - kfree(priv); out_free_opp: - dev_pm_opp_of_cpumask_remove_table(policy->cpus); + if (priv->have_static_opps) + dev_pm_opp_of_cpumask_remove_table(policy->cpus); + kfree(priv); +out_put_regulator: if (name) dev_pm_opp_put_regulators(opp_table); out_put_clk: @@ -300,7 +303,8 @@ static int cpufreq_exit(struct cpufreq_policy *policy) cpufreq_cooling_unregister(priv->cdev); dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table); - dev_pm_opp_of_cpumask_remove_table(policy->related_cpus); + if (priv->have_static_opps) + dev_pm_opp_of_cpumask_remove_table(policy->related_cpus); if (priv->reg_name) dev_pm_opp_put_regulators(priv->opp_table); From patchwork Wed Oct 31 23:03:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 149888 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp97220ljp; Wed, 31 Oct 2018 16:06:21 -0700 (PDT) X-Google-Smtp-Source: AJdET5cWWncgQF3/yI3UcIfHM/RBrgj1zPtXCCCO+Y15fkVPSvdcC0DEhL5eH9ng8CGeN8RhKD6+ X-Received: by 2002:a62:4784:: with SMTP id p4-v6mr5162073pfi.257.1541027181500; Wed, 31 Oct 2018 16:06:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541027181; cv=none; d=google.com; s=arc-20160816; b=nyBKuKydzSuGndKmWBhQp/QgJgaQ9EroPQgGwnLCHteT2GHAMCnYlbCy75MGeQZc14 50RfTSku5SOs+pCdGklWHm6aHhUIA76vMnmkbhANt3wRxeaxj1CLYXiAKAEOdQ2mV8EN kPc/Cc4u41QY5v44A3WV6WBn/TkFAhg/u31ndCXlaKTHkPsEMOQXwJ8bDJzzyi3LQ/iK zL3XyYFFMyJPo7RkQ5bXuOCGrY/bct89D5aNeBEMw09DIl+KUjZDIkyc9+aZ/Mj4LvbU ecqCGORNPSLMoA9w+UlVE2Uk2/55CvpTfk0SuPXcOfKV0EqaPFpdIlldkgOrSyeTd9F0 6JTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=DkHASvWaQzP46fVNTllqBG+7zWgY5xyiIuvOH1yIhgI=; b=o06+56JOY5XOYEQ3HcHQk9LXAf+DLed5UHmCbewqCGS0o+9U0yBv4anBTDls/attYJ 50DvTTRUicEcxSN2KA/9jvmBa1G5ulUI97b7W2U2rTAwYf3NZfw/DrTTuh/gu5MpiGvN YMJXqP7pPR5ymNNJGX2uHDX8kszi3+aYEys5neZEGxwDx2V6BlbS0IXnZU11CYXZpb3v PlZl8KpCW2mmv680sMAimOiCaoCJK6/zuSsH9fkWVU5wrDd45lIqMLOQfKyXMr3zctCA SsiHmwLcZ0lYEr7DO555uBF9FhKd6pis0kuFC2aldRhOocO5f8BG5KMwE6f+z90bctvh qiCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=REo4rJFk; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cf14-v6si28182542plb.422.2018.10.31.16.06.20; Wed, 31 Oct 2018 16:06:21 -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=@kernel.org header.s=default header.b=REo4rJFk; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728039AbeKAIG2 (ORCPT + 32 others); Thu, 1 Nov 2018 04:06:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:53388 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727984AbeKAIG2 (ORCPT ); Thu, 1 Nov 2018 04:06:28 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1A2BF2081B; Wed, 31 Oct 2018 23:06:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027177; bh=xixfP+2xcVyJj/LcGiNejEQLYC1PYTYpBTx80WWdXr0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=REo4rJFkAAWx9+4hH/19eixCsQTgajzWU9F5x3HONd37GsUDVFr1te/pml9h9cBHc n0mVSuPdlYGOf2HX6zwNssOJV+zcpb+1Yzl6+lB/Y4/8QiYpma7InJJ3ip0OSE+UWk VsoZjpHLVoCqagjCQN2a+IKjOYHP3Xyn5k4P8e14= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Linus Walleij , Mark Brown , Sasha Levin Subject: [PATCH AUTOSEL 4.19 039/146] regulator: fixed: Default enable high on DT regulators Date: Wed, 31 Oct 2018 19:03:54 -0400 Message-Id: <20181031230541.28822-39-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Linus Walleij [ Upstream commit 28be5f15df2ee6882b0a122693159c96a28203c7 ] commit efdfeb079cc3 ("regulator: fixed: Convert to use GPIO descriptor only") switched to use gpiod_get() to look up the regulator from the gpiolib core whether that is device tree or boardfile. This meant that we activate the code in a603a2b8d86e ("gpio: of: Add special quirk to parse regulator flags") which means the descriptors coming from the device tree already have the right inversion and open drain semantics set up from the gpiolib core. As the fixed regulator was inspected again we got the inverted inversion and things broke. Fix it by ignoring the config in the device tree for now: the later patches in the series will push all inversion handling over to the gpiolib core and set it up properly in the boardfiles for legacy devices, but I did not finish that for this kernel cycle. Fixes: commit efdfeb079cc3 ("regulator: fixed: Convert to use GPIO descriptor only") Reported-by: Leonard Crestez Reported-by: Fabio Estevam Reported-by: John Stultz Reported-by: Anders Roxell Signed-off-by: Linus Walleij Tested-by: John Stultz Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/regulator/fixed.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c index 988a7472c2ab..d68ff65a5adc 100644 --- a/drivers/regulator/fixed.c +++ b/drivers/regulator/fixed.c @@ -84,9 +84,14 @@ of_get_fixed_voltage_config(struct device *dev, of_property_read_u32(np, "startup-delay-us", &config->startup_delay); - config->enable_high = of_property_read_bool(np, "enable-active-high"); - config->gpio_is_open_drain = of_property_read_bool(np, - "gpio-open-drain"); + /* + * FIXME: we pulled active low/high and open drain handling into + * gpiolib so it will be handled there. Delete this in the second + * step when we also remove the custom inversion handling for all + * legacy boardfiles. + */ + config->enable_high = 1; + config->gpio_is_open_drain = 0; if (of_find_property(np, "vin-supply", NULL)) config->input_supply = "vin"; From patchwork Wed Oct 31 23:04:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 149921 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp133795ljp; Wed, 31 Oct 2018 16:49:56 -0700 (PDT) X-Google-Smtp-Source: AJdET5dUyidoFsYZIN75pxrlXVYyoiAgYwL0DdZg40+CeXpwwabPxIkWxaG/THUWmhvF+ULmT8uG X-Received: by 2002:a62:1e83:: with SMTP id e125-v6mr5294386pfe.231.1541029795956; Wed, 31 Oct 2018 16:49:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541029795; cv=none; d=google.com; s=arc-20160816; b=IyYOp6qo52orOqZWm3fZ9J00oYPXQLYH7O+wM63xTyqFbYjadsq2E1m+Dru0E2HRNo 6+6KH5vM4R0Vn5qG+m0CD++UHjzD3BbiFJsqGABzkUh6FbYbEqiF6VyHWu21bE0RQnSg 8+qIMH2OnTUDu6zGr7PAKfWMql0hsAD/kGKpDA+QSz0iDQDJHy0+EuU8P1WPtx27N3VR eZSAQPE5kyBGPW/XYhDwGuYvYGBrn/R1Mgvi1UiA6yOW5qGQ+QtjZKOHNXl3OSMpfbDC NbvJgoWfcjZXEIh2Y7dsjWUaPt/rd0dX14bXwEqjkuBi4KWxuFfq3qjY3NNu+1ioAQRJ Empg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=+UN9WAlyAEd1rHaVjk5i/P+7oFV9Y7nahZa5UfGhzjk=; b=Z78WlqFXvRFIuOs8HyTPqieZVf0PR5dsaZ2FgRb/EESrxxIx4RMvG/EH9IcvkasR97 /8FiXOapx+hw7P6hE6NB+CYgQdENIoau2o2jry54YaRKFtKpmdAS+8P5kP9LgtroW6hn LeMdNpbbcxr90WUvIFs0ipk6K+vPBHm723FU8PDO9f4RWK75RZxUWCwq8KiQ9efat32L B9qqdua/87UO1BHj3/9H9aFdpWMhStazLiWgb0zDisioXJnfq8BmawKD0Q30kVQYJjHW 9/1UBgW4WT1jHFNZPEDG5GNIivbi1QWVngknM+P0oFcLGJvK5IC05yrP7AYWF1jMkh2C Vu3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DNlNTCbV; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i25-v6si28306445pgi.426.2018.10.31.16.49.55; Wed, 31 Oct 2018 16:49:55 -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=@kernel.org header.s=default header.b=DNlNTCbV; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728521AbeKAIuQ (ORCPT + 32 others); Thu, 1 Nov 2018 04:50:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:53896 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728302AbeKAIGp (ORCPT ); Thu, 1 Nov 2018 04:06:45 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5492720847; Wed, 31 Oct 2018 23:06:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027194; bh=d/cCpngJZP2Z64V1gm6LunSqQ1BiPpcrNH28VDpTI8A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DNlNTCbVeSmqNvVrOKWPSkGp+DeTA3mw05MVwGQJgnNFsxOaBkDGucJV009l2FKnb iBGwxENdgPuKX8+stYa8Q/kV+x+NpoPGuWbovnOFM9TStMC2JERafBZiLFQlGmHTer CTjCiwBc4R/rtIHTGzWIFAcOmoSU3dj8wpY1zT8o= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Paolo Valente , Jens Axboe , Sasha Levin Subject: [PATCH AUTOSEL 4.19 058/146] block, bfq: correctly charge and reset entity service in all cases Date: Wed, 31 Oct 2018 19:04:13 -0400 Message-Id: <20181031230541.28822-58-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Paolo Valente [ Upstream commit cbeb869a3d1110450186b738199963c5e68c2a71 ] BFQ schedules entities (which represent either per-process queues or groups of queues) as a function of their timestamps. In particular, as a function of their (virtual) finish times. The finish time of an entity is computed as a function of the budget assigned to the entity, assuming, tentatively, that the entity, once in service, will receive an amount of service equal to its budget. Then, when the entity is expired because it finishes to be served, this finish time is updated as a function of the actual service received by the entity. This allows the entity to be correctly charged with only the service received, and then to be correctly re-scheduled. Yet an entity may receive service also while not being the entity in service (in the scheduling environment of its parent entity), for several reasons. If the entity remains with no backlog while receiving this 'unofficial' service, then it is expired. Also on such an expiration, the finish time of the entity should be updated to account for only the service actually received by the entity. Unfortunately, such an update is not performed for an entity expiring without being the entity in service. In a similar vein, the service counter of the entity in service is reset when the entity is expired, to be ready to be used for next service cycle. This reset too should be performed also in case an entity is expired because it remains empty after receiving service while not being the entity in service. But in this case the reset is not performed. This commit performs the above update of the finish time and reset of the service received, also for an entity expiring while not being the entity in service. Signed-off-by: Paolo Valente Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- block/bfq-wf2q.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/block/bfq-wf2q.c b/block/bfq-wf2q.c index ae52bff43ce4..ff7c2d470bb8 100644 --- a/block/bfq-wf2q.c +++ b/block/bfq-wf2q.c @@ -1181,10 +1181,17 @@ bool __bfq_deactivate_entity(struct bfq_entity *entity, bool ins_into_idle_tree) st = bfq_entity_service_tree(entity); is_in_service = entity == sd->in_service_entity; - if (is_in_service) { - bfq_calc_finish(entity, entity->service); + bfq_calc_finish(entity, entity->service); + + if (is_in_service) sd->in_service_entity = NULL; - } + else + /* + * Non in-service entity: nobody will take care of + * resetting its service counter on expiration. Do it + * now. + */ + entity->service = 0; if (entity->tree == &st->active) bfq_active_extract(st, entity); From patchwork Wed Oct 31 23:04:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 149890 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp97561ljp; Wed, 31 Oct 2018 16:06:39 -0700 (PDT) X-Google-Smtp-Source: AJdET5cRsThLDWQGNCCooXdfReOmn21db1KEPsddK8HO/cbQPOlwHD988hNyEwugY/dDF1uu/Zka X-Received: by 2002:a62:cc4:: with SMTP id 65-v6mr5253646pfm.127.1541027199493; Wed, 31 Oct 2018 16:06:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541027199; cv=none; d=google.com; s=arc-20160816; b=I++LhoNfQo23/74BYIXb3u0x7eP6RXpRylw4bT/AUfrAprLS1jnnHVLwFIpUO+Zr3+ D7zY2SSocJ1e4MdxfK34FT9kONXpPKOBeKvqkU03xYKQfckx6jfYUoHo8hNxKq6/1ftL QmQxow5e8kZQY4bVhWm9sSTUcJKM0M57fRMhlGDLAiNKV/XRevMXrqrX06prJ60lir+H qdXzzmjDbbXRmbcLFcEubRSMNq6IQGcqJkpqZ04WpQLJuRal5HIVrWmenx5r/0CM3fI7 EWOoDtprJKwybXorx1F0S3kLCHoCP7TyZmtK/zf9XyfIm19pGzshBgNRU3RfV+yCwLAz VLHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=blAKvVLFvLojGzhhtzh9H7sgMmwUksxipShHtmyKVSU=; b=EZUlqJ1znXrbmIyuxmw66C+eCJA+nnZme4eP6oMdDkT2ik02AHOlBnnUPMXX5wAK9k vs8+G4bkscUdJ/jlqCz858+VUH8J9VvWJ9aM/++epPMFUnk222AWh2bvTXQRAwOovM2G 0WkvxHNYECR3ZhX0h+iK27qV2nzUjx0skdWpn1r2VBQdWwL35MUMPnbrDBD+JhNRMbmZ 5yNjG7rfQ3GmQgxBeS+OeiKod1fzKSUSkVAeK+7Af5d06OtWRINjg2ohETchoXq0u3cU 64ed0y6YkspAYypU1Kv47r+co2yIngczF+awYjjRsFm64TMFPcGeJxXF0VmNhmznhcR0 YdJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="K/0EarHu"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p12-v6si30763165pll.1.2018.10.31.16.06.39; Wed, 31 Oct 2018 16:06:39 -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=@kernel.org header.s=default header.b="K/0EarHu"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728344AbeKAIGr (ORCPT + 32 others); Thu, 1 Nov 2018 04:06:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:53942 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728327AbeKAIGq (ORCPT ); Thu, 1 Nov 2018 04:06:46 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2976420848; Wed, 31 Oct 2018 23:06:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027195; bh=QDC0TrLDjh7aIeb4fIot4Qxg9H6BuU/V2SPXreVQJaE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K/0EarHur9QqcHMQsK+MhDccWzCqFpJoYpz4t5Izzw69v5mt10knGLpWwZTfbk0TG 348YcE+TpYOLrzLIZjVLlLe9YB/cX8UpOg4h9KNqiPszVs+ImJT1Q4tjEnvsg13q6E w1TkopWAUtzzjzPRyrDLnvR39zmhNYoaWANTHNBc= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Will Deacon , Catalin Marinas , Sasha Levin Subject: [PATCH AUTOSEL 4.19 059/146] arm64: entry: Allow handling of undefined instructions from EL1 Date: Wed, 31 Oct 2018 19:04:14 -0400 Message-Id: <20181031230541.28822-59-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Will Deacon [ Upstream commit 0bf0f444b2c49241b2b39aa3cf210d7c95ef6c34 ] Rather than panic() when taking an undefined instruction exception from EL1, allow a hook to be registered in case we want to emulate the instruction, like we will for the SSBS PSTATE manipulation instructions. Signed-off-by: Will Deacon Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin --- arch/arm64/kernel/entry.S | 2 +- arch/arm64/kernel/traps.c | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 09dbea221a27..8556876c9109 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -589,7 +589,7 @@ el1_undef: inherit_daif pstate=x23, tmp=x2 mov x0, sp bl do_undefinstr - ASM_BUG() + kernel_exit 1 el1_dbg: /* * Debug exception handling diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index 039e9ff379cc..b9da093e0341 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -310,10 +310,12 @@ static int call_undef_hook(struct pt_regs *regs) int (*fn)(struct pt_regs *regs, u32 instr) = NULL; void __user *pc = (void __user *)instruction_pointer(regs); - if (!user_mode(regs)) - return 1; - - if (compat_thumb_mode(regs)) { + if (!user_mode(regs)) { + __le32 instr_le; + if (probe_kernel_address((__force __le32 *)pc, instr_le)) + goto exit; + instr = le32_to_cpu(instr_le); + } else if (compat_thumb_mode(regs)) { /* 16-bit Thumb instruction */ __le16 instr_le; if (get_user(instr_le, (__le16 __user *)pc)) @@ -407,6 +409,7 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs) return; force_signal_inject(SIGILL, ILL_ILLOPC, regs->pc); + BUG_ON(!user_mode(regs)); } void cpu_enable_cache_maint_trap(const struct arm64_cpu_capabilities *__unused) From patchwork Wed Oct 31 23:04:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 149891 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp97588ljp; Wed, 31 Oct 2018 16:06:41 -0700 (PDT) X-Google-Smtp-Source: AJdET5e2IFtr0eHfa6duKR51+ANdX7mENDCNCCmzooU5FY2fPWWYw47RHLtW9vQ/YI5PznkoAviq X-Received: by 2002:a63:1c64:: with SMTP id c36-v6mr4781132pgm.354.1541027201493; Wed, 31 Oct 2018 16:06:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541027201; cv=none; d=google.com; s=arc-20160816; b=jrch76hXsge9KmN528UajwOv9hH2iiwInsbBmAqZ1Y8N8oBm39WJSdUZw0Dth+q+uq PnjjRXvgeQ/9L1SdKNrMjlp6UR0YGOHmB9FJXjMcHSq/LypJevpirjWx23c/kp2WNiqA s9kWP80wVxTiHA1ACuUe/Be+ocVt1aCF0AeVv07g9A6d1tle6YloVpQmfRaFsrozFtEd dEikUJZg6/xcN71HhvYZV7DClP2zuMkIaGmaHXhIcLiSUfAdD0PhFGil9lMsTkutf1N9 0uMFmD1GOEJP0XqE9tQ8U4rBKI5yLg8f1CY2WJXjiaFFAjMiFjEKnXIe3HZDl84ZfgYx 4Eyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=JNgTKZnMVltM8xKi8i2i8rOuwxhadt5WKu+HBzvahUQ=; b=fqHQB0nZnG1OuGvHGE3CZGyZ/vDbwA1OEn1iLG4dMTN2WbK9HHy9szC4suFYEnNOim 6WkSEBjgecTMRYH9ufP7sC+J9NUEG93PYYphzJ/TdZnsyApuqvQUFHXFZUG54kq0h0jE IZuP1fUyovSMgR170uHpFp5ZSkfqD9dFnCfA8Iu5TCxtuCb+WzpKOFixAv1zTVpkLYJj GtGhNInbR3jnvYLQPbAWFxaIxnlZG6WeEVNp3v2NWOWqmxLJzme3Lh556CFaGjQ6oTxw qn0k5/Sn4WkquE8Awz6o1zXekZcI/9Edk51tRTvgKrnK/IgvvDPvtM2WjOrUbOTf7LMH KowQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zYGfEk18; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z11-v6si28545078pgf.66.2018.10.31.16.06.41; Wed, 31 Oct 2018 16:06:41 -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=@kernel.org header.s=default header.b=zYGfEk18; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728380AbeKAIGt (ORCPT + 32 others); Thu, 1 Nov 2018 04:06:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:54008 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728327AbeKAIGs (ORCPT ); Thu, 1 Nov 2018 04:06:48 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 51E0420847; Wed, 31 Oct 2018 23:06:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027198; bh=WAXB0/E6x4DAvDqq1CJ3xnMFuKPtDE5Y1k20A+UwjEA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zYGfEk18zhe4zRVbnNm6ZsacRUg3qW7OHJ+2nLuFOhUKwz8KJq2u0iI5xqbn6oZgs 6WBseVcoKycgZochrehrIQgOKsPjn2RoTJ+26wPDNBQOSy5uUQJRwHFkRPXV/8gm4R eqPtqkCVlfANcT40/9LGg8WDASlvu41ICSuo1DM4= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Linus Walleij , Andrzej Hajda , Lorenzo Bianconi , Mark Brown , Sasha Levin Subject: [PATCH AUTOSEL 4.19 061/146] spi: gpio: No MISO does not imply no RX Date: Wed, 31 Oct 2018 19:04:16 -0400 Message-Id: <20181031230541.28822-61-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Linus Walleij [ Upstream commit abf5feef3ff0cefade0c76be53b59e55fdd46093 ] There is a logical problem in spi-gpio with host just assigning a MOSI line and no MISO: this is interpreted as the host cannot do RX and the host is flagged with SPI_MASTER_NO_RX. This is wrong: since GPIO lines can switch direction, in 3WIRE operation the host will simply reverse the direction of the GPIO line and start reading from it, there is even code for doing this in the driver, but it went unnoticed because it was tested by using a master with 4 wires but a device using just 3 wires. Remove the offending flag. Cc: Andrzej Hajda Cc: Lorenzo Bianconi Signed-off-by: Linus Walleij Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-gpio.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c index 421bfc7dda67..088772ebef9b 100644 --- a/drivers/spi/spi-gpio.c +++ b/drivers/spi/spi-gpio.c @@ -295,9 +295,11 @@ static int spi_gpio_request(struct device *dev, spi_gpio->miso = devm_gpiod_get_optional(dev, "miso", GPIOD_IN); if (IS_ERR(spi_gpio->miso)) return PTR_ERR(spi_gpio->miso); - if (!spi_gpio->miso) - /* HW configuration without MISO pin */ - *mflags |= SPI_MASTER_NO_RX; + /* + * No setting SPI_MASTER_NO_RX here - if there is only a MOSI + * pin connected the host can still do RX by changing the + * direction of the line. + */ spi_gpio->sck = devm_gpiod_get(dev, "sck", GPIOD_OUT_LOW); if (IS_ERR(spi_gpio->sck)) @@ -423,7 +425,7 @@ static int spi_gpio_probe(struct platform_device *pdev) spi_gpio->bitbang.chipselect = spi_gpio_chipselect; spi_gpio->bitbang.set_line_direction = spi_gpio_set_direction; - if ((master_flags & (SPI_MASTER_NO_TX | SPI_MASTER_NO_RX)) == 0) { + if ((master_flags & SPI_MASTER_NO_TX) == 0) { spi_gpio->bitbang.txrx_word[SPI_MODE_0] = spi_gpio_txrx_word_mode0; spi_gpio->bitbang.txrx_word[SPI_MODE_1] = spi_gpio_txrx_word_mode1; spi_gpio->bitbang.txrx_word[SPI_MODE_2] = spi_gpio_txrx_word_mode2; From patchwork Wed Oct 31 23:04:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 149892 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp98106ljp; Wed, 31 Oct 2018 16:07:10 -0700 (PDT) X-Google-Smtp-Source: AJdET5eQK7IgpjJlSc+8mJJ1dP9laIJp3kXS+7LsfdYc3X6arl2La33dtCA/cvwmBoMPxRaew3SQ X-Received: by 2002:a62:1e42:: with SMTP id e63-v6mr5234447pfe.149.1541027230371; Wed, 31 Oct 2018 16:07:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541027230; cv=none; d=google.com; s=arc-20160816; b=OgMsdDQR+x9RbUbD5MALMR1bXzo5gBVcjK3KQNC2jxyFug1jlv5kBu/3T/2HQwziLF JSIbk/K5LIQzXw5d0LkW1jZwGIxDzoF/qOgFp7I/TbfNZwYQG2XeiA92mn9s6bOw+VQn wrDeF5OtF1Vy+uwjgHvJtu853Xbwbk/e2PDQ+yt05/hGvGOjhEfFcVpSCOxwdGVQMyU/ 44uBNTmHXqxfl60dTHSYSNXcUW0B1WM9t9o9FeYL0CA5bjFFTQWOg1c2mHRtCPgbkYe8 +akBKJZtF8QH2MAl97PqU/7l5xDQNjEI/SVtbPlGz1b+3adOdQz3e5evW/639P1Mz8/H 7ecw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=gxXYA0wLy9+nkmr6mmkEHQ4J73Eqmqq1nSKlwtdUBYY=; b=dp5hGK2a/pPOIhqTk1i2r7mglS3x9v2JqEvrUKPdPu2OIpMmxbAHgUaEhUTnWvk57q KdxbXtZ/riNCP2H8p3eBuUbptnZsZrNv8sBCHlXDSsYFgygc1cKdYA8fAJ5lKyNsT4Ma C0qssFPKMimhd2jOBkrfWJ+MJgV1NVJIYwpYlqcKMuEoI76fTMll0IHopMNN1fMEvDB0 Ms8vaYi/n7bOGmbo3tpr8Fe8YiIhrF0Rro6gmftTtJA9NdTtcd0Po0TQDlgqbWIvxYNo YEDbWcCTa4jplaTWYohpqMoeN0kj0kDQIgGeCEbxzaHtAJnsXVO4rGYYqydlMTNsRTtc tZLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gPWhmBcU; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f88-v6si29689616pfe.243.2018.10.31.16.07.09; Wed, 31 Oct 2018 16:07:10 -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=@kernel.org header.s=default header.b=gPWhmBcU; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728779AbeKAIHS (ORCPT + 32 others); Thu, 1 Nov 2018 04:07:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:54876 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728703AbeKAIHQ (ORCPT ); Thu, 1 Nov 2018 04:07:16 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CC56C2064C; Wed, 31 Oct 2018 23:07:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027225; bh=3JtbUwR8XOp8MBQdW7nl0+6wkKqNfq9/3CsuUtWuzvA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gPWhmBcUNGM3x6wIbj6ChPPvs+kVnYKTfp7VkOjxYINN1sFWFRi6ZfC3a67DuMPKT THcqYTnxuSVncO45rgGa2gnoADTYPh1X4Yy8Ioms58rEnKVv9MUnBFyEhpasabIv/W 5Q5EkD9mgY6w2tttTPxZaTU2J8lR0kChJmRgAyyY= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Rob Herring , Sasha Levin Subject: [PATCH AUTOSEL 4.19 091/146] of: Add missing exports of node name compare functions Date: Wed, 31 Oct 2018 19:04:46 -0400 Message-Id: <20181031230541.28822-91-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rob Herring [ Upstream commit 173ee3962959a1985a109f81539a403b5cd07ae7 ] Commit f42b0e18f2e5 ("of: add node name compare helper functions") failed to add the module exports to of_node_name_eq() and of_node_name_prefix(). Add them now. Fixes: f42b0e18f2e5 ("of: add node name compare helper functions") Signed-off-by: Rob Herring Signed-off-by: Sasha Levin --- drivers/of/base.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.17.1 diff --git a/drivers/of/base.c b/drivers/of/base.c index 74eaedd5b860..70f5fd08891b 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -67,6 +67,7 @@ bool of_node_name_eq(const struct device_node *np, const char *name) return (strlen(name) == len) && (strncmp(node_name, name, len) == 0); } +EXPORT_SYMBOL(of_node_name_eq); bool of_node_name_prefix(const struct device_node *np, const char *prefix) { @@ -75,6 +76,7 @@ bool of_node_name_prefix(const struct device_node *np, const char *prefix) return strncmp(kbasename(np->full_name), prefix, strlen(prefix)) == 0; } +EXPORT_SYMBOL(of_node_name_prefix); int of_n_addr_cells(struct device_node *np) { From patchwork Wed Oct 31 23:05:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 149893 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp98645ljp; Wed, 31 Oct 2018 16:07:43 -0700 (PDT) X-Google-Smtp-Source: AJdET5e30wZc9SNS3xCiz7YClrVclKI7ChQoMUYw5eInR0rCIE99KLDVCGSG4ibFhFMkzJJ1SDsv X-Received: by 2002:a17:902:30f:: with SMTP id 15-v6mr5269369pld.155.1541027263768; Wed, 31 Oct 2018 16:07:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541027263; cv=none; d=google.com; s=arc-20160816; b=bzFuTThQtOBKXGM8qemw86AEF4j+tpgS1XynIMbVRUrvqPOUdtqJTV69jEMc//kjq+ MusDXCvO7fVR5Y++ez0JyhsaX6fblQTTD4Cx1DkRcb3eveusGa0mXb34KWDJm6feCxbu 7d+Bq0ndPjt7b6Xa7UwCNOH+SjugtLjgTQGsaeE4g68OoQ8BZsMpS2NkK2uFX5Hqdru5 /BO2Dp9ek7nGN+eV3Fb36BJ2/5qkY7i5tqfUpD+64Ei0YFot9ZxGv86D//5M1BPB8FS2 gLn39aKhq52MoJ3GH39/EQziPyDFs3unmdha0CiQSBoke3xJ+a5U6UklucukIuRNjXI5 463w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=yMlD8LXwbhIs2GJ7LmL1+bQOw7qO2HPgxcRlJjJOW4A=; b=XMdG5BAmaKr0cqRxfPycYn3mmpq5bzi5AG5pi7cFBPtyq0kOmTM+WlK9xSqo3NUSSl GuXqUXFzm2tFgwUfzTXNt9WMECxtoR5H23V3g8Lt4HqTsux6NXgHuW23PvHH1DCtd7LG uTk6ylqVCAP4sTyzFtLkxvVgS/ORHEb0o18TVuqyQpoT9DS2nGyyh+eFTpKELyJ9VFbE Dtm0DJ9rGir+vMceoGlI+EeSFq9kgnFuZwTmKfHaNl55SgDRos4mpHxhRB9Ui21krALZ GxGlhVPMXC8vpLqlz4pwE+3cY/GoG++Dy++oJedR/zhjVf/FGmc6Dkl4QCepd9MxE8UE Lgnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yqGot5v2; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s132-v6si29801176pgs.492.2018.10.31.16.07.43; Wed, 31 Oct 2018 16:07:43 -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=@kernel.org header.s=default header.b=yqGot5v2; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729222AbeKAIHu (ORCPT + 32 others); Thu, 1 Nov 2018 04:07:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:55980 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729150AbeKAIHs (ORCPT ); Thu, 1 Nov 2018 04:07:48 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BC8D520830; Wed, 31 Oct 2018 23:07:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027258; bh=8YA0vWFhpY+Sn68jT8xm6ghQKKZys++ILysgTsBS9rE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yqGot5v2fHi4nTUaHEyg1SHYxD91jCt8nrTNewbBmZhmC0sTnjl7Whg/clZg7Hw3V 19chwncKgQOi6j0Hmqry3YdTZ1NZsgRLlW/zKU3z2zEQx7wAQmUXCg1QpP+VEopeFT Bp+t6VkMrmZYi/95Go8KYp6OfV8u4ymIbWLWYWtw= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Loic Poulain , Peter Chen , Sasha Levin Subject: [PATCH AUTOSEL 4.19 129/146] usb: chipidea: Prevent unbalanced IRQ disable Date: Wed, 31 Oct 2018 19:05:24 -0400 Message-Id: <20181031230541.28822-129-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Loic Poulain [ Upstream commit 8b97d73c4d72a2abf58f8e49062a7ee1e5f1334e ] The ChipIdea IRQ is disabled before scheduling the otg work and re-enabled on otg work completion. However if the job is already scheduled we have to undo the effect of disable_irq int order to balance the IRQ disable-depth value. Fixes: be6b0c1bd0be ("usb: chipidea: using one inline function to cover queue work operations") Signed-off-by: Loic Poulain Signed-off-by: Peter Chen Signed-off-by: Sasha Levin --- drivers/usb/chipidea/otg.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/usb/chipidea/otg.h b/drivers/usb/chipidea/otg.h index 7e7428e48bfa..4f8b8179ec96 100644 --- a/drivers/usb/chipidea/otg.h +++ b/drivers/usb/chipidea/otg.h @@ -17,7 +17,8 @@ void ci_handle_vbus_change(struct ci_hdrc *ci); static inline void ci_otg_queue_work(struct ci_hdrc *ci) { disable_irq_nosync(ci->irq); - queue_work(ci->wq, &ci->work); + if (queue_work(ci->wq, &ci->work) == false) + enable_irq(ci->irq); } #endif /* __DRIVERS_USB_CHIPIDEA_OTG_H */ From patchwork Wed Oct 31 23:05:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 149920 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp127173ljp; Wed, 31 Oct 2018 16:42:07 -0700 (PDT) X-Google-Smtp-Source: AJdET5eDiGHDac8ZeKFhsFL1sR4p19zf+SPL/+/lbT8swECcRxRgQz9Pk/LZzR3ERdNrv40zS7TU X-Received: by 2002:a17:902:2d81:: with SMTP id p1-v6mr1753781plb.97.1541029327579; Wed, 31 Oct 2018 16:42:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541029327; cv=none; d=google.com; s=arc-20160816; b=pPUoWLeoKjZmgT2+kqZ/eGTosXPVNdDpmDBiw+jW9wcVmTw0xPc9Km5Dsb/Ui5gc58 KxCUhWHVQfWnDP4zYXgk20ZoVf+C5AlkfYOc+f/vrtttPfiQcaE5WyLj3VxR0o65nOCG KtIddP9RK0vulm2ctsdrfBbnnAEA6HcQ35tUXrQV8TP9DwadYEPP1OsBtyWANuC7hxlZ 0QvV/+H01kkl2o66hhTo+Gl1kWYKIech1LOwo1xGgLqY25qKEOWHzXVIiasOJHIsa9C8 O51FFE9YFLStSgdc9mjJ0wkddl+gJhHaY6rm6BOSl0/vSiIk01kzy5LwArSsmy4DBWYE xmlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=jUA0osDbhadJMPTsXiziXhbkcNS90V8shH28lkdFbCM=; b=QjHAkbQRLebGEzyVnlg5axTubhLuT7P91NeTbJ72S33QuSyLAvZZdEDhXasONIQtiD O4lioiQWJrxgfU7A/if6oGey89Q0m8/5tTP4d6UShyT7SvF4n43KME/AHotq8vYl45Aw GUmxD2C4sMnqL5mUkeN+QNkjg9B25a0vLZXcoewERVvmIsJ1xqOa7dYBN6A1mHcT6lmp uafDTmKoqPyJe4zfflOEbU26MdCBBUA+YfQ0OIncEvLApJJYEPgJnF2nv5cqlckCjez4 mmkeTydBcjj0GCFxzF6h+U/ZT2ayNs0DwRo/T9KBBT2PyOcexBiPsJv6lSybvRCwYxo1 /oXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="N7/fpJ+5"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n26-v6si11639032pfe.218.2018.10.31.16.42.07; Wed, 31 Oct 2018 16:42:07 -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=@kernel.org header.s=default header.b="N7/fpJ+5"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729354AbeKAIIB (ORCPT + 32 others); Thu, 1 Nov 2018 04:08:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:56368 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729319AbeKAIH7 (ORCPT ); Thu, 1 Nov 2018 04:07:59 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B95A92086D; Wed, 31 Oct 2018 23:07:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027268; bh=j8/hr9FiymPJJTSoCLvmBmWFlHETG5GKkM++isnkbqg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N7/fpJ+5fBKvQy9In33oC7MKkpUDZ1orhrOocrzxAgyXmRsHpO/o93qEv9C61tAmj nlJsAMcAlkvRyGx6WgyjnkAleQG4xtTdX1lv8zRiwRes8PAQbJkbLU7U4SmTe2dJjT A1N4f/56dOQwgyDQWjz8xKdK/yNvx4mbUZzVl9is= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Yunlei He , Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH AUTOSEL 4.19 140/146] f2fs: report error if quota off error during umount Date: Wed, 31 Oct 2018 19:05:35 -0400 Message-Id: <20181031230541.28822-140-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yunlei He [ Upstream commit cda9cc595f0bb6ffa51a4efc4b6533dfa4039b4c ] Now, we depend on fsck to ensure quota file data is ok, so we scan whole partition if checkpoint without umount flag. It's same for quota off error case, which may make quota file data inconsistent. generic/019 reports below error: __quota_error: 1160 callbacks suppressed Quota error (device zram1): write_blk: dquota write failed Quota error (device zram1): qtree_write_dquot: Error -28 occurred while creating quota Quota error (device zram1): write_blk: dquota write failed Quota error (device zram1): qtree_write_dquot: Error -28 occurred while creating quota Quota error (device zram1): write_blk: dquota write failed Quota error (device zram1): qtree_write_dquot: Error -28 occurred while creating quota Quota error (device zram1): write_blk: dquota write failed Quota error (device zram1): qtree_write_dquot: Error -28 occurred while creating quota Quota error (device zram1): write_blk: dquota write failed Quota error (device zram1): qtree_write_dquot: Error -28 occurred while creating quota VFS: Busy inodes after unmount of zram1. Self-destruct in 5 seconds. Have a nice day... If we failed in below path due to fail to write dquot block, we will miss to release quota inode, fix it. - f2fs_put_super - f2fs_quota_off_umount - f2fs_quota_off - f2fs_quota_sync <-- failed - dquot_quota_off <-- missed to call Signed-off-by: Yunlei He Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- fs/f2fs/super.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 896b885f504e..d0d016f21307 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1852,7 +1852,9 @@ static int f2fs_quota_off(struct super_block *sb, int type) if (!inode || !igrab(inode)) return dquot_quota_off(sb, type); - f2fs_quota_sync(sb, type); + err = f2fs_quota_sync(sb, type); + if (err) + goto out_put; err = dquot_quota_off(sb, type); if (err || f2fs_sb_has_quota_ino(sb)) @@ -1871,9 +1873,20 @@ static int f2fs_quota_off(struct super_block *sb, int type) void f2fs_quota_off_umount(struct super_block *sb) { int type; + int err; + + for (type = 0; type < MAXQUOTAS; type++) { + err = f2fs_quota_off(sb, type); + if (err) { + int ret = dquot_quota_off(sb, type); - for (type = 0; type < MAXQUOTAS; type++) - f2fs_quota_off(sb, type); + f2fs_msg(sb, KERN_ERR, + "Fail to turn off disk quota " + "(type: %d, err: %d, ret:%d), Please " + "run fsck to fix it.", type, err, ret); + set_sbi_flag(F2FS_SB(sb), SBI_NEED_FSCK); + } + } } static int f2fs_get_projid(struct inode *inode, kprojid_t *projid)