[PATCH] USB: PHY: JZ4770: fix ptr_ret.cocci warnings
by kernel test robot
From: kernel test robot <lkp(a)intel.com>
drivers/phy/ingenic/phy-ingenic-usb.c:348:1-3: WARNING: PTR_ERR_OR_ZERO can be used
Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
Generated by: scripts/coccinelle/api/ptr_ret.cocci
CC: 周琰杰 (Zhou Yanjie) <zhouyanjie(a)wanyeetech.com>
Signed-off-by: kernel test robot <lkp(a)intel.com>
---
url: https://github.com/0day-ci/linux/commits/Zhou-Yanjie/Use-the-generic-PHY-...
base: https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git testing/next
phy-ingenic-usb.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
--- a/drivers/phy/ingenic/phy-ingenic-usb.c
+++ b/drivers/phy/ingenic/phy-ingenic-usb.c
@@ -345,10 +345,7 @@ static int ingenic_usb_phy_probe(struct
phy_set_drvdata(priv->phy, priv);
provider = devm_of_phy_provider_register(priv->dev, of_phy_simple_xlate);
- if (IS_ERR(provider))
- return PTR_ERR(provider);
-
- return 0;
+ return PTR_ERR_OR_ZERO(provider);
}
static const struct of_device_id ingenic_usb_phy_of_matches[] = {
2 years
[android-common:android-4.19-stable 15791/18219] sound/soc/soc-dapm.c:3698:12: warning: stack frame size of 2088 bytes in function 'snd_soc_dai_link_event'
by kernel test robot
tree: https://android.googlesource.com/kernel/common android-4.19-stable
head: ea1951959b9011fe22056a2129b72333befa3de2
commit: b8539473ea414eaa4ef28791fa308a6ab8c5d67c [15791/18219] ANDROID: GKI: workqueue.h: add Android ABI padding to some structures
config: x86_64-randconfig-a016-20200916 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 9e3842d60351f986d77dfe0a94f76e4fd895f188)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
git checkout b8539473ea414eaa4ef28791fa308a6ab8c5d67c
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
>> sound/soc/soc-dapm.c:3698:12: warning: stack frame size of 2088 bytes in function 'snd_soc_dai_link_event' [-Wframe-larger-than=]
static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
^
1 warning generated.
git remote add android-common https://android.googlesource.com/kernel/common
git fetch --no-tags android-common android-4.19-stable
git checkout b8539473ea414eaa4ef28791fa308a6ab8c5d67c
vim +/snd_soc_dai_link_event +3698 sound/soc/soc-dapm.c
4ba1327ab8ce17 Mark Brown 2008-05-13 3697
c74184ed30ecce Mark Brown 2012-04-04 @3698 static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
c74184ed30ecce Mark Brown 2012-04-04 3699 struct snd_kcontrol *kcontrol, int event)
c74184ed30ecce Mark Brown 2012-04-04 3700 {
c74184ed30ecce Mark Brown 2012-04-04 3701 struct snd_soc_dapm_path *source_p, *sink_p;
c74184ed30ecce Mark Brown 2012-04-04 3702 struct snd_soc_dai *source, *sink;
249dc49576fc95 Charles Keepax 2018-08-15 3703 struct snd_soc_pcm_runtime *rtd = w->priv;
c66150824b8a80 Nikesh Oswal 2015-02-02 3704 const struct snd_soc_pcm_stream *config = w->params + w->params_select;
c74184ed30ecce Mark Brown 2012-04-04 3705 struct snd_pcm_substream substream;
9747cec21e2d55 Mark Brown 2012-04-26 3706 struct snd_pcm_hw_params *params = NULL;
8053f21675b073 Nicolin Chen 2016-07-26 3707 struct snd_pcm_runtime *runtime = NULL;
3ba66feb59810e Takashi Iwai 2018-07-25 3708 unsigned int fmt;
0376916b7b2cff Charles Keepax 2018-09-06 3709 int ret = 0;
c74184ed30ecce Mark Brown 2012-04-04 3710
bf4edea863c435 Takashi Iwai 2013-11-07 3711 if (WARN_ON(!config) ||
a3423b02cf745c Lars-Peter Clausen 2015-08-11 3712 WARN_ON(list_empty(&w->edges[SND_SOC_DAPM_DIR_OUT]) ||
a3423b02cf745c Lars-Peter Clausen 2015-08-11 3713 list_empty(&w->edges[SND_SOC_DAPM_DIR_IN])))
bf4edea863c435 Takashi Iwai 2013-11-07 3714 return -EINVAL;
c74184ed30ecce Mark Brown 2012-04-04 3715
c74184ed30ecce Mark Brown 2012-04-04 3716 /* We only support a single source and sink, pick the first */
a3423b02cf745c Lars-Peter Clausen 2015-08-11 3717 source_p = list_first_entry(&w->edges[SND_SOC_DAPM_DIR_OUT],
a3423b02cf745c Lars-Peter Clausen 2015-08-11 3718 struct snd_soc_dapm_path,
a3423b02cf745c Lars-Peter Clausen 2015-08-11 3719 list_node[SND_SOC_DAPM_DIR_OUT]);
a3423b02cf745c Lars-Peter Clausen 2015-08-11 3720 sink_p = list_first_entry(&w->edges[SND_SOC_DAPM_DIR_IN],
a3423b02cf745c Lars-Peter Clausen 2015-08-11 3721 struct snd_soc_dapm_path,
a3423b02cf745c Lars-Peter Clausen 2015-08-11 3722 list_node[SND_SOC_DAPM_DIR_IN]);
c74184ed30ecce Mark Brown 2012-04-04 3723
c74184ed30ecce Mark Brown 2012-04-04 3724 source = source_p->source->priv;
c74184ed30ecce Mark Brown 2012-04-04 3725 sink = sink_p->sink->priv;
c74184ed30ecce Mark Brown 2012-04-04 3726
c74184ed30ecce Mark Brown 2012-04-04 3727 /* Be a little careful as we don't want to overflow the mask array */
c74184ed30ecce Mark Brown 2012-04-04 3728 if (config->formats) {
c74184ed30ecce Mark Brown 2012-04-04 3729 fmt = ffs(config->formats) - 1;
c74184ed30ecce Mark Brown 2012-04-04 3730 } else {
30a6a1a4eed170 Liam Girdwood 2012-11-19 3731 dev_warn(w->dapm->dev, "ASoC: Invalid format %llx specified\n",
c74184ed30ecce Mark Brown 2012-04-04 3732 config->formats);
c74184ed30ecce Mark Brown 2012-04-04 3733 fmt = 0;
c74184ed30ecce Mark Brown 2012-04-04 3734 }
c74184ed30ecce Mark Brown 2012-04-04 3735
c74184ed30ecce Mark Brown 2012-04-04 3736 /* Currently very limited parameter selection */
9747cec21e2d55 Mark Brown 2012-04-26 3737 params = kzalloc(sizeof(*params), GFP_KERNEL);
9747cec21e2d55 Mark Brown 2012-04-26 3738 if (!params) {
9747cec21e2d55 Mark Brown 2012-04-26 3739 ret = -ENOMEM;
9747cec21e2d55 Mark Brown 2012-04-26 3740 goto out;
9747cec21e2d55 Mark Brown 2012-04-26 3741 }
9747cec21e2d55 Mark Brown 2012-04-26 3742 snd_mask_set(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT), fmt);
c74184ed30ecce Mark Brown 2012-04-04 3743
9747cec21e2d55 Mark Brown 2012-04-26 3744 hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE)->min =
c74184ed30ecce Mark Brown 2012-04-04 3745 config->rate_min;
9747cec21e2d55 Mark Brown 2012-04-26 3746 hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE)->max =
c74184ed30ecce Mark Brown 2012-04-04 3747 config->rate_max;
c74184ed30ecce Mark Brown 2012-04-04 3748
9747cec21e2d55 Mark Brown 2012-04-26 3749 hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS)->min
c74184ed30ecce Mark Brown 2012-04-04 3750 = config->channels_min;
9747cec21e2d55 Mark Brown 2012-04-26 3751 hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS)->max
c74184ed30ecce Mark Brown 2012-04-04 3752 = config->channels_max;
c74184ed30ecce Mark Brown 2012-04-04 3753
c74184ed30ecce Mark Brown 2012-04-04 3754 memset(&substream, 0, sizeof(substream));
c74184ed30ecce Mark Brown 2012-04-04 3755
8053f21675b073 Nicolin Chen 2016-07-26 3756 /* Allocate a dummy snd_pcm_runtime for startup() and other ops() */
8053f21675b073 Nicolin Chen 2016-07-26 3757 runtime = kzalloc(sizeof(*runtime), GFP_KERNEL);
8053f21675b073 Nicolin Chen 2016-07-26 3758 if (!runtime) {
8053f21675b073 Nicolin Chen 2016-07-26 3759 ret = -ENOMEM;
8053f21675b073 Nicolin Chen 2016-07-26 3760 goto out;
8053f21675b073 Nicolin Chen 2016-07-26 3761 }
8053f21675b073 Nicolin Chen 2016-07-26 3762 substream.runtime = runtime;
249dc49576fc95 Charles Keepax 2018-08-15 3763 substream.private_data = rtd;
8053f21675b073 Nicolin Chen 2016-07-26 3764
c74184ed30ecce Mark Brown 2012-04-04 3765 switch (event) {
c74184ed30ecce Mark Brown 2012-04-04 3766 case SND_SOC_DAPM_PRE_PMU:
c74184ed30ecce Mark Brown 2012-04-04 3767 substream.stream = SNDRV_PCM_STREAM_CAPTURE;
9900a4226c785d Kuninori Morimoto 2017-09-25 3768 if (source->driver->ops->startup) {
9b8ef9f6b3fccc Jeeja KP 2015-10-20 3769 ret = source->driver->ops->startup(&substream, source);
9b8ef9f6b3fccc Jeeja KP 2015-10-20 3770 if (ret < 0) {
9b8ef9f6b3fccc Jeeja KP 2015-10-20 3771 dev_err(source->dev,
9b8ef9f6b3fccc Jeeja KP 2015-10-20 3772 "ASoC: startup() failed: %d\n", ret);
9b8ef9f6b3fccc Jeeja KP 2015-10-20 3773 goto out;
9b8ef9f6b3fccc Jeeja KP 2015-10-20 3774 }
9b8ef9f6b3fccc Jeeja KP 2015-10-20 3775 source->active++;
9b8ef9f6b3fccc Jeeja KP 2015-10-20 3776 }
93e6958a3674d2 Benoit Cousson 2014-07-08 3777 ret = soc_dai_hw_params(&substream, params, source);
93e6958a3674d2 Benoit Cousson 2014-07-08 3778 if (ret < 0)
9747cec21e2d55 Mark Brown 2012-04-26 3779 goto out;
c74184ed30ecce Mark Brown 2012-04-04 3780
c74184ed30ecce Mark Brown 2012-04-04 3781 substream.stream = SNDRV_PCM_STREAM_PLAYBACK;
9900a4226c785d Kuninori Morimoto 2017-09-25 3782 if (sink->driver->ops->startup) {
9b8ef9f6b3fccc Jeeja KP 2015-10-20 3783 ret = sink->driver->ops->startup(&substream, sink);
9b8ef9f6b3fccc Jeeja KP 2015-10-20 3784 if (ret < 0) {
9b8ef9f6b3fccc Jeeja KP 2015-10-20 3785 dev_err(sink->dev,
9b8ef9f6b3fccc Jeeja KP 2015-10-20 3786 "ASoC: startup() failed: %d\n", ret);
9b8ef9f6b3fccc Jeeja KP 2015-10-20 3787 goto out;
9b8ef9f6b3fccc Jeeja KP 2015-10-20 3788 }
9b8ef9f6b3fccc Jeeja KP 2015-10-20 3789 sink->active++;
9b8ef9f6b3fccc Jeeja KP 2015-10-20 3790 }
93e6958a3674d2 Benoit Cousson 2014-07-08 3791 ret = soc_dai_hw_params(&substream, params, sink);
93e6958a3674d2 Benoit Cousson 2014-07-08 3792 if (ret < 0)
9747cec21e2d55 Mark Brown 2012-04-26 3793 goto out;
c74184ed30ecce Mark Brown 2012-04-04 3794 break;
c74184ed30ecce Mark Brown 2012-04-04 3795
c74184ed30ecce Mark Brown 2012-04-04 3796 case SND_SOC_DAPM_POST_PMU:
da18396f949eca Mark Brown 2013-02-06 3797 ret = snd_soc_dai_digital_mute(sink, 0,
da18396f949eca Mark Brown 2013-02-06 3798 SNDRV_PCM_STREAM_PLAYBACK);
c74184ed30ecce Mark Brown 2012-04-04 3799 if (ret != 0 && ret != -ENOTSUPP)
30a6a1a4eed170 Liam Girdwood 2012-11-19 3800 dev_warn(sink->dev, "ASoC: Failed to unmute: %d\n", ret);
9747cec21e2d55 Mark Brown 2012-04-26 3801 ret = 0;
c74184ed30ecce Mark Brown 2012-04-04 3802 break;
c74184ed30ecce Mark Brown 2012-04-04 3803
c74184ed30ecce Mark Brown 2012-04-04 3804 case SND_SOC_DAPM_PRE_PMD:
da18396f949eca Mark Brown 2013-02-06 3805 ret = snd_soc_dai_digital_mute(sink, 1,
da18396f949eca Mark Brown 2013-02-06 3806 SNDRV_PCM_STREAM_PLAYBACK);
c74184ed30ecce Mark Brown 2012-04-04 3807 if (ret != 0 && ret != -ENOTSUPP)
30a6a1a4eed170 Liam Girdwood 2012-11-19 3808 dev_warn(sink->dev, "ASoC: Failed to mute: %d\n", ret);
9747cec21e2d55 Mark Brown 2012-04-26 3809 ret = 0;
9b8ef9f6b3fccc Jeeja KP 2015-10-20 3810
9b8ef9f6b3fccc Jeeja KP 2015-10-20 3811 source->active--;
9900a4226c785d Kuninori Morimoto 2017-09-25 3812 if (source->driver->ops->shutdown) {
9b8ef9f6b3fccc Jeeja KP 2015-10-20 3813 substream.stream = SNDRV_PCM_STREAM_CAPTURE;
9b8ef9f6b3fccc Jeeja KP 2015-10-20 3814 source->driver->ops->shutdown(&substream, source);
9b8ef9f6b3fccc Jeeja KP 2015-10-20 3815 }
9b8ef9f6b3fccc Jeeja KP 2015-10-20 3816
9b8ef9f6b3fccc Jeeja KP 2015-10-20 3817 sink->active--;
9900a4226c785d Kuninori Morimoto 2017-09-25 3818 if (sink->driver->ops->shutdown) {
9b8ef9f6b3fccc Jeeja KP 2015-10-20 3819 substream.stream = SNDRV_PCM_STREAM_PLAYBACK;
9b8ef9f6b3fccc Jeeja KP 2015-10-20 3820 sink->driver->ops->shutdown(&substream, sink);
9b8ef9f6b3fccc Jeeja KP 2015-10-20 3821 }
c74184ed30ecce Mark Brown 2012-04-04 3822 break;
c74184ed30ecce Mark Brown 2012-04-04 3823
c74184ed30ecce Mark Brown 2012-04-04 3824 default:
a6ed0608bd289b Takashi Iwai 2013-11-06 3825 WARN(1, "Unknown event %d\n", event);
75881df3fd7708 Sudip Mukherjee 2015-09-10 3826 ret = -EINVAL;
c74184ed30ecce Mark Brown 2012-04-04 3827 }
c74184ed30ecce Mark Brown 2012-04-04 3828
9747cec21e2d55 Mark Brown 2012-04-26 3829 out:
8053f21675b073 Nicolin Chen 2016-07-26 3830 kfree(runtime);
9747cec21e2d55 Mark Brown 2012-04-26 3831 kfree(params);
9747cec21e2d55 Mark Brown 2012-04-26 3832 return ret;
c74184ed30ecce Mark Brown 2012-04-04 3833 }
c74184ed30ecce Mark Brown 2012-04-04 3834
:::::: The code at line 3698 was first introduced by commit
:::::: c74184ed30ecce2a5e9ae9aa22cb5e3942e0c7c7 ASoC: core: Support transparent CODEC<->CODEC DAI links
:::::: TO: Mark Brown <broonie(a)opensource.wolfsonmicro.com>
:::::: CC: Mark Brown <broonie(a)opensource.wolfsonmicro.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years
Re: [PATCH v2 10/10] kfence: add test suite
by kernel test robot
Hi Marco,
I love your patch! Perhaps something to improve:
[auto build test WARNING on hnaz-linux-mm/master]
[also build test WARNING on arm64/for-next/core linus/master v5.9-rc5]
[cannot apply to tip/x86/core next-20200915]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Marco-Elver/KFENCE-A-low-overhea...
base: https://github.com/hnaz/linux-mm master
config: i386-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
# save the attached .config to linux build tree
make W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
mm/kfence/kfence_test.c: In function 'report_matches':
>> mm/kfence/kfence_test.c:150:1: warning: the frame size of 1032 bytes is larger than 1024 bytes [-Wframe-larger-than=]
150 | }
| ^
# https://github.com/0day-ci/linux/commit/e52f64e8d3cbfe2423913871780cf012b...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Marco-Elver/KFENCE-A-low-overhead-sampling-based-memory-safety-error-detector/20200915-212305
git checkout e52f64e8d3cbfe2423913871780cf012b2abeb21
vim +150 mm/kfence/kfence_test.c
74
75 /* Check observed report matches information in @r. */
76 static bool report_matches(const struct expect_report *r)
77 {
78 bool ret = false;
79 unsigned long flags;
80 typeof(observed.lines) expect;
81 const char *end;
82 char *cur;
83
84 /* Doubled-checked locking. */
85 if (!report_available())
86 return false;
87
88 /* Generate expected report contents. */
89
90 /* Title */
91 cur = expect[0];
92 end = &expect[0][sizeof(expect[0]) - 1];
93 switch (r->type) {
94 case KFENCE_ERROR_OOB:
95 cur += scnprintf(cur, end - cur, "BUG: KFENCE: out-of-bounds");
96 break;
97 case KFENCE_ERROR_UAF:
98 cur += scnprintf(cur, end - cur, "BUG: KFENCE: use-after-free");
99 break;
100 case KFENCE_ERROR_CORRUPTION:
101 cur += scnprintf(cur, end - cur, "BUG: KFENCE: memory corruption");
102 break;
103 case KFENCE_ERROR_INVALID:
104 cur += scnprintf(cur, end - cur, "BUG: KFENCE: invalid access");
105 break;
106 case KFENCE_ERROR_INVALID_FREE:
107 cur += scnprintf(cur, end - cur, "BUG: KFENCE: invalid free");
108 break;
109 }
110
111 scnprintf(cur, end - cur, " in %pS", r->fn);
112 /* The exact offset won't match, remove it; also strip module name. */
113 cur = strchr(expect[0], '+');
114 if (cur)
115 *cur = '\0';
116
117 /* Access information */
118 cur = expect[1];
119 end = &expect[1][sizeof(expect[1]) - 1];
120
121 switch (r->type) {
122 case KFENCE_ERROR_OOB:
123 cur += scnprintf(cur, end - cur, "Out-of-bounds access at");
124 break;
125 case KFENCE_ERROR_UAF:
126 cur += scnprintf(cur, end - cur, "Use-after-free access at");
127 break;
128 case KFENCE_ERROR_CORRUPTION:
129 cur += scnprintf(cur, end - cur, "Corrupted memory at");
130 break;
131 case KFENCE_ERROR_INVALID:
132 cur += scnprintf(cur, end - cur, "Invalid access at");
133 break;
134 case KFENCE_ERROR_INVALID_FREE:
135 cur += scnprintf(cur, end - cur, "Invalid free of");
136 break;
137 }
138
139 cur += scnprintf(cur, end - cur, " 0x" PTR_FMT, (void *)r->addr);
140
141 spin_lock_irqsave(&observed.lock, flags);
142 if (!report_available())
143 goto out; /* A new report is being captured. */
144
145 /* Finally match expected output to what we actually observed. */
146 ret = strstr(observed.lines[0], expect[0]) && strstr(observed.lines[1], expect[1]);
147 out:
148 spin_unlock_irqrestore(&observed.lock, flags);
149 return ret;
> 150 }
151
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years
[linux-review:UPDATE-20200915-201414/Ye-Bin/ext4-Fix-dead-loop-in-ext4_mb_new_blocks/20200914-184737 1/1] fs/ext4/mballoc.c:4245:1: warning: unused label 'out'
by kernel test robot
tree: https://github.com/0day-ci/linux/commits/UPDATE-20200915-201414/Ye-Bin/ex...
head: be9ed3afd2b7b27b328283e3994e99b4f9694eb4
commit: be9ed3afd2b7b27b328283e3994e99b4f9694eb4 [1/1] ext4: Fix dead loop in ext4_mb_new_blocks
config: x86_64-randconfig-a016-20200916 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 9e3842d60351f986d77dfe0a94f76e4fd895f188)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
git checkout be9ed3afd2b7b27b328283e3994e99b4f9694eb4
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
>> fs/ext4/mballoc.c:4245:1: warning: unused label 'out' [-Wunused-label]
out:
^~~~
1 warning generated.
# https://github.com/0day-ci/linux/commit/be9ed3afd2b7b27b328283e3994e99b4f...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review UPDATE-20200915-201414/Ye-Bin/ext4-Fix-dead-loop-in-ext4_mb_new_blocks/20200914-184737
git checkout be9ed3afd2b7b27b328283e3994e99b4f9694eb4
vim +/out +4245 fs/ext4/mballoc.c
c9de560ded61fa Alex Tomas 2008-01-29 4142
c9de560ded61fa Alex Tomas 2008-01-29 4143 /*
c9de560ded61fa Alex Tomas 2008-01-29 4144 * releases all preallocations in given group
c9de560ded61fa Alex Tomas 2008-01-29 4145 *
c9de560ded61fa Alex Tomas 2008-01-29 4146 * first, we need to decide discard policy:
c9de560ded61fa Alex Tomas 2008-01-29 4147 * - when do we discard
c9de560ded61fa Alex Tomas 2008-01-29 4148 * 1) ENOSPC
c9de560ded61fa Alex Tomas 2008-01-29 4149 * - how many do we discard
c9de560ded61fa Alex Tomas 2008-01-29 4150 * 1) how many requested
c9de560ded61fa Alex Tomas 2008-01-29 4151 */
4ddfef7b41aebb Eric Sandeen 2008-04-29 4152 static noinline_for_stack int
4ddfef7b41aebb Eric Sandeen 2008-04-29 4153 ext4_mb_discard_group_preallocations(struct super_block *sb,
c9de560ded61fa Alex Tomas 2008-01-29 4154 ext4_group_t group, int needed)
c9de560ded61fa Alex Tomas 2008-01-29 4155 {
c9de560ded61fa Alex Tomas 2008-01-29 4156 struct ext4_group_info *grp = ext4_get_group_info(sb, group);
c9de560ded61fa Alex Tomas 2008-01-29 4157 struct buffer_head *bitmap_bh = NULL;
c9de560ded61fa Alex Tomas 2008-01-29 4158 struct ext4_prealloc_space *pa, *tmp;
c9de560ded61fa Alex Tomas 2008-01-29 4159 struct list_head list;
c9de560ded61fa Alex Tomas 2008-01-29 4160 struct ext4_buddy e4b;
c9de560ded61fa Alex Tomas 2008-01-29 4161 int err;
c9de560ded61fa Alex Tomas 2008-01-29 4162 int busy = 0;
c9de560ded61fa Alex Tomas 2008-01-29 4163 int free = 0;
c9de560ded61fa Alex Tomas 2008-01-29 4164
d3df14535f4a5b Ritesh Harjani 2020-05-10 4165 mb_debug(sb, "discard preallocation for group %u\n", group);
c9de560ded61fa Alex Tomas 2008-01-29 4166 if (list_empty(&grp->bb_prealloc_list))
bbc4ec77e9f9c7 Ritesh Harjani 2020-05-10 4167 goto out_dbg;
c9de560ded61fa Alex Tomas 2008-01-29 4168
574ca174c97f79 Theodore Ts'o 2008-07-11 4169 bitmap_bh = ext4_read_block_bitmap(sb, group);
9008a58e5dcee0 Darrick J. Wong 2015-10-17 4170 if (IS_ERR(bitmap_bh)) {
9008a58e5dcee0 Darrick J. Wong 2015-10-17 4171 err = PTR_ERR(bitmap_bh);
54d3adbc29f0c7 Theodore Ts'o 2020-03-28 4172 ext4_error_err(sb, -err,
54d3adbc29f0c7 Theodore Ts'o 2020-03-28 4173 "Error %d reading block bitmap for %u",
9008a58e5dcee0 Darrick J. Wong 2015-10-17 4174 err, group);
bbc4ec77e9f9c7 Ritesh Harjani 2020-05-10 4175 goto out_dbg;
c9de560ded61fa Alex Tomas 2008-01-29 4176 }
c9de560ded61fa Alex Tomas 2008-01-29 4177
c9de560ded61fa Alex Tomas 2008-01-29 4178 err = ext4_mb_load_buddy(sb, group, &e4b);
ce89f46cb833f8 Aneesh Kumar K.V 2008-07-23 4179 if (err) {
9651e6b2e20648 Konstantin Khlebnikov 2017-05-21 4180 ext4_warning(sb, "Error %d loading buddy information for %u",
9651e6b2e20648 Konstantin Khlebnikov 2017-05-21 4181 err, group);
ce89f46cb833f8 Aneesh Kumar K.V 2008-07-23 4182 put_bh(bitmap_bh);
bbc4ec77e9f9c7 Ritesh Harjani 2020-05-10 4183 goto out_dbg;
ce89f46cb833f8 Aneesh Kumar K.V 2008-07-23 4184 }
c9de560ded61fa Alex Tomas 2008-01-29 4185
c9de560ded61fa Alex Tomas 2008-01-29 4186 if (needed == 0)
7137d7a48e2213 Theodore Ts'o 2011-09-09 4187 needed = EXT4_CLUSTERS_PER_GROUP(sb) + 1;
c9de560ded61fa Alex Tomas 2008-01-29 4188
c9de560ded61fa Alex Tomas 2008-01-29 4189 INIT_LIST_HEAD(&list);
c9de560ded61fa Alex Tomas 2008-01-29 4190 repeat:
c9de560ded61fa Alex Tomas 2008-01-29 4191 ext4_lock_group(sb, group);
07b5b8e1ac4004 Ritesh Harjani 2020-05-20 4192 this_cpu_inc(discard_pa_seq);
c9de560ded61fa Alex Tomas 2008-01-29 4193 list_for_each_entry_safe(pa, tmp,
c9de560ded61fa Alex Tomas 2008-01-29 4194 &grp->bb_prealloc_list, pa_group_list) {
c9de560ded61fa Alex Tomas 2008-01-29 4195 spin_lock(&pa->pa_lock);
c9de560ded61fa Alex Tomas 2008-01-29 4196 if (atomic_read(&pa->pa_count)) {
c9de560ded61fa Alex Tomas 2008-01-29 4197 spin_unlock(&pa->pa_lock);
c9de560ded61fa Alex Tomas 2008-01-29 4198 busy = 1;
c9de560ded61fa Alex Tomas 2008-01-29 4199 continue;
c9de560ded61fa Alex Tomas 2008-01-29 4200 }
c9de560ded61fa Alex Tomas 2008-01-29 4201 if (pa->pa_deleted) {
c9de560ded61fa Alex Tomas 2008-01-29 4202 spin_unlock(&pa->pa_lock);
c9de560ded61fa Alex Tomas 2008-01-29 4203 continue;
c9de560ded61fa Alex Tomas 2008-01-29 4204 }
c9de560ded61fa Alex Tomas 2008-01-29 4205
c9de560ded61fa Alex Tomas 2008-01-29 4206 /* seems this one can be freed ... */
27bc446e2def38 brookxu 2020-08-17 4207 ext4_mb_mark_pa_deleted(sb, pa);
c9de560ded61fa Alex Tomas 2008-01-29 4208
c9de560ded61fa Alex Tomas 2008-01-29 4209 /* we can trust pa_free ... */
c9de560ded61fa Alex Tomas 2008-01-29 4210 free += pa->pa_free;
c9de560ded61fa Alex Tomas 2008-01-29 4211
c9de560ded61fa Alex Tomas 2008-01-29 4212 spin_unlock(&pa->pa_lock);
c9de560ded61fa Alex Tomas 2008-01-29 4213
c9de560ded61fa Alex Tomas 2008-01-29 4214 list_del(&pa->pa_group_list);
c9de560ded61fa Alex Tomas 2008-01-29 4215 list_add(&pa->u.pa_tmp_list, &list);
c9de560ded61fa Alex Tomas 2008-01-29 4216 }
c9de560ded61fa Alex Tomas 2008-01-29 4217
c9de560ded61fa Alex Tomas 2008-01-29 4218 /* now free all selected PAs */
c9de560ded61fa Alex Tomas 2008-01-29 4219 list_for_each_entry_safe(pa, tmp, &list, u.pa_tmp_list) {
c9de560ded61fa Alex Tomas 2008-01-29 4220
c9de560ded61fa Alex Tomas 2008-01-29 4221 /* remove from object (inode or locality group) */
c9de560ded61fa Alex Tomas 2008-01-29 4222 spin_lock(pa->pa_obj_lock);
c9de560ded61fa Alex Tomas 2008-01-29 4223 list_del_rcu(&pa->pa_inode_list);
c9de560ded61fa Alex Tomas 2008-01-29 4224 spin_unlock(pa->pa_obj_lock);
c9de560ded61fa Alex Tomas 2008-01-29 4225
cc0fb9ad7dbc5a Aneesh Kumar K.V 2009-03-27 4226 if (pa->pa_type == MB_GROUP_PA)
3e1e5f50163246 Eric Sandeen 2010-10-27 4227 ext4_mb_release_group_pa(&e4b, pa);
c9de560ded61fa Alex Tomas 2008-01-29 4228 else
3e1e5f50163246 Eric Sandeen 2010-10-27 4229 ext4_mb_release_inode_pa(&e4b, bitmap_bh, pa);
c9de560ded61fa Alex Tomas 2008-01-29 4230
c9de560ded61fa Alex Tomas 2008-01-29 4231 list_del(&pa->u.pa_tmp_list);
c9de560ded61fa Alex Tomas 2008-01-29 4232 call_rcu(&(pa)->u.pa_rcu, ext4_mb_pa_callback);
c9de560ded61fa Alex Tomas 2008-01-29 4233 }
c9de560ded61fa Alex Tomas 2008-01-29 4234
be9ed3afd2b7b2 Jan Kara 2020-09-15 4235 /* if we still need more blocks and some PAs were used, try again */
be9ed3afd2b7b2 Jan Kara 2020-09-15 4236 if (free < needed && busy) {
be9ed3afd2b7b2 Jan Kara 2020-09-15 4237 ext4_unlock_group(sb, group);
be9ed3afd2b7b2 Jan Kara 2020-09-15 4238 cond_resched();
be9ed3afd2b7b2 Jan Kara 2020-09-15 4239 busy = 0;
be9ed3afd2b7b2 Jan Kara 2020-09-15 4240 /* Make sure we increment discard_pa_seq again */
be9ed3afd2b7b2 Jan Kara 2020-09-15 4241 needed -= free;
be9ed3afd2b7b2 Jan Kara 2020-09-15 4242 free = 0;
be9ed3afd2b7b2 Jan Kara 2020-09-15 4243 goto repeat;
be9ed3afd2b7b2 Jan Kara 2020-09-15 4244 }
c9de560ded61fa Alex Tomas 2008-01-29 @4245 out:
c9de560ded61fa Alex Tomas 2008-01-29 4246 ext4_unlock_group(sb, group);
e39e07fdfd98be Jing Zhang 2010-05-14 4247 ext4_mb_unload_buddy(&e4b);
c9de560ded61fa Alex Tomas 2008-01-29 4248 put_bh(bitmap_bh);
bbc4ec77e9f9c7 Ritesh Harjani 2020-05-10 4249 out_dbg:
d3df14535f4a5b Ritesh Harjani 2020-05-10 4250 mb_debug(sb, "discarded (%d) blocks preallocated for group %u bb_free (%d)\n",
bbc4ec77e9f9c7 Ritesh Harjani 2020-05-10 4251 free, group, grp->bb_free);
c9de560ded61fa Alex Tomas 2008-01-29 4252 return free;
c9de560ded61fa Alex Tomas 2008-01-29 4253 }
c9de560ded61fa Alex Tomas 2008-01-29 4254
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years
[linux-next:master 7201/7920] arch/s390/mm/dump_pagetables.c:232:64: error: use of undeclared identifier 'ptdump_fops'; did you mean
by kernel test robot
Hi Heiko,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 6b02addb1d1748d21dd1261e46029b264be4e5a0
commit: 08c8e685c7c9223f9c4ad6365e02bebd3f106480 [7201/7920] s390: add ARCH_HAS_DEBUG_WX support
config: s390-randconfig-r022-20200916 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 9e3842d60351f986d77dfe0a94f76e4fd895f188)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install s390 cross compiling tool for clang build
# apt-get install binutils-s390x-linux-gnu
git checkout 08c8e685c7c9223f9c4ad6365e02bebd3f106480
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=s390
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
>> arch/s390/mm/dump_pagetables.c:232:64: error: use of undeclared identifier 'ptdump_fops'; did you mean 'pidfd_fops'?
debugfs_create_file("kernel_page_tables", 0400, NULL, NULL, &ptdump_fops);
^~~~~~~~~~~
pidfd_fops
include/linux/pid.h:75:37: note: 'pidfd_fops' declared here
extern const struct file_operations pidfd_fops;
^
1 error generated.
# https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commi...
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch --no-tags linux-next master
git checkout 08c8e685c7c9223f9c4ad6365e02bebd3f106480
vim +232 arch/s390/mm/dump_pagetables.c
e76e82d772522b Heiko Carstens 2012-10-04 218
e76e82d772522b Heiko Carstens 2012-10-04 219 static int pt_dump_init(void)
e76e82d772522b Heiko Carstens 2012-10-04 220 {
e76e82d772522b Heiko Carstens 2012-10-04 221 /*
e76e82d772522b Heiko Carstens 2012-10-04 222 * Figure out the maximum virtual address being accessible with the
e76e82d772522b Heiko Carstens 2012-10-04 223 * kernel ASCE. We need this to keep the page table walker functions
e76e82d772522b Heiko Carstens 2012-10-04 224 * from accessing non-existent entries.
e76e82d772522b Heiko Carstens 2012-10-04 225 */
e76e82d772522b Heiko Carstens 2012-10-04 226 max_addr = (S390_lowcore.kernel_asce & _REGION_ENTRY_TYPE_MASK) >> 2;
e76e82d772522b Heiko Carstens 2012-10-04 227 max_addr = 1UL << (max_addr * 11 + 31);
c972cc60c23f5a Heiko Carstens 2012-10-05 228 address_markers[MODULES_NR].start_address = MODULES_VADDR;
e76e82d772522b Heiko Carstens 2012-10-04 229 address_markers[VMEMMAP_NR].start_address = (unsigned long) vmemmap;
e76e82d772522b Heiko Carstens 2012-10-04 230 address_markers[VMALLOC_NR].start_address = VMALLOC_START;
08c8e685c7c922 Heiko Carstens 2020-09-09 231 if (IS_ENABLED(CONFIG_PTDUMP_DEBUGFS))
e76e82d772522b Heiko Carstens 2012-10-04 @232 debugfs_create_file("kernel_page_tables", 0400, NULL, NULL, &ptdump_fops);
:::::: The code at line 232 was first introduced by commit
:::::: e76e82d772522b05ed93228478d2a4460754b6a4 s390/mm: add page table dumper
:::::: TO: Heiko Carstens <heiko.carstens(a)de.ibm.com>
:::::: CC: Martin Schwidefsky <schwidefsky(a)de.ibm.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
2 years