* [PATCH 2/6] staging: vc04_services: rename functions containing bm2835_* to bcm2835_*
From: Gaston Gonzalez @ 2022-01-05 20:35 UTC (permalink / raw)
To: linux-staging
Cc: gregkh, nsaenz, f.fainelli, rjui, sbranden, juerg.haefliger,
rdunlap, dave.stevenson, stefan.wahren, unixbhaskar,
mitaliborkar810, phil, len.baker, linux-rpi-kernel,
linux-arm-kernel, bcm-kernel-feedback-list, linux-kernel, gascoar
In-Reply-To: <cover.1641414449.git.gascoar@gmail.com>
In the kernel, all names related to the chip BCM2835 are always named
bcm2835_*. To avoid confusion, and to make things more consistent,
rename functions using bm2835_* to bcm2835_*.
While at it, some realignments were made to improve readability.
Suggested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Gaston Gonzalez <gascoar@gmail.com>
---
.../vc04_services/bcm2835-camera/bcm2835-camera.c | 9 ++++-----
.../vc04_services/bcm2835-camera/bcm2835-camera.h | 6 ++----
drivers/staging/vc04_services/bcm2835-camera/controls.c | 9 ++++-----
3 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
index 109021643c3f..159ac600d11e 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
@@ -1735,7 +1735,7 @@ static int mmal_init(struct bcm2835_mmal_dev *dev)
&enable,
sizeof(enable));
}
- ret = bm2835_mmal_set_all_camera_controls(dev);
+ ret = bcm2835_mmal_set_all_camera_controls(dev);
if (ret < 0) {
v4l2_err(&dev->v4l2_dev, "%s: failed to set all camera controls: %d\n",
__func__, ret);
@@ -1769,8 +1769,7 @@ static int mmal_init(struct bcm2835_mmal_dev *dev)
return ret;
}
-static int bm2835_mmal_init_device(struct bcm2835_mmal_dev *dev,
- struct video_device *vfd)
+static int bcm2835_mmal_init_device(struct bcm2835_mmal_dev *dev, struct video_device *vfd)
{
int ret;
@@ -1908,7 +1907,7 @@ static int bcm2835_mmal_probe(struct platform_device *pdev)
}
/* setup v4l controls */
- ret = bm2835_mmal_init_controls(dev, &dev->ctrl_handler);
+ ret = bcm2835_mmal_init_controls(dev, &dev->ctrl_handler);
if (ret < 0) {
v4l2_err(&dev->v4l2_dev, "%s: could not init controls: %d\n",
__func__, ret);
@@ -1940,7 +1939,7 @@ static int bcm2835_mmal_probe(struct platform_device *pdev)
goto unreg_dev;
/* initialise video devices */
- ret = bm2835_mmal_init_device(dev, &dev->vdev);
+ ret = bcm2835_mmal_init_device(dev, &dev->vdev);
if (ret < 0) {
v4l2_err(&dev->v4l2_dev, "%s: could not init device: %d\n",
__func__, ret);
diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.h b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.h
index 338b7c142ae3..84ba789af120 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.h
+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.h
@@ -110,11 +110,9 @@ struct bcm2835_mmal_dev {
unsigned int rgb_bgr_swapped;
};
-int bm2835_mmal_init_controls(
- struct bcm2835_mmal_dev *dev,
- struct v4l2_ctrl_handler *hdl);
+int bcm2835_mmal_init_controls(struct bcm2835_mmal_dev *dev, struct v4l2_ctrl_handler *hdl);
-int bm2835_mmal_set_all_camera_controls(struct bcm2835_mmal_dev *dev);
+int bcm2835_mmal_set_all_camera_controls(struct bcm2835_mmal_dev *dev);
int set_framerate_params(struct bcm2835_mmal_dev *dev);
/* Debug helpers */
diff --git a/drivers/staging/vc04_services/bcm2835-camera/controls.c b/drivers/staging/vc04_services/bcm2835-camera/controls.c
index 03967a7d99a0..08fadc164b02 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/controls.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/controls.c
@@ -884,7 +884,7 @@ static int ctrl_set_scene_mode(struct bcm2835_mmal_dev *dev,
return 0;
}
-static int bm2835_mmal_s_ctrl(struct v4l2_ctrl *ctrl)
+static int bcm2835_mmal_s_ctrl(struct v4l2_ctrl *ctrl)
{
struct bcm2835_mmal_dev *dev = container_of(ctrl->handler, struct bcm2835_mmal_dev,
ctrl_handler);
@@ -904,7 +904,7 @@ static int bm2835_mmal_s_ctrl(struct v4l2_ctrl *ctrl)
}
static const struct v4l2_ctrl_ops bm2835_mmal_ctrl_ops = {
- .s_ctrl = bm2835_mmal_s_ctrl,
+ .s_ctrl = bcm2835_mmal_s_ctrl,
};
static const struct bcm2835_mmal_v4l2_ctrl v4l2_ctrls[V4L2_CTRL_COUNT] = {
@@ -1246,7 +1246,7 @@ static const struct bcm2835_mmal_v4l2_ctrl v4l2_ctrls[V4L2_CTRL_COUNT] = {
},
};
-int bm2835_mmal_set_all_camera_controls(struct bcm2835_mmal_dev *dev)
+int bcm2835_mmal_set_all_camera_controls(struct bcm2835_mmal_dev *dev)
{
int c;
int ret = 0;
@@ -1311,8 +1311,7 @@ int set_framerate_params(struct bcm2835_mmal_dev *dev)
return ret;
}
-int bm2835_mmal_init_controls(struct bcm2835_mmal_dev *dev,
- struct v4l2_ctrl_handler *hdl)
+int bcm2835_mmal_init_controls(struct bcm2835_mmal_dev *dev, struct v4l2_ctrl_handler *hdl)
{
int c;
const struct bcm2835_mmal_v4l2_ctrl *ctrl;
--
2.34.1
^ permalink raw reply related
* Re: [Buildroot] [PATCH v3 1/1] package/vdr: enable musl/uclibc build
From: Thomas Petazzoni @ 2022-01-05 20:36 UTC (permalink / raw)
To: Bernd Kuhls; +Cc: buildroot
In-Reply-To: <20220101120920.2809336-1-bernd.kuhls@t-online.de>
Hello Bernd,
On Sat, 1 Jan 2022 13:09:20 +0100
Bernd Kuhls <bernd.kuhls@t-online.de> wrote:
> Re-add patch 0001 to fix uClibc build, this patch was removed 2019:
> https://git.buildroot.net/buildroot/commit/?id=573d15b0790cfd2838cf0544ded79b415e20f5a7
>
> Add two more patches from Alpine Linux to fix musl build.
>
> Add optional dependency to libexecinfo to provide execinfo.h.
>
> Depend on BR2_SYSTEM_ENABLE_NLS to have gettext being added as
> dependency to provide _nl_msg_cat_cntr() needed by i18n.c.
>
> Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
> ---
> v3: rework nls/gettext dependencies (Thomas)
> v2: no changes
I have applied, but after dropping the NLS dependency. Indeed, the
_nl_msg_cat_cntr symbol is an internal symbol of gettext, which only
glibc and uclibc provide in their built-in libintl implementation. Even
the stub libintl-musl from the gettext-tiny project implements
_nl_msg_cat_cntr as a dummy symbol, which really tells us that it
serves no purpose on musl toolchains. So I've just added a patch for
vdr that ensures _nl_msg_cat_cntr is only used on glibc/uclibc
toolchains, by checking __GLIBC__.
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply
* [PATCH 1/6] staging: vc04_services: rename structures bm2835_mmal_dev and bm2835_mmal_v4l2_ctrl
From: Gaston Gonzalez @ 2022-01-05 20:35 UTC (permalink / raw)
To: linux-staging
Cc: gregkh, nsaenz, f.fainelli, rjui, sbranden, juerg.haefliger,
rdunlap, dave.stevenson, stefan.wahren, unixbhaskar,
mitaliborkar810, phil, len.baker, linux-rpi-kernel,
linux-arm-kernel, bcm-kernel-feedback-list, linux-kernel, gascoar
In-Reply-To: <cover.1641414449.git.gascoar@gmail.com>
In the kernel, all names related to the chip BCM2835 are always named
bcm2835_*. To avoid confusion, and to make things more consistent,
rename the structures bm2835_mmal_dev and bm2835_mmal_v4l2_ctrl
accordingly.
While at it, one realignment was made to improve readability.
Suggested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Gaston Gonzalez <gascoar@gmail.com>
---
.../bcm2835-camera/bcm2835-camera.c | 68 ++++++-------
.../bcm2835-camera/bcm2835-camera.h | 8 +-
.../vc04_services/bcm2835-camera/controls.c | 99 +++++++++----------
3 files changed, 87 insertions(+), 88 deletions(-)
diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
index 1b184d5c6b82..109021643c3f 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
@@ -64,7 +64,7 @@ MODULE_PARM_DESC(max_video_height, "Threshold for video mode");
static atomic_t camera_instance = ATOMIC_INIT(0);
/* global device data array */
-static struct bm2835_mmal_dev *gdev[MAX_BCM2835_CAMERAS];
+static struct bcm2835_mmal_dev *gdev[MAX_BCM2835_CAMERAS];
#define FPS_MIN 1
#define FPS_MAX 90
@@ -210,7 +210,7 @@ static int queue_setup(struct vb2_queue *vq,
unsigned int *nbuffers, unsigned int *nplanes,
unsigned int sizes[], struct device *alloc_ctxs[])
{
- struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vq);
+ struct bcm2835_mmal_dev *dev = vb2_get_drv_priv(vq);
unsigned long size;
/* refuse queue setup if port is not configured */
@@ -265,7 +265,7 @@ static int queue_setup(struct vb2_queue *vq,
static int buffer_init(struct vb2_buffer *vb)
{
- struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vb->vb2_queue);
+ struct bcm2835_mmal_dev *dev = vb2_get_drv_priv(vb->vb2_queue);
struct vb2_v4l2_buffer *vb2 = to_vb2_v4l2_buffer(vb);
struct vb2_mmal_buffer *buf =
container_of(vb2, struct vb2_mmal_buffer, vb);
@@ -280,7 +280,7 @@ static int buffer_init(struct vb2_buffer *vb)
static int buffer_prepare(struct vb2_buffer *vb)
{
- struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vb->vb2_queue);
+ struct bcm2835_mmal_dev *dev = vb2_get_drv_priv(vb->vb2_queue);
unsigned long size;
v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p, vb %p\n",
@@ -302,7 +302,7 @@ static int buffer_prepare(struct vb2_buffer *vb)
static void buffer_cleanup(struct vb2_buffer *vb)
{
- struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vb->vb2_queue);
+ struct bcm2835_mmal_dev *dev = vb2_get_drv_priv(vb->vb2_queue);
struct vb2_v4l2_buffer *vb2 = to_vb2_v4l2_buffer(vb);
struct vb2_mmal_buffer *buf =
container_of(vb2, struct vb2_mmal_buffer, vb);
@@ -313,7 +313,7 @@ static void buffer_cleanup(struct vb2_buffer *vb)
mmal_vchi_buffer_cleanup(&buf->mmal);
}
-static inline bool is_capturing(struct bm2835_mmal_dev *dev)
+static inline bool is_capturing(struct bcm2835_mmal_dev *dev)
{
return dev->capture.camera_port ==
&dev->component[COMP_CAMERA]->output[CAM_PORT_CAPTURE];
@@ -324,7 +324,7 @@ static void buffer_cb(struct vchiq_mmal_instance *instance,
int status,
struct mmal_buffer *mmal_buf)
{
- struct bm2835_mmal_dev *dev = port->cb_ctx;
+ struct bcm2835_mmal_dev *dev = port->cb_ctx;
struct vb2_mmal_buffer *buf =
container_of(mmal_buf, struct vb2_mmal_buffer, mmal);
@@ -416,7 +416,7 @@ static void buffer_cb(struct vchiq_mmal_instance *instance,
}
}
-static int enable_camera(struct bm2835_mmal_dev *dev)
+static int enable_camera(struct bcm2835_mmal_dev *dev)
{
int ret;
@@ -447,7 +447,7 @@ static int enable_camera(struct bm2835_mmal_dev *dev)
return 0;
}
-static int disable_camera(struct bm2835_mmal_dev *dev)
+static int disable_camera(struct bcm2835_mmal_dev *dev)
{
int ret;
@@ -482,7 +482,7 @@ static int disable_camera(struct bm2835_mmal_dev *dev)
static void buffer_queue(struct vb2_buffer *vb)
{
- struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vb->vb2_queue);
+ struct bcm2835_mmal_dev *dev = vb2_get_drv_priv(vb->vb2_queue);
struct vb2_v4l2_buffer *vb2 = to_vb2_v4l2_buffer(vb);
struct vb2_mmal_buffer *buf =
container_of(vb2, struct vb2_mmal_buffer, vb);
@@ -501,7 +501,7 @@ static void buffer_queue(struct vb2_buffer *vb)
static int start_streaming(struct vb2_queue *vq, unsigned int count)
{
- struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vq);
+ struct bcm2835_mmal_dev *dev = vb2_get_drv_priv(vq);
int ret;
u32 parameter_size;
@@ -596,7 +596,7 @@ static void stop_streaming(struct vb2_queue *vq)
{
int ret;
unsigned long timeout;
- struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vq);
+ struct bcm2835_mmal_dev *dev = vb2_get_drv_priv(vq);
struct vchiq_mmal_port *port = dev->capture.port;
v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p\n",
@@ -671,7 +671,7 @@ static const struct vb2_ops bm2835_mmal_video_qops = {
* ------------------------------------------------------------------
*/
-static int set_overlay_params(struct bm2835_mmal_dev *dev,
+static int set_overlay_params(struct bcm2835_mmal_dev *dev,
struct vchiq_mmal_port *port)
{
struct mmal_parameter_displayregion prev_config = {
@@ -713,7 +713,7 @@ static int vidioc_enum_fmt_vid_overlay(struct file *file, void *priv,
static int vidioc_g_fmt_vid_overlay(struct file *file, void *priv,
struct v4l2_format *f)
{
- struct bm2835_mmal_dev *dev = video_drvdata(file);
+ struct bcm2835_mmal_dev *dev = video_drvdata(file);
f->fmt.win = dev->overlay;
@@ -723,7 +723,7 @@ static int vidioc_g_fmt_vid_overlay(struct file *file, void *priv,
static int vidioc_try_fmt_vid_overlay(struct file *file, void *priv,
struct v4l2_format *f)
{
- struct bm2835_mmal_dev *dev = video_drvdata(file);
+ struct bcm2835_mmal_dev *dev = video_drvdata(file);
f->fmt.win.field = V4L2_FIELD_NONE;
f->fmt.win.chromakey = 0;
@@ -754,7 +754,7 @@ static int vidioc_try_fmt_vid_overlay(struct file *file, void *priv,
static int vidioc_s_fmt_vid_overlay(struct file *file, void *priv,
struct v4l2_format *f)
{
- struct bm2835_mmal_dev *dev = video_drvdata(file);
+ struct bcm2835_mmal_dev *dev = video_drvdata(file);
vidioc_try_fmt_vid_overlay(file, priv, f);
@@ -770,7 +770,7 @@ static int vidioc_s_fmt_vid_overlay(struct file *file, void *priv,
static int vidioc_overlay(struct file *file, void *f, unsigned int on)
{
int ret;
- struct bm2835_mmal_dev *dev = video_drvdata(file);
+ struct bcm2835_mmal_dev *dev = video_drvdata(file);
struct vchiq_mmal_port *src;
struct vchiq_mmal_port *dst;
@@ -829,7 +829,7 @@ static int vidioc_g_fbuf(struct file *file, void *fh,
/* The video overlay must stay within the framebuffer and can't be
* positioned independently.
*/
- struct bm2835_mmal_dev *dev = video_drvdata(file);
+ struct bcm2835_mmal_dev *dev = video_drvdata(file);
struct vchiq_mmal_port *preview_port =
&dev->component[COMP_CAMERA]->output[CAM_PORT_PREVIEW];
@@ -878,7 +878,7 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int i)
static int vidioc_querycap(struct file *file, void *priv,
struct v4l2_capability *cap)
{
- struct bm2835_mmal_dev *dev = video_drvdata(file);
+ struct bcm2835_mmal_dev *dev = video_drvdata(file);
u32 major;
u32 minor;
@@ -911,7 +911,7 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{
- struct bm2835_mmal_dev *dev = video_drvdata(file);
+ struct bcm2835_mmal_dev *dev = video_drvdata(file);
f->fmt.pix.width = dev->capture.width;
f->fmt.pix.height = dev->capture.height;
@@ -936,7 +936,7 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{
- struct bm2835_mmal_dev *dev = video_drvdata(file);
+ struct bcm2835_mmal_dev *dev = video_drvdata(file);
struct mmal_fmt *mfmt;
mfmt = get_format(f);
@@ -1010,7 +1010,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
}
-static int mmal_setup_video_component(struct bm2835_mmal_dev *dev,
+static int mmal_setup_video_component(struct bcm2835_mmal_dev *dev,
struct v4l2_format *f)
{
bool overlay_enabled = !!dev->component[COMP_PREVIEW]->enabled;
@@ -1056,7 +1056,7 @@ static int mmal_setup_video_component(struct bm2835_mmal_dev *dev,
return ret;
}
-static int mmal_setup_encode_component(struct bm2835_mmal_dev *dev,
+static int mmal_setup_encode_component(struct bcm2835_mmal_dev *dev,
struct v4l2_format *f,
struct vchiq_mmal_port *port,
struct vchiq_mmal_port *camera_port,
@@ -1144,7 +1144,7 @@ static int mmal_setup_encode_component(struct bm2835_mmal_dev *dev,
return 0;
}
-static int mmal_setup_components(struct bm2835_mmal_dev *dev,
+static int mmal_setup_components(struct bcm2835_mmal_dev *dev,
struct v4l2_format *f)
{
int ret;
@@ -1290,7 +1290,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{
int ret;
- struct bm2835_mmal_dev *dev = video_drvdata(file);
+ struct bcm2835_mmal_dev *dev = video_drvdata(file);
struct mmal_fmt *mfmt;
/* try the format to set valid parameters */
@@ -1333,7 +1333,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
static int vidioc_enum_framesizes(struct file *file, void *fh,
struct v4l2_frmsizeenum *fsize)
{
- struct bm2835_mmal_dev *dev = video_drvdata(file);
+ struct bcm2835_mmal_dev *dev = video_drvdata(file);
static const struct v4l2_frmsize_stepwise sizes = {
MIN_WIDTH, 0, 2,
MIN_HEIGHT, 0, 2
@@ -1358,7 +1358,7 @@ static int vidioc_enum_framesizes(struct file *file, void *fh,
static int vidioc_enum_frameintervals(struct file *file, void *priv,
struct v4l2_frmivalenum *fival)
{
- struct bm2835_mmal_dev *dev = video_drvdata(file);
+ struct bcm2835_mmal_dev *dev = video_drvdata(file);
int i;
if (fival->index)
@@ -1388,7 +1388,7 @@ static int vidioc_enum_frameintervals(struct file *file, void *priv,
static int vidioc_g_parm(struct file *file, void *priv,
struct v4l2_streamparm *parm)
{
- struct bm2835_mmal_dev *dev = video_drvdata(file);
+ struct bcm2835_mmal_dev *dev = video_drvdata(file);
if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;
@@ -1402,7 +1402,7 @@ static int vidioc_g_parm(struct file *file, void *priv,
static int vidioc_s_parm(struct file *file, void *priv,
struct v4l2_streamparm *parm)
{
- struct bm2835_mmal_dev *dev = video_drvdata(file);
+ struct bcm2835_mmal_dev *dev = video_drvdata(file);
struct v4l2_fract tpf;
if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
@@ -1530,7 +1530,7 @@ static int get_num_cameras(struct vchiq_mmal_instance *instance,
static int set_camera_parameters(struct vchiq_mmal_instance *instance,
struct vchiq_mmal_component *camera,
- struct bm2835_mmal_dev *dev)
+ struct bcm2835_mmal_dev *dev)
{
struct mmal_parameter_camera_config cam_config = {
.max_stills_w = dev->max_width,
@@ -1555,7 +1555,7 @@ static int set_camera_parameters(struct vchiq_mmal_instance *instance,
#define MAX_SUPPORTED_ENCODINGS 20
/* MMAL instance and component init */
-static int mmal_init(struct bm2835_mmal_dev *dev)
+static int mmal_init(struct bcm2835_mmal_dev *dev)
{
int ret;
struct mmal_es_format_local *format;
@@ -1769,7 +1769,7 @@ static int mmal_init(struct bm2835_mmal_dev *dev)
return ret;
}
-static int bm2835_mmal_init_device(struct bm2835_mmal_dev *dev,
+static int bm2835_mmal_init_device(struct bcm2835_mmal_dev *dev,
struct video_device *vfd)
{
int ret;
@@ -1798,7 +1798,7 @@ static int bm2835_mmal_init_device(struct bm2835_mmal_dev *dev,
return 0;
}
-static void bcm2835_cleanup_instance(struct bm2835_mmal_dev *dev)
+static void bcm2835_cleanup_instance(struct bcm2835_mmal_dev *dev)
{
if (!dev)
return;
@@ -1849,7 +1849,7 @@ static struct v4l2_format default_v4l2_format = {
static int bcm2835_mmal_probe(struct platform_device *pdev)
{
int ret;
- struct bm2835_mmal_dev *dev;
+ struct bcm2835_mmal_dev *dev;
struct vb2_queue *q;
int camera;
unsigned int num_cameras;
diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.h b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.h
index 75524adff0f5..338b7c142ae3 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.h
+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.h
@@ -32,7 +32,7 @@ enum {
extern int bcm2835_v4l2_debug;
-struct bm2835_mmal_dev {
+struct bcm2835_mmal_dev {
/* v4l2 devices */
struct v4l2_device v4l2_dev;
struct video_device vdev;
@@ -111,11 +111,11 @@ struct bm2835_mmal_dev {
};
int bm2835_mmal_init_controls(
- struct bm2835_mmal_dev *dev,
+ struct bcm2835_mmal_dev *dev,
struct v4l2_ctrl_handler *hdl);
-int bm2835_mmal_set_all_camera_controls(struct bm2835_mmal_dev *dev);
-int set_framerate_params(struct bm2835_mmal_dev *dev);
+int bm2835_mmal_set_all_camera_controls(struct bcm2835_mmal_dev *dev);
+int set_framerate_params(struct bcm2835_mmal_dev *dev);
/* Debug helpers */
diff --git a/drivers/staging/vc04_services/bcm2835-camera/controls.c b/drivers/staging/vc04_services/bcm2835-camera/controls.c
index 3696dfb5a020..03967a7d99a0 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/controls.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/controls.c
@@ -65,7 +65,7 @@ enum bm2835_mmal_ctrl_type {
MMAL_CONTROL_TYPE_CLUSTER, /* special cluster entry */
};
-struct bm2835_mmal_v4l2_ctrl {
+struct bcm2835_mmal_v4l2_ctrl {
u32 id; /* v4l2 control identifier */
enum bm2835_mmal_ctrl_type type;
/* control minimum value or
@@ -77,8 +77,8 @@ struct bm2835_mmal_v4l2_ctrl {
u64 step; /* step size of the control */
const s64 *imenu; /* integer menu array */
u32 mmal_id; /* mmal parameter id */
- int (*setter)(struct bm2835_mmal_dev *dev, struct v4l2_ctrl *ctrl,
- const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl);
+ int (*setter)(struct bcm2835_mmal_dev *dev, struct v4l2_ctrl *ctrl,
+ const struct bcm2835_mmal_v4l2_ctrl *mmal_ctrl);
};
struct v4l2_to_mmal_effects_setting {
@@ -150,9 +150,9 @@ static const struct v4l2_mmal_scene_config scene_configs[] = {
/* control handlers*/
-static int ctrl_set_rational(struct bm2835_mmal_dev *dev,
+static int ctrl_set_rational(struct bcm2835_mmal_dev *dev,
struct v4l2_ctrl *ctrl,
- const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl)
+ const struct bcm2835_mmal_v4l2_ctrl *mmal_ctrl)
{
struct mmal_parameter_rational rational_value;
struct vchiq_mmal_port *control;
@@ -168,9 +168,9 @@ static int ctrl_set_rational(struct bm2835_mmal_dev *dev,
sizeof(rational_value));
}
-static int ctrl_set_value(struct bm2835_mmal_dev *dev,
+static int ctrl_set_value(struct bcm2835_mmal_dev *dev,
struct v4l2_ctrl *ctrl,
- const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl)
+ const struct bcm2835_mmal_v4l2_ctrl *mmal_ctrl)
{
u32 u32_value;
struct vchiq_mmal_port *control;
@@ -184,9 +184,9 @@ static int ctrl_set_value(struct bm2835_mmal_dev *dev,
&u32_value, sizeof(u32_value));
}
-static int ctrl_set_iso(struct bm2835_mmal_dev *dev,
+static int ctrl_set_iso(struct bcm2835_mmal_dev *dev,
struct v4l2_ctrl *ctrl,
- const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl)
+ const struct bcm2835_mmal_v4l2_ctrl *mmal_ctrl)
{
u32 u32_value;
struct vchiq_mmal_port *control;
@@ -212,9 +212,9 @@ static int ctrl_set_iso(struct bm2835_mmal_dev *dev,
&u32_value, sizeof(u32_value));
}
-static int ctrl_set_value_ev(struct bm2835_mmal_dev *dev,
+static int ctrl_set_value_ev(struct bcm2835_mmal_dev *dev,
struct v4l2_ctrl *ctrl,
- const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl)
+ const struct bcm2835_mmal_v4l2_ctrl *mmal_ctrl)
{
s32 s32_value;
struct vchiq_mmal_port *control;
@@ -228,9 +228,9 @@ static int ctrl_set_value_ev(struct bm2835_mmal_dev *dev,
&s32_value, sizeof(s32_value));
}
-static int ctrl_set_rotate(struct bm2835_mmal_dev *dev,
+static int ctrl_set_rotate(struct bcm2835_mmal_dev *dev,
struct v4l2_ctrl *ctrl,
- const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl)
+ const struct bcm2835_mmal_v4l2_ctrl *mmal_ctrl)
{
int ret;
u32 u32_value;
@@ -257,9 +257,9 @@ static int ctrl_set_rotate(struct bm2835_mmal_dev *dev,
&u32_value, sizeof(u32_value));
}
-static int ctrl_set_flip(struct bm2835_mmal_dev *dev,
+static int ctrl_set_flip(struct bcm2835_mmal_dev *dev,
struct v4l2_ctrl *ctrl,
- const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl)
+ const struct bcm2835_mmal_v4l2_ctrl *mmal_ctrl)
{
int ret;
u32 u32_value;
@@ -298,9 +298,9 @@ static int ctrl_set_flip(struct bm2835_mmal_dev *dev,
&u32_value, sizeof(u32_value));
}
-static int ctrl_set_exposure(struct bm2835_mmal_dev *dev,
+static int ctrl_set_exposure(struct bcm2835_mmal_dev *dev,
struct v4l2_ctrl *ctrl,
- const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl)
+ const struct bcm2835_mmal_v4l2_ctrl *mmal_ctrl)
{
enum mmal_parameter_exposuremode exp_mode = dev->exposure_mode_user;
u32 shutter_speed = 0;
@@ -354,9 +354,9 @@ static int ctrl_set_exposure(struct bm2835_mmal_dev *dev,
return ret;
}
-static int ctrl_set_metering_mode(struct bm2835_mmal_dev *dev,
+static int ctrl_set_metering_mode(struct bcm2835_mmal_dev *dev,
struct v4l2_ctrl *ctrl,
- const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl)
+ const struct bcm2835_mmal_v4l2_ctrl *mmal_ctrl)
{
switch (ctrl->val) {
case V4L2_EXPOSURE_METERING_AVERAGE:
@@ -390,9 +390,9 @@ static int ctrl_set_metering_mode(struct bm2835_mmal_dev *dev,
}
}
-static int ctrl_set_flicker_avoidance(struct bm2835_mmal_dev *dev,
+static int ctrl_set_flicker_avoidance(struct bcm2835_mmal_dev *dev,
struct v4l2_ctrl *ctrl,
- const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl)
+ const struct bcm2835_mmal_v4l2_ctrl *mmal_ctrl)
{
u32 u32_value;
struct vchiq_mmal_port *control;
@@ -419,9 +419,9 @@ static int ctrl_set_flicker_avoidance(struct bm2835_mmal_dev *dev,
&u32_value, sizeof(u32_value));
}
-static int ctrl_set_awb_mode(struct bm2835_mmal_dev *dev,
+static int ctrl_set_awb_mode(struct bcm2835_mmal_dev *dev,
struct v4l2_ctrl *ctrl,
- const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl)
+ const struct bcm2835_mmal_v4l2_ctrl *mmal_ctrl)
{
u32 u32_value;
struct vchiq_mmal_port *control;
@@ -475,9 +475,9 @@ static int ctrl_set_awb_mode(struct bm2835_mmal_dev *dev,
&u32_value, sizeof(u32_value));
}
-static int ctrl_set_awb_gains(struct bm2835_mmal_dev *dev,
+static int ctrl_set_awb_gains(struct bcm2835_mmal_dev *dev,
struct v4l2_ctrl *ctrl,
- const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl)
+ const struct bcm2835_mmal_v4l2_ctrl *mmal_ctrl)
{
struct vchiq_mmal_port *control;
struct mmal_parameter_awbgains gains;
@@ -498,9 +498,9 @@ static int ctrl_set_awb_gains(struct bm2835_mmal_dev *dev,
&gains, sizeof(gains));
}
-static int ctrl_set_image_effect(struct bm2835_mmal_dev *dev,
+static int ctrl_set_image_effect(struct bcm2835_mmal_dev *dev,
struct v4l2_ctrl *ctrl,
- const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl)
+ const struct bcm2835_mmal_v4l2_ctrl *mmal_ctrl)
{
int ret = -EINVAL;
int i, j;
@@ -555,9 +555,9 @@ static int ctrl_set_image_effect(struct bm2835_mmal_dev *dev,
return (ret == 0 ? 0 : -EINVAL);
}
-static int ctrl_set_colfx(struct bm2835_mmal_dev *dev,
+static int ctrl_set_colfx(struct bcm2835_mmal_dev *dev,
struct v4l2_ctrl *ctrl,
- const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl)
+ const struct bcm2835_mmal_v4l2_ctrl *mmal_ctrl)
{
int ret;
struct vchiq_mmal_port *control;
@@ -579,9 +579,9 @@ static int ctrl_set_colfx(struct bm2835_mmal_dev *dev,
return (ret == 0 ? 0 : -EINVAL);
}
-static int ctrl_set_bitrate(struct bm2835_mmal_dev *dev,
+static int ctrl_set_bitrate(struct bcm2835_mmal_dev *dev,
struct v4l2_ctrl *ctrl,
- const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl)
+ const struct bcm2835_mmal_v4l2_ctrl *mmal_ctrl)
{
int ret;
struct vchiq_mmal_port *encoder_out;
@@ -607,9 +607,9 @@ static int ctrl_set_bitrate(struct bm2835_mmal_dev *dev,
return 0;
}
-static int ctrl_set_bitrate_mode(struct bm2835_mmal_dev *dev,
+static int ctrl_set_bitrate_mode(struct bcm2835_mmal_dev *dev,
struct v4l2_ctrl *ctrl,
- const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl)
+ const struct bcm2835_mmal_v4l2_ctrl *mmal_ctrl)
{
u32 bitrate_mode;
struct vchiq_mmal_port *encoder_out;
@@ -634,9 +634,9 @@ static int ctrl_set_bitrate_mode(struct bm2835_mmal_dev *dev,
return 0;
}
-static int ctrl_set_image_encode_output(struct bm2835_mmal_dev *dev,
+static int ctrl_set_image_encode_output(struct bcm2835_mmal_dev *dev,
struct v4l2_ctrl *ctrl,
- const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl)
+ const struct bcm2835_mmal_v4l2_ctrl *mmal_ctrl)
{
u32 u32_value;
struct vchiq_mmal_port *jpeg_out;
@@ -650,9 +650,9 @@ static int ctrl_set_image_encode_output(struct bm2835_mmal_dev *dev,
&u32_value, sizeof(u32_value));
}
-static int ctrl_set_video_encode_param_output(struct bm2835_mmal_dev *dev,
+static int ctrl_set_video_encode_param_output(struct bcm2835_mmal_dev *dev,
struct v4l2_ctrl *ctrl,
- const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl)
+ const struct bcm2835_mmal_v4l2_ctrl *mmal_ctrl)
{
u32 u32_value;
struct vchiq_mmal_port *vid_enc_ctl;
@@ -666,9 +666,9 @@ static int ctrl_set_video_encode_param_output(struct bm2835_mmal_dev *dev,
&u32_value, sizeof(u32_value));
}
-static int ctrl_set_video_encode_profile_level(struct bm2835_mmal_dev *dev,
+static int ctrl_set_video_encode_profile_level(struct bcm2835_mmal_dev *dev,
struct v4l2_ctrl *ctrl,
- const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl)
+ const struct bcm2835_mmal_v4l2_ctrl *mmal_ctrl)
{
struct mmal_parameter_video_profile param;
int ret = 0;
@@ -777,9 +777,9 @@ static int ctrl_set_video_encode_profile_level(struct bm2835_mmal_dev *dev,
return ret;
}
-static int ctrl_set_scene_mode(struct bm2835_mmal_dev *dev,
+static int ctrl_set_scene_mode(struct bcm2835_mmal_dev *dev,
struct v4l2_ctrl *ctrl,
- const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl)
+ const struct bcm2835_mmal_v4l2_ctrl *mmal_ctrl)
{
int ret = 0;
int shutter_speed;
@@ -886,10 +886,9 @@ static int ctrl_set_scene_mode(struct bm2835_mmal_dev *dev,
static int bm2835_mmal_s_ctrl(struct v4l2_ctrl *ctrl)
{
- struct bm2835_mmal_dev *dev =
- container_of(ctrl->handler, struct bm2835_mmal_dev,
- ctrl_handler);
- const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl = ctrl->priv;
+ struct bcm2835_mmal_dev *dev = container_of(ctrl->handler, struct bcm2835_mmal_dev,
+ ctrl_handler);
+ const struct bcm2835_mmal_v4l2_ctrl *mmal_ctrl = ctrl->priv;
int ret;
if (!mmal_ctrl || mmal_ctrl->id != ctrl->id || !mmal_ctrl->setter) {
@@ -908,7 +907,7 @@ static const struct v4l2_ctrl_ops bm2835_mmal_ctrl_ops = {
.s_ctrl = bm2835_mmal_s_ctrl,
};
-static const struct bm2835_mmal_v4l2_ctrl v4l2_ctrls[V4L2_CTRL_COUNT] = {
+static const struct bcm2835_mmal_v4l2_ctrl v4l2_ctrls[V4L2_CTRL_COUNT] = {
{
.id = V4L2_CID_SATURATION,
.type = MMAL_CONTROL_TYPE_STD,
@@ -1247,7 +1246,7 @@ static const struct bm2835_mmal_v4l2_ctrl v4l2_ctrls[V4L2_CTRL_COUNT] = {
},
};
-int bm2835_mmal_set_all_camera_controls(struct bm2835_mmal_dev *dev)
+int bm2835_mmal_set_all_camera_controls(struct bcm2835_mmal_dev *dev)
{
int c;
int ret = 0;
@@ -1267,7 +1266,7 @@ int bm2835_mmal_set_all_camera_controls(struct bm2835_mmal_dev *dev)
return ret;
}
-int set_framerate_params(struct bm2835_mmal_dev *dev)
+int set_framerate_params(struct bcm2835_mmal_dev *dev)
{
struct mmal_parameter_fps_range fps_range;
int ret;
@@ -1312,11 +1311,11 @@ int set_framerate_params(struct bm2835_mmal_dev *dev)
return ret;
}
-int bm2835_mmal_init_controls(struct bm2835_mmal_dev *dev,
+int bm2835_mmal_init_controls(struct bcm2835_mmal_dev *dev,
struct v4l2_ctrl_handler *hdl)
{
int c;
- const struct bm2835_mmal_v4l2_ctrl *ctrl;
+ const struct bcm2835_mmal_v4l2_ctrl *ctrl;
v4l2_ctrl_handler_init(hdl, V4L2_CTRL_COUNT);
--
2.34.1
^ permalink raw reply related
* Re: [docs] [RFC] doc: add release notes for 3.4
From: Michael Opdenacker @ 2022-01-05 20:36 UTC (permalink / raw)
To: docs
In-Reply-To: <16C77A129140C516.23342@lists.yoctoproject.org>
[-- Attachment #1: Type: text/plain, Size: 1134 bytes --]
On 1/5/22 9:33 PM, Michael Opdenacker wrote:
> Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
> ---
>
> The idea is to add the release notes to the documentation
> repository. Let's start with 3.4, to collect feedback,
> before migrating earlier releases.
>
> The release notes have been adapted to make them
> more reader friends. That's why they no longer start
> with raw tree and branch information.
>
> documentation/conf.py | 1 +
> documentation/index.rst | 1 +
> .../migration-guides/migration-3.4.rst | 2 +
> documentation/release-notes/3.4.rst | 803 ++++++++++++++++++
> documentation/release-notes/index.rst | 15 +
> 5 files changed, 822 insertions(+)
> create mode 100644 documentation/release-notes/3.4.rst
> create mode 100644 documentation/release-notes/index.rst
To make the new document easier to review, here's the HTML output for
the 3.4 release notes as an attachment.
Thanks in advance for your reviews,
Michael.
--
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
[-- Attachment #2: 3.4.html --]
[-- Type: text/html, Size: 58626 bytes --]
^ permalink raw reply
* [PATCH 0/6] staging: vc04_services: rename ocurrences of 'bm2835*' to 'bcm2835*'
From: Gaston Gonzalez @ 2022-01-05 20:35 UTC (permalink / raw)
To: linux-staging
Cc: gregkh, nsaenz, f.fainelli, rjui, sbranden, juerg.haefliger,
rdunlap, dave.stevenson, stefan.wahren, unixbhaskar,
mitaliborkar810, phil, len.baker, linux-rpi-kernel,
linux-arm-kernel, bcm-kernel-feedback-list, linux-kernel, gascoar
This patch set renames ocurrences of 'bm2835*' to 'bcm2835*'.
Gaston Gonzalez (6):
staging: vc04_services: rename structures bm2835_mmal_dev and
bm2835_mmal_v4l2_ctrl
staging: vc04_services: rename functions containing bm2835_* to
bcm2835_*
staging: vc04_services: rename variables containing bm2835_* to
bcm2835_*
staging: vc04_services: rename string literal containing bm2835_* to
bcm2835*_
staging: vc04_services: rename macros BM2835_MMAL_VERSION and
BM2835_MMAL_MODULE_NAME
staging: vc04_services: rename BM2835 to BCM2835 in headers comments
.../bcm2835-camera/bcm2835-camera.c | 103 +++++++------
.../bcm2835-camera/bcm2835-camera.h | 12 +-
.../vc04_services/bcm2835-camera/controls.c | 137 ++++++++----------
.../vc04_services/vchiq-mmal/mmal-common.h | 2 +-
.../vc04_services/vchiq-mmal/mmal-encodings.h | 2 +-
.../vchiq-mmal/mmal-msg-common.h | 2 +-
.../vchiq-mmal/mmal-msg-format.h | 2 +-
.../vc04_services/vchiq-mmal/mmal-msg-port.h | 2 +-
.../vc04_services/vchiq-mmal/mmal-msg.h | 2 +-
.../vchiq-mmal/mmal-parameters.h | 2 +-
.../vc04_services/vchiq-mmal/mmal-vchiq.c | 2 +-
.../vc04_services/vchiq-mmal/mmal-vchiq.h | 2 +-
12 files changed, 127 insertions(+), 143 deletions(-)
--
2.34.1
^ permalink raw reply
* [Buildroot] [git commit] package/fakedate: fix finding the right date executable
From: Yann E. MORIN @ 2022-01-05 20:35 UTC (permalink / raw)
To: buildroot
[-- Attachment #1: Type: text/plain, Size: 2282 bytes --]
commit: https://git.buildroot.net/buildroot/commit/?id=cd9c604c96480819c053811432b7c36073ad785e
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master
Currently, we look for the actual date be easrching form the end of the
PATH, and keeping the last-found date that occurs after the wrapper.
However, in some cases, the wrapper will be the last item in the PATH.
This is the cae when users already have the HOST_DIR/bin at the end of
their PATH, Ã -la: PATH="${PATH}:/path/to/buildroot/output/host/bin"
In this case, we would not find any matching date.
The issue is that Buildroot adds HOST_DIR/bin at the beginning of the
PATH, so the real date will be to be found after the HOST_DIR that is
early in the PATH, but before the HOST_DIR that is at the end.
We fix the issue by searching the PATH as it is expecte to be searched,
shoud Buildroot had not added its date wrapper: we use the first date
executable that is found in the PATH, starting from the beginning, that
is after our wrapper, abd that is not the wrapper itself.
Signed-off-by: Ignacy GawÄdzki <ignacy.gawedzki@green-communications.fr>
[yann.morin.1998@free.fr:
- iterate in order from first-to-last
- stop on the first occurence
- handle the case where no date was found
- extend and expand the commit log
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
---
package/fakedate/fakedate | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/package/fakedate/fakedate b/package/fakedate/fakedate
index 9bef113357..7ebbf1f0da 100755
--- a/package/fakedate/fakedate
+++ b/package/fakedate/fakedate
@@ -18,16 +18,23 @@
# Copyright (C) 2016 Jérôme Pouiller <jezz@sysmic.org>
#
-DATE_BIN=false
# Do not call any 'date' before us in the PATH, or that would create
# an infinite recursion.
-for date in $(which -a date |tac); do
+found=false
+for date in $(which -a date); do
if [ "${date}" -ef "$0" ]; then
+ found=true
+ elif ${found}; then
+ DATE_BIN="${date}"
break
fi
- DATE_BIN="${date}"
done
+if [ -z "${DATE_BIN}" ]; then
+ printf 'fakedate: no real date found in PATH after "%s"\n' "${0}" >&2
+ exit 1
+fi
+
if [ -n "$SOURCE_DATE_EPOCH" ]; then
FORCE_EPOCH=1
for i in "$@"; do
[-- Attachment #2: Type: text/plain, Size: 150 bytes --]
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related
* Re: [PATCH] pmcraid: don't use GFP_DMA in pmcraid_alloc_sglist
From: Christophe JAILLET @ 2022-01-05 20:35 UTC (permalink / raw)
To: hch; +Cc: linux-scsi, martin.petersen, Kernel Janitors
In-Reply-To: <20211222092247.928711-1-hch@lst.de>
> The driver doesn't express DMA addressing limitation under 32-bits
> anywhere else, so remove the spurious GFP_DMA allocation.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> drivers/scsi/pmcraid.c <https://lore.kernel.org/all/20211222092247.928711-1-hch@lst.de/#Z31drivers:scsi:pmcraid.c> | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff
<https://lore.kernel.org/all/20211222092247.928711-1-hch@lst.de/#iZ31drivers:scsi:pmcraid.c>
--git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c > index
2fe7a0019fff2..928532180d323 100644 > --- a/drivers/scsi/pmcraid.c > +++
b/drivers/scsi/pmcraid.c > @@ -3221,8 +3221,8 @@ static struct
pmcraid_sglist *pmcraid_alloc_sglist(int buflen) > return NULL;
>
> sglist->order = order;
> - sgl_alloc_order(buflen, order, false, > - GFP_KERNEL | GFP_DMA | __GFP_ZERO, &sglist->num_sg); > +
sgl_alloc_order(buflen, order, false, GFP_KERNEL | __GFP_ZERO, > +
&sglist->num_sg); >
> return sglist;
> }
Hi,
some time ago I sent a patch because the address returned by
sgl_alloc_order() isn't saved anywhere and really look like a bogus allocation and certainly a memory leak.
See https://lore.kernel.org/linux-kernel/20200920075722.376644-1-christophe.jaillet@wanadoo.fr/
CJ
^ permalink raw reply
* Re: [PATCH] rtc: isl1208: avoid unnecessary rc variable tests
From: Hugo Villeneuve @ 2022-01-05 20:34 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Alessandro Zummo, Hugo Villeneuve, linux-rtc, linux-kernel
In-Reply-To: <YdX5BocOfHE/0twa@piout.net>
On Wed, 5 Jan 2022 21:01:10 +0100
Alexandre Belloni <alexandre.belloni@bootlin.com> wrote:
> On 05/01/2022 14:34:39-0500, Hugo Villeneuve wrote:
> > From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
> >
> > The rc variable doesn't need to be tested a second time when the <if> block
> > evaluates to false.
> >
>
> rc is not tested a second time, here is the relevant listing:
>
> - if (client->irq > 0)
> + if (client->irq > 0) {
> ffffffff81aef647: 41 8b b5 bc 01 00 00 mov 0x1bc(%r13),%esi
> ffffffff81aef64e: 85 f6 test %esi,%esi
> ffffffff81aef650: 0f 8f 35 01 00 00 jg ffffffff81aef78b <isl1208_probe+0x314>
> rc = isl1208_setup_irq(client, client->irq);
> if (rc)
> return rc;
> + }
>
> - if (evdet_irq > 0 && evdet_irq != client->irq)
> + if (evdet_irq > 0 && evdet_irq != client->irq) {
> ffffffff81aef656: 85 db test %ebx,%ebx
> ffffffff81aef658: 7e 0d jle ffffffff81aef667 <isl1208_probe+0x1f0>
> ffffffff81aef65a: 41 39 9d bc 01 00 00 cmp %ebx,0x1bc(%r13)
> @@ -1663,6 +1664,7 @@ ffffffff81aef661: 0f 85 0a 01 00 00
> rc = isl1208_setup_irq(client, evdet_irq);
> if (rc)
> return rc;
> + }
>
> As you can see, no change in assembly but it is worse to read. gcc on
> arm behaves the same way.
Hi Alexandre,
I am not sure that I fully understand your assembly code analysis. Maybe my patch comment was misleading, because I am not talking about a redundant test inside the if block, but ouside of it (after it).
Here is the original code with my annotations. Let's assume that the variable client->irq = 0:
---
/* If client->irq = 0, then function isl1208_setup_irq() will not be called, and rc will not be modified: */
if (client->irq > 0)
rc = isl1208_setup_irq(client, client->irq);
/* If rc hasn't been modified, there is no need to re-test its value here: */
if (rc)
return rc;
---
After the patch, this code section becomes:
---
if (client->irq > 0) {
rc = isl1208_setup_irq(client, client->irq);
if (rc)
return rc;
}
---
For me it is more logical and clearer like this. Moreover, you can see that at line 873 of the original driver, the same kind of mechanism is used:
---
if (isl1208->config->has_timestamp) {
rc = rtc_add_group(isl1208->rtc, &isl1219_rtc_sysfs_files);
if (rc)
return rc;
}
---
Regards,
Hugo.
> > Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
> > ---
> > drivers/rtc/rtc-isl1208.c | 14 ++++++++------
> > 1 file changed, 8 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c
> > index 182dfa605515..c7f04df5a0b6 100644
> > --- a/drivers/rtc/rtc-isl1208.c
> > +++ b/drivers/rtc/rtc-isl1208.c
> > @@ -880,15 +880,17 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id)
> > if (rc)
> > return rc;
> >
> > - if (client->irq > 0)
> > + if (client->irq > 0) {
> > rc = isl1208_setup_irq(client, client->irq);
> > - if (rc)
> > - return rc;
> > + if (rc)
> > + return rc;
> > + }
> >
> > - if (evdet_irq > 0 && evdet_irq != client->irq)
> > + if (evdet_irq > 0 && evdet_irq != client->irq) {
> > rc = isl1208_setup_irq(client, evdet_irq);
> > - if (rc)
> > - return rc;
> > + if (rc)
> > + return rc;
> > + }
> >
> > rc = devm_rtc_nvmem_register(isl1208->rtc, &isl1208->nvmem_config);
> > if (rc)
> > --
> > 2.30.2
> >
>
> --
> Alexandre Belloni, co-owner and COO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
>
--
Hugo Villeneuve <hugo@hugovil.com>
^ permalink raw reply
* [Buildroot] [git commit] package/vdr: enable musl/uclibc build
From: Thomas Petazzoni @ 2022-01-05 20:33 UTC (permalink / raw)
To: buildroot
commit: https://git.buildroot.net/buildroot/commit/?id=64843258ce59822ad8d52e75fd4d8fcf10c9b041
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master
Re-add patch 0001 to fix uClibc build, this patch was removed 2019:
https://git.buildroot.net/buildroot/commit/?id=573d15b0790cfd2838cf0544ded79b415e20f5a7
Add two more patches from Alpine Linux to fix musl build.
Add optional dependency to libexecinfo to provide execinfo.h.
Add a patch that ensures an internal gettext symbol doesn't get used
except on glibc and uclibc toolchains. Indeed, both glibc and uclibc
provide the _nl_msg_cat_cntr variable, but not the musl
implementation.
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
package/vdr/0001-getloadavg.patch | 55 ++++++++
package/vdr/0002-musl-compat.patch | 140 +++++++++++++++++++++
package/vdr/0003-include-missing-limits.patch | 30 +++++
...msg_cat_cntr-is-an-internal-symbol-of-som.patch | 35 ++++++
package/vdr/Config.in | 7 +-
package/vdr/vdr.mk | 5 +
6 files changed, 268 insertions(+), 4 deletions(-)
diff --git a/package/vdr/0001-getloadavg.patch b/package/vdr/0001-getloadavg.patch
new file mode 100644
index 0000000000..9e6316e284
--- /dev/null
+++ b/package/vdr/0001-getloadavg.patch
@@ -0,0 +1,55 @@
+Fix compilation with uClibc
+
+Ported from
+https://github.com/stschake/buildroot-grasshopper/blob/master/package/torsmo/torsmo-0.18-uclibc-getloadavg.patch
+
+Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
+
+diff -uwNr vdr-2.3.1.org/skinlcars.c vdr-2.3.1/skinlcars.c
+--- vdr-2.3.1.org/skinlcars.c 2015-09-01 12:07:07.000000000 +0200
++++ vdr-2.3.1/skinlcars.c 2016-07-31 21:00:11.000000000 +0200
+@@ -1100,6 +1100,44 @@
+ }
+ }
+
++/* uclibc and dietlibc do not have this junk -ReneR */
++#if defined (__UCLIBC__) || defined (__dietlibc__)
++static int getloadavg (double loadavg[], int nelem)
++{
++ int fd;
++
++ fd = open ("/proc/loadavg", O_RDONLY);
++ if (fd < 0)
++ return -1;
++ else
++ {
++ char buf[65], *p;
++ ssize_t nread;
++ int i;
++
++ nread = read (fd, buf, sizeof buf - 1);
++ close (fd);
++ if (nread <= 0)
++ return -1;
++ buf[nread - 1] = '\0';
++
++ if (nelem > 3)
++ nelem = 3;
++ p = buf;
++ for (i = 0; i < nelem; ++i)
++ {
++ char *endp;
++ loadavg[i] = strtod (p, &endp);
++ if (endp == p)
++ return -1;
++ p = endp;
++ }
++
++ return i;
++ }
++}
++#endif
++
+ void cSkinLCARSDisplayMenu::DrawLoad(void)
+ {
+ if (yb04) {
diff --git a/package/vdr/0002-musl-compat.patch b/package/vdr/0002-musl-compat.patch
new file mode 100644
index 0000000000..b6f8f414a9
--- /dev/null
+++ b/package/vdr/0002-musl-compat.patch
@@ -0,0 +1,140 @@
+Fix musl build
+
+Downloaded from
+https://git.alpinelinux.org/aports/tree/community/vdr/musl-compat.patch
+
+Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
+
+diff --git a/i18n.h b/i18n.h
+index f8ad9de..b002bbf 100644
+--- a/i18n.h
++++ b/i18n.h
+@@ -46,7 +46,7 @@ const cStringList *I18nLanguages(void);
+ ///< have an actual locale installed. The rest are just dummy entries
+ ///< to allow having three letter language codes for other languages
+ ///< that have no actual locale on this system.
+-const char *I18nTranslate(const char *s, const char *Plugin = NULL) __attribute_format_arg__(1);
++const char *I18nTranslate(const char *s, const char *Plugin = NULL) __attribute__((__format_arg__ (1)));
+ ///< Translates the given string (with optional Plugin context) into
+ ///< the current language. If no translation is available, the original
+ ///< string will be returned.
+diff --git a/osd.c b/osd.c
+index 524700a..ef975f5 100644
+--- a/osd.c
++++ b/osd.c
+@@ -12,7 +12,7 @@
+ #include <stdlib.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+-#include <sys/unistd.h>
++#include <unistd.h>
+ #include "device.h"
+ #include "tools.h"
+
+diff --git a/thread.c b/thread.c
+index 47eb977..58dba43 100644
+--- a/thread.c
++++ b/thread.c
+@@ -155,7 +155,9 @@ cRwLock::cRwLock(bool PreferWriter)
+ writeLockThreadId = 0;
+ pthread_rwlockattr_t attr;
+ pthread_rwlockattr_init(&attr);
++#if defined(__GLIBC__)
+ pthread_rwlockattr_setkind_np(&attr, PreferWriter ? PTHREAD_RWLOCK_PREFER_WRITER_NP : PTHREAD_RWLOCK_PREFER_READER_NP);
++#endif
+ pthread_rwlock_init(&rwlock, &attr);
+ }
+
+@@ -205,7 +207,7 @@ cMutex::cMutex(void)
+ locked = 0;
+ pthread_mutexattr_t attr;
+ pthread_mutexattr_init(&attr);
+- pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK_NP);
++ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
+ pthread_mutex_init(&mutex, &attr);
+ }
+
+diff --git a/tools.c b/tools.c
+index 754673d..fef9d2d 100644
+--- a/tools.c
++++ b/tools.c
+@@ -640,7 +640,7 @@ char *ReadLink(const char *FileName)
+ {
+ if (!FileName)
+ return NULL;
+- char *TargetName = canonicalize_file_name(FileName);
++ char *TargetName = realpath(FileName, NULL);
+ if (!TargetName) {
+ if (errno == ENOENT) // file doesn't exist
+ TargetName = strdup(FileName);
+@@ -1528,7 +1528,7 @@
+ struct dirent *cReadDir::Next(void)
+ {
+ if (directory) {
+-#if !__GLIBC_PREREQ(2, 24) // readdir_r() is deprecated as of GLIBC 2.24
++#if __GLIBC__
+ while (readdir_r(directory, &u.d, &result) == 0 && result) {
+ #else
+ while ((result = readdir(directory)) != NULL) {
+diff --git a/tools.h b/tools.h
+index 73cca5a..03f5fd1 100644
+--- a/tools.h
++++ b/tools.h
+@@ -28,6 +28,16 @@
+ #include <sys/types.h>
+ #include "thread.h"
+
++#ifndef ACCESSPERMS
++# define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
++#endif
++#ifndef ALLPERMS
++# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)/* 07777 */
++#endif
++#ifndef DEFFILEMODE
++# define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* 0666*/
++#endif
++
+ typedef unsigned char uchar;
+
+ extern int SysLogLevel;
+@@ -400,7 +410,7 @@
+ private:
+ DIR *directory;
+ struct dirent *result;
+-#if !__GLIBC_PREREQ(2, 24) // readdir_r() is deprecated as of GLIBC 2.24
++#if __GLIBC__
+ union { // according to "The GNU C Library Reference Manual"
+ struct dirent d;
+ char b[offsetof(struct dirent, d_name) + NAME_MAX + 1];
+@@ -738,7 +748,7 @@ public:
+ data[i] = T(0);
+ size = 0;
+ }
+- void Sort(__compar_fn_t Compare)
++ void Sort(int (*Compare)(const void *, const void *))
+ {
+ qsort(data, size, sizeof(T), Compare);
+ }
+diff --git a/vdr.c b/vdr.c
+index 8a49471..c2a82aa 100644
+--- a/vdr.c
++++ b/vdr.c
+@@ -670,12 +670,18 @@ int main(int argc, char *argv[])
+ }
+ }
+ else if (Terminal) {
++#ifdef __GLIBC__
+ // Claim new controlling terminal
+ stdin = freopen(Terminal, "r", stdin);
+ stdout = freopen(Terminal, "w", stdout);
+ stderr = freopen(Terminal, "w", stderr);
+ HasStdin = true;
+ tcgetattr(STDIN_FILENO, &savedTm);
++#else
++ // stdin, stdout, stderr are declared FILE const* by musl C library
++ fprintf(stderr, "Option '-t' is only supported if VDR has been built against glibc.\n");
++ return 2;
++#endif
+ }
+
+ isyslog("VDR version %s started", VDRVERSION);
diff --git a/package/vdr/0003-include-missing-limits.patch b/package/vdr/0003-include-missing-limits.patch
new file mode 100644
index 0000000000..c2efe291e6
--- /dev/null
+++ b/package/vdr/0003-include-missing-limits.patch
@@ -0,0 +1,30 @@
+vdr package uses some macros like HOST_NAME_MAX, NAME_MAX, which are defined
+in limits.h.
+Needs to be explicitly included on ppc64le and for all archs for debug build.
+
+Downloaded from
+https://git.alpinelinux.org/aports/tree/community/vdr/include-missing-limits.patch
+
+Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
+----
+
+--- a/config.h
++++ b/config.h
+@@ -19,6 +19,7 @@
+ #include "i18n.h"
+ #include "font.h"
+ #include "tools.h"
++#include <limits.h>
+
+ // VDR's own version number:
+
+--- a/tools.c
++++ b/tools.c
+@@ -27,6 +27,7 @@
+ #include <utime.h>
+ #include "i18n.h"
+ #include "thread.h"
++#include <limits.h>
+
+ int SysLogLevel = 3;
+
diff --git a/package/vdr/0004-i18n.c-_nl_msg_cat_cntr-is-an-internal-symbol-of-som.patch b/package/vdr/0004-i18n.c-_nl_msg_cat_cntr-is-an-internal-symbol-of-som.patch
new file mode 100644
index 0000000000..9cc45a96c1
--- /dev/null
+++ b/package/vdr/0004-i18n.c-_nl_msg_cat_cntr-is-an-internal-symbol-of-som.patch
@@ -0,0 +1,35 @@
+From 8711ce9c4ded311705f281c99e013a26987fbf1d Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
+Date: Sat, 1 Jan 2022 23:35:29 +0100
+Subject: [PATCH] i18n.c: _nl_msg_cat_cntr is an internal symbol of some intl
+ implementation
+
+It is supported by glibc and uClibc (which both define __GLIBC__) but
+not musl (which doesn't define __GLIBC__). On musl, it doesn't do
+anything because musl has a basic NLS implementation. Even
+gettext-tiny defines _nl_msg_cat_cntr as a dummy symbol in its stub
+libintl-musl implementation.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
+---
+ i18n.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/i18n.c b/i18n.c
+index 0ef08fd4..da2a3ede 100644
+--- a/i18n.c
++++ b/i18n.c
+@@ -123,8 +123,10 @@ static const char *SkipContext(const char *s)
+ static void SetEnvLanguage(const char *Locale)
+ {
+ setenv("LANGUAGE", Locale, 1);
++#if defined(__GLIBC__)
+ extern int _nl_msg_cat_cntr;
+ ++_nl_msg_cat_cntr;
++#endif
+ }
+
+ static void SetLanguageNames(void)
+--
+2.31.1
+
diff --git a/package/vdr/Config.in b/package/vdr/Config.in
index df602f26d6..38502729a7 100644
--- a/package/vdr/Config.in
+++ b/package/vdr/Config.in
@@ -4,23 +4,22 @@ config BR2_PACKAGE_VDR
depends on !BR2_STATIC_LIBS
depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_9
- depends on BR2_TOOLCHAIN_USES_GLIBC # execinfo.h
depends on BR2_USE_MMU # fork()
depends on BR2_USE_WCHAR
select BR2_PACKAGE_FONTCONFIG
select BR2_PACKAGE_FREETYPE
select BR2_PACKAGE_JPEG
select BR2_PACKAGE_LIBCAP
- select BR2_PACKAGE_LIBICONV if !BR2_ENABLE_LOCALE
+ select BR2_PACKAGE_LIBEXECINFO if !BR2_TOOLCHAIN_USES_GLIBC
help
This project describes how to build your own digital
satellite receiver and Video Disk Recorder.
http://www.tvdr.de
-comment "vdr needs a glibc toolchain w/ C++, dynamic library, NPTL, wchar, headers >= 3.9"
+comment "vdr needs a toolchain w/ C++, dynamic library, NPTL, wchar, headers >= 3.9"
depends on BR2_USE_MMU
depends on !BR2_INSTALL_LIBSTDCPP || BR2_STATIC_LIBS || \
!BR2_TOOLCHAIN_HAS_THREADS_NPTL || \
- !BR2_TOOLCHAIN_USES_GLIBC || !BR2_USE_WCHAR || \
+ !BR2_USE_WCHAR || \
!BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_9
diff --git a/package/vdr/vdr.mk b/package/vdr/vdr.mk
index 51affe5a7b..bb7b1e22c0 100644
--- a/package/vdr/vdr.mk
+++ b/package/vdr/vdr.mk
@@ -26,6 +26,11 @@ VDR_MAKE_FLAGS = \
VIDEODIR=/var/lib/vdr
VDR_LDFLAGS = $(TARGET_NLS_LIBS)
+ifeq ($(BR2_PACKAGE_LIBEXECINFO),y)
+VDR_DEPENDENCIES += libexecinfo
+VDR_LDFLAGS += -lexecinfo
+endif
+
ifeq ($(BR2_PACKAGE_LIBFRIBIDI),y)
VDR_DEPENDENCIES += libfribidi
VDR_MAKE_FLAGS += BIDI=1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related
* Re: [PATCH v4] builtin/reflog.c: use parse-options api for expire, delete subcommands
From: Junio C Hamano @ 2022-01-05 20:34 UTC (permalink / raw)
To: John Cai via GitGitGadget; +Cc: git, René Scharfe, John Cai
In-Reply-To: <pull.1175.v4.git.git.1641355561700.gitgitgadget@gmail.com>
"John Cai via GitGitGadget" <gitgitgadget@gmail.com> writes:
> +static int expire_unreachable_callback(const struct option *opt,
> + const char *arg,
> + int unset)
> +{
> + struct cmd_reflog_expire_cb *cmd = opt->value;
> +
> + if (parse_expiry_date(arg, &cmd->expire_unreachable))
> + die(_("malformed expiration date '%s'"), arg);
Was there a reason to indent this overly deep? The same for the
other die() we can see below.
> + cmd->explicit_expiry |= EXPIRE_UNREACH;
> + return 0;
> +}
> +
> +static int expire_total_callback(const struct option *opt,
> + const char *arg,
> + int unset)
> +{
> + struct cmd_reflog_expire_cb *cmd = opt->value;
> +
> + if (parse_expiry_date(arg, &cmd->expire_total))
> + die(_("malformed expiration date '%s'"), arg);
We used to say "'%s' is not a valid timestamp". The same for the
other die() we saw earlier.
"expiration date" is more specific to "timestamp" and in that sense,
the new message might be an improvement, but if we were to improve
messages better, perhaps we should go one step further and tell the
user which option got an invalid value, e.g.
die(_("invalid timestamp '%s' given to '--%s'"),
arg, opt->long_name);
perhaps.
> static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
> {
> struct cmd_reflog_expire_cb cmd = { 0 };
> timestamp_t now = time(NULL);
> int i, status, do_all, all_worktrees = 1;
> - int explicit_expiry = 0;
> unsigned int flags = 0;
> int verbose = 0;
> reflog_expiry_should_prune_fn *should_prune_fn = should_expire_reflog_ent;
> + const struct option options[] = {
> + OPT_BIT(0, "dry-run", &flags, N_("do not actually prune any entries"),
> + EXPIRE_REFLOGS_DRY_RUN),
> + OPT_BIT(0, "rewrite", &flags,
> + N_("rewrite the old SHA1 with the new SHA1 of the entry that now precedes it"),
> + EXPIRE_REFLOGS_REWRITE),
> + OPT_BIT(0, "updateref", &flags,
> + N_("update the reference to the value of the top reflog entry"),
> + EXPIRE_REFLOGS_UPDATE_REF),
> + OPT_BOOL(0, "verbose", &verbose, N_("print extra information on screen.")),
Somebody else might suggest OPT__VERBOSE() or OPT__VERBOSITY(), but
for the purpose of this "use parse-options" topic, a simple BOOL is
sufficient. When we start supporting different levels of verbosity,
we can switch to more featureful variant (and change the behaviour).
> +static const char * reflog_delete_usage[] = {
> + N_("git reflog delete [--rewrite] [--updateref] "
> + "[--dry-run | -n] [--verbose] <refs>..."),
Funny indentation still here?
> + NULL
> +};
> +
> static int cmd_reflog_delete(int argc, const char **argv, const char *prefix)
> {
> struct cmd_reflog_expire_cb cmd = { 0 };
> @@ -703,34 +725,28 @@ static int cmd_reflog_delete(int argc, const char **argv, const char *prefix)
> unsigned int flags = 0;
> int verbose = 0;
> reflog_expiry_should_prune_fn *should_prune_fn = should_expire_reflog_ent;
> + const struct option options[] = {
> + OPT_BIT(0, "dry-run", &flags, N_("do not actually prune any entries"),
> + EXPIRE_REFLOGS_DRY_RUN),
This is formatted quite differently from the one in reflog_expire().
Be consistent and make sure each line of what's inside
"OPT_BIT(...)" begins at the same column, e.g.
OPT_BIT(0, "dry-run", &flags, N_("do not actually prune any entries"),
EXPIRE_REFLOGS_DRY_RUN),
> + argc = parse_options(argc, argv, prefix, options, reflog_delete_usage, 0);
>
> if (verbose)
> should_prune_fn = should_expire_reflog_ent_verbose;
>
> - if (argc - i < 1)
> + if (argc < 1)
> return error(_("no reflog specified to delete"));
Nice.
> - for ( ; i < argc; i++) {
> + for (i = 0; i < argc; i++) {
> const char *spec = strstr(argv[i], "@{");
> char *ep, *ref;
> int recno;
Nice, too.
Thanks.
^ permalink raw reply
* Re: nfsd v4 server can crash in COPY_NOTIFY
From: Chuck Lever III @ 2022-01-05 20:33 UTC (permalink / raw)
To: Bruce Fields, Olga Kornievskaia; +Cc: rtm@csail.mit.edu, Linux NFS Mailing List
In-Reply-To: <20220105201313.GE25384@fieldses.org>
> On Jan 5, 2022, at 3:13 PM, J. Bruce Fields <bfields@fieldses.org> wrote:
>
> On Wed, Jan 05, 2022 at 09:59:16AM -0500, rtm@csail.mit.edu wrote:
>> If the special ONE stateid is passed to nfs4_preprocess_stateid_op(),
>> it returns status=0 but does not set *cstid. nfsd4_copy_notify()
>> depends on stid being set if status=0, and thus can crash if the
>> client sends the right COPY_NOTIFY RPC.
>>
>> I've attached a demo.
>>
>> # uname -a
>> Linux (none) 5.16.0-rc7-00108-g800829388818-dirty #28 SMP Wed Jan 5 14:40:37 UTC 2022 riscv64 riscv64 riscv64 GNU/Linux
>> # cc nfsd_5.c
>> # ./a.out
>> ...
>> [ 35.583265] Unable to handle kernel paging request at virtual address ffffffff00000008
>> [ 35.596916] status: 0000000200000121 badaddr: ffffffff00000008 cause: 000000000000000d
>> [ 35.597781] [<ffffffff80640cc6>] nfs4_alloc_init_cpntf_state+0x94/0xdc
>> [ 35.598576] [<ffffffff80274c98>] nfsd4_copy_notify+0xf8/0x28e
>> [ 35.599386] [<ffffffff80275c86>] nfsd4_proc_compound+0x2b6/0x4ee
>> [ 35.600166] [<ffffffff8025f7f4>] nfsd_dispatch+0x118/0x174
>> [ 35.600840] [<ffffffff8061a2e8>] svc_process_common+0x2f4/0x56c
>> [ 35.601630] [<ffffffff8061a624>] svc_process+0xc4/0x102
>> [ 35.602302] [<ffffffff8025f25a>] nfsd+0xfa/0x162
>> [ 35.602979] [<ffffffff80027010>] kthread+0x124/0x136
>> [ 35.603668] [<ffffffff8000303e>] ret_from_exception+0x0/0xc
>> [ 35.604667] ---[ end trace 69f12ad62072e251 ]---
>
> We could do something like this.--b.
>
> Author: J. Bruce Fields <bfields@redhat.com>
> Date: Wed Jan 5 14:15:03 2022 -0500
>
> nfsd: fix crash on COPY_NOTIFY with special stateid
>
> RTM says "If the special ONE stateid is passed to
> nfs4_preprocess_stateid_op(), it returns status=0 but does not set
> *cstid. nfsd4_copy_notify() depends on stid being set if status=0, and
> thus can crash if the client sends the right COPY_NOTIFY RPC."
>
> RFC 7862 says "The cna_src_stateid MUST refer to either open or locking
> states provided earlier by the server. If it is invalid, then the
> operation MUST fail."
>
> The RFC doesn't specify an error, and the choice doesn't matter much as
> this is clearly illegal client behavior, but bad_stateid seems
> reasonable.
>
> Simplest is just to guarantee that nfs4_preprocess_stateid_op, called
> with non-NULL cstid, errors out if it can't return a stateid.
>
> Reported-by: rtm@csail.mit.edu
> Fixes: 624322f1adc5 ("NFSD add COPY_NOTIFY operation")
> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
>
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 1956d377d1a6..b94b3bb2b8a6 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -6040,7 +6040,11 @@ nfs4_preprocess_stateid_op(struct svc_rqst *rqstp,
> *nfp = NULL;
>
> if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) {
> - status = check_special_stateids(net, fhp, stateid, flags);
> + if (cstid)
> + status = nfserr_bad_stateid;
> + else
> + status = check_special_stateids(net, fhp, stateid,
> + flags);
> goto done;
> }
Thanks, Bruce. I'll take this provisionally for v5.17. Olga, can you
provide a Reviewed-by: ?
--
Chuck Lever
^ permalink raw reply
* Re: [PATCH rdma-rc] RDMA/core: Don't infoleak GRH fields
From: Jason Gunthorpe @ 2022-01-05 20:33 UTC (permalink / raw)
To: Leon Romanovsky; +Cc: Leon Romanovsky, linux-rdma, syzbot+6d532fa8f9463da290bc
In-Reply-To: <0e9dd51f93410b7b2f4f5562f52befc878b71afa.1641298868.git.leonro@nvidia.com>
On Tue, Jan 04, 2022 at 02:21:52PM +0200, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@nvidia.com>
>
> If dst->is_global field is not set, the GRH fields are not cleared
> and the following infoleak is reported.
>
> =====================================================
> BUG: KMSAN: kernel-infoleak in instrument_copy_to_user include/linux/instrumented.h:121 [inline]
> BUG: KMSAN: kernel-infoleak in _copy_to_user+0x1c9/0x270 lib/usercopy.c:33
> instrument_copy_to_user include/linux/instrumented.h:121 [inline]
> _copy_to_user+0x1c9/0x270 lib/usercopy.c:33
> copy_to_user include/linux/uaccess.h:209 [inline]
> ucma_init_qp_attr+0x8c7/0xb10 drivers/infiniband/core/ucma.c:1242
> ucma_write+0x637/0x6c0 drivers/infiniband/core/ucma.c:1732
> vfs_write+0x8ce/0x2030 fs/read_write.c:588
> ksys_write+0x28b/0x510 fs/read_write.c:643
> __do_sys_write fs/read_write.c:655 [inline]
> __se_sys_write fs/read_write.c:652 [inline]
> __ia32_sys_write+0xdb/0x120 fs/read_write.c:652
> do_syscall_32_irqs_on arch/x86/entry/common.c:114 [inline]
> __do_fast_syscall_32+0x96/0xf0 arch/x86/entry/common.c:180
> do_fast_syscall_32+0x34/0x70 arch/x86/entry/common.c:205
> do_SYSENTER_32+0x1b/0x20 arch/x86/entry/common.c:248
> entry_SYSENTER_compat_after_hwframe+0x4d/0x5c
>
> Local variable resp created at:
> ucma_init_qp_attr+0xa4/0xb10 drivers/infiniband/core/ucma.c:1214
> ucma_write+0x637/0x6c0 drivers/infiniband/core/ucma.c:1732
>
> Bytes 40-59 of 144 are uninitialized
> Memory access of size 144 starts at ffff888167523b00
> Data copied to user address 0000000020000100
>
> CPU: 1 PID: 25910 Comm: syz-executor.1 Not tainted 5.16.0-rc5-syzkaller #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
> =====================================================
>
> Fixes: 4ba66093bdc6 ("IB/core: Check for global flag when using ah_attr")
> Reported-by: syzbot+6d532fa8f9463da290bc@syzkaller.appspotmail.com
> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> ---
> drivers/infiniband/core/uverbs_marshall.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to for-rc, thanks
Jason
^ permalink raw reply
* Re: [bug] GNOME loses all settings following failure to resume from suspend
From: Filipe Manana @ 2022-01-05 20:32 UTC (permalink / raw)
To: Chris Murphy; +Cc: Btrfs BTRFS, Josef Bacik, David Sterba
In-Reply-To: <CAJCQCtSd8B-qgW=eehcLDxb6oHoj69UiMtvixz=WwWCuy_Fggg@mail.gmail.com>
On Wed, Jan 5, 2022 at 6:40 PM Chris Murphy <lists@colorremedies.com> wrote:
>
> On Wed, Jan 5, 2022 at 11:04 AM Filipe Manana <fdmanana@kernel.org> wrote:
> >
> > Looking at the code before that patch, it explicitly skips fsync after
> > a rename pointing out to:
> >
> > https://btrfs.wiki.kernel.org/index.php/FAQ#What_are_the_crash_guarantees_of_overwrite-by-rename.3F
> >
> > I'm afraid that information is wrong, perhaps it might have been true in
> > some very distant past, but certainly not for many years.
>
> However, the system does suspend correctly and before that there
> should be "Filesystems sync" message from the kernel (this is the case
> on my laptops, unconfirmed for the GNOME bug case). [1]
>
> If the sequence is:
>
> write to file
> no fsync
> "filesystem sync" (I guess that's syncfs for all mounted filesystems? no idea)
> suspend
> crash
>
> Still seems like the file should be either old or new, not 0 length?
Nop, it can still be 0.
So where that message is printed, before it, ksys_sync() is called,
which will indeed call btrfs' sync_fs() callback (btrfs_sync_fs()).
However btrfs_sync_fs() will only wait for existing ordered extents to
complete, and then commit the current transaction.
Ordered extents are created when writeback is started.
In the rename path (btrfs_rename()) we trigger writeback with
filemap_flush() (mm/filemap.c), but that does not guarantee that
I/O is started for all dirty pages:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/mm/filemap.c?h=v5.16-rc8#n462
/**
* filemap_flush - mostly a non-blocking flush
* @mapping: target address_space
*
* This is a mostly non-blocking flush. Not suitable for data-integrity
* purposes - I/O may not be started against all dirty pages.
*
* Return: %0 on success, negative error code otherwise.
*/
int filemap_flush(struct address_space *mapping)
{
return __filemap_fdatawrite(mapping, WB_SYNC_NONE);
}
EXPORT_SYMBOL(filemap_flush);
I.e., we have no guarantee that writeback was started by the time the
rename returns to user space.
Regardless of that, it was not safe... a crash can happen after the
rename and before ksys_sync() is called.
>
>
> > I don't think I have a wiki account enabled, but I'll see if I get that
> > updated soon.
>
> Thanks Felipe!
Filipe
Thanks.
>
> [1] "Filesystems sync" message appears to come from here
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/kernel/power/main.c?h=v5.16-rc8#n62
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/kernel/power/main.c?h=v5.16-rc8#n195
>
>
>
>
> --
> Chris Murphy
^ permalink raw reply
* Re: [PATCH 02/24] pinctrl: samsung: accept GPIO bank nodes with a suffix
From: Krzysztof Kozlowski @ 2022-01-05 20:31 UTC (permalink / raw)
To: Sam Protsenko
Cc: Tomasz Figa, Sylwester Nawrocki, Linus Walleij, Rob Herring,
linux-arm-kernel, linux-samsung-soc, linux-gpio, devicetree,
linux-kernel, Marek Szyprowski, Sylwester Nawrocki, Chanho Park
In-Reply-To: <CAPLW+4kVjswvcx7PjkBq_cPrmoi1_yJw9qGOO2tcRCDm27zKmA@mail.gmail.com>
On 03/01/2022 19:43, Sam Protsenko wrote:
> On Fri, 31 Dec 2021 at 18:20, Krzysztof Kozlowski
> <krzysztof.kozlowski@canonical.com> wrote:
>>
>> Existing dt-bindings expected that each GPIO/pin bank within pin
>> controller has its own node with name matching the bank (e.g. gpa0,
>> gpx2) and "gpio-controller" property. The node name is then used for
>> matching between driver data and DTS.
>>
>> Newly introduced dtschema expects to have nodes ending with "-gpio-bank"
>> suffix, so rewrite bank-devicetree matching to look for old and new
>> style of naming.
>>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
>> ---
>> drivers/pinctrl/samsung/pinctrl-samsung.c | 57 ++++++++++++++++++-----
>> 1 file changed, 45 insertions(+), 12 deletions(-)
>>
>> diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c
>> index f2864a7869b3..561853df8ef7 100644
>> --- a/drivers/pinctrl/samsung/pinctrl-samsung.c
>> +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c
>> @@ -1011,13 +1011,56 @@ static void samsung_banks_of_node_put(struct samsung_pinctrl_drv_data *d)
>> of_node_put(bank->of_node);
>> }
>>
>> +/*
>> + * Iterate over all driver pin banks to find one matching the name of node,
>> + * skipping optional "-gpio" node suffix. When found, assign node to the bank.
>> + */
>> +static void samsung_banks_of_node_get(struct device *dev,
>> + struct samsung_pinctrl_drv_data *d,
>> + struct device_node *node)
>> +{
>> + const char *suffix = "-gpio-bank";
>> + struct samsung_pin_bank *bank;
>> + struct device_node *child;
>> + /* Pin bank names are up to 4 characters */
>> + char node_name[20];
>> + unsigned int i;
>> + size_t len;
>> +
>> + bank = d->pin_banks;
>> + for (i = 0; i < d->nr_banks; ++i, ++bank) {
>> + strscpy(node_name, bank->name, sizeof(node_name));
>> + len = strlcat(node_name, suffix, sizeof(node_name));
>> + if (len == sizeof(sizeof(node_name))) {
>
> Double sizeof is probably wrong?
Thanks, copy-paste error... it should be also "len >= sizeof".
Best regards,
Krzysztof
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [oe] [meta-networking][PATCH v2] ifupdown-ng: Add recipe
From: Alex Kiernan @ 2022-01-05 20:31 UTC (permalink / raw)
To: Khem Raj
Cc: Ross Burton, Otavio Salvador, OpenEmbedded Devel List,
Alex Kiernan
In-Reply-To: <CAMKF1srr4Uc53Th+goMOMcJwC-1coG2TqcBaoSakeet8iFsD2Q@mail.gmail.com>
Yeah, I realised that w/ some more testing locally... will pick that
up along with RCONFLICTing on ifupdown
On Wed, Jan 5, 2022 at 7:06 PM Khem Raj <raj.khem@gmail.com> wrote:
>
> btw. it fails to compile with musl
>
> https://errors.yoctoproject.org/Errors/Details/621451/
>
> On Wed, Jan 5, 2022 at 8:37 AM Khem Raj <raj.khem@gmail.com> wrote:
> >
> >
> >
> > On 1/5/22 8:36 AM, Ross Burton wrote:
> > > On Wed, 5 Jan 2022 at 12:51, Alex Kiernan <alex.kiernan@gmail.com> wrote:
> > >> Smaller if anything (though I've just realised I've not dealt the
> > >> ALTERNATIVES paths correctly):
> > >
> > > There's a case to be made for just conflicting with ifupdown and not
> > > bothering with alternatives.
> >
> > thats works for me.
> >
> > >
> > > Ross
> > >
> > >
> > >
> > > -=-=-=-=-=-=-=-=-=-=-=-
> > > Links: You receive all messages sent to this group.
> > > View/Reply Online (#94662): https://lists.openembedded.org/g/openembedded-devel/message/94662
> > > Mute This Topic: https://lists.openembedded.org/mt/88115930/1997914
> > > Group Owner: openembedded-devel+owner@lists.openembedded.org
> > > Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [raj.khem@gmail.com]
> > > -=-=-=-=-=-=-=-=-=-=-=-
> > >
--
Alex Kiernan
^ permalink raw reply
* Re: [PATCH 02/24] pinctrl: samsung: accept GPIO bank nodes with a suffix
From: Krzysztof Kozlowski @ 2022-01-05 20:31 UTC (permalink / raw)
To: Sam Protsenko
Cc: Tomasz Figa, Sylwester Nawrocki, Linus Walleij, Rob Herring,
linux-arm-kernel, linux-samsung-soc, linux-gpio, devicetree,
linux-kernel, Marek Szyprowski, Sylwester Nawrocki, Chanho Park
In-Reply-To: <CAPLW+4kVjswvcx7PjkBq_cPrmoi1_yJw9qGOO2tcRCDm27zKmA@mail.gmail.com>
On 03/01/2022 19:43, Sam Protsenko wrote:
> On Fri, 31 Dec 2021 at 18:20, Krzysztof Kozlowski
> <krzysztof.kozlowski@canonical.com> wrote:
>>
>> Existing dt-bindings expected that each GPIO/pin bank within pin
>> controller has its own node with name matching the bank (e.g. gpa0,
>> gpx2) and "gpio-controller" property. The node name is then used for
>> matching between driver data and DTS.
>>
>> Newly introduced dtschema expects to have nodes ending with "-gpio-bank"
>> suffix, so rewrite bank-devicetree matching to look for old and new
>> style of naming.
>>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
>> ---
>> drivers/pinctrl/samsung/pinctrl-samsung.c | 57 ++++++++++++++++++-----
>> 1 file changed, 45 insertions(+), 12 deletions(-)
>>
>> diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c
>> index f2864a7869b3..561853df8ef7 100644
>> --- a/drivers/pinctrl/samsung/pinctrl-samsung.c
>> +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c
>> @@ -1011,13 +1011,56 @@ static void samsung_banks_of_node_put(struct samsung_pinctrl_drv_data *d)
>> of_node_put(bank->of_node);
>> }
>>
>> +/*
>> + * Iterate over all driver pin banks to find one matching the name of node,
>> + * skipping optional "-gpio" node suffix. When found, assign node to the bank.
>> + */
>> +static void samsung_banks_of_node_get(struct device *dev,
>> + struct samsung_pinctrl_drv_data *d,
>> + struct device_node *node)
>> +{
>> + const char *suffix = "-gpio-bank";
>> + struct samsung_pin_bank *bank;
>> + struct device_node *child;
>> + /* Pin bank names are up to 4 characters */
>> + char node_name[20];
>> + unsigned int i;
>> + size_t len;
>> +
>> + bank = d->pin_banks;
>> + for (i = 0; i < d->nr_banks; ++i, ++bank) {
>> + strscpy(node_name, bank->name, sizeof(node_name));
>> + len = strlcat(node_name, suffix, sizeof(node_name));
>> + if (len == sizeof(sizeof(node_name))) {
>
> Double sizeof is probably wrong?
Thanks, copy-paste error... it should be also "len >= sizeof".
Best regards,
Krzysztof
^ permalink raw reply
* Re: [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915: clean up i915_drv.h
From: Jani Nikula @ 2022-01-05 20:28 UTC (permalink / raw)
To: Patchwork; +Cc: intel-gfx
In-Reply-To: <164141342082.25402.15604951649221430139@emeril.freedesktop.org>
On Wed, 05 Jan 2022, Patchwork <patchwork@emeril.freedesktop.org> wrote:
> == Series Details ==
>
> Series: drm/i915: clean up i915_drv.h
> URL : https://patchwork.freedesktop.org/series/98515/
> State : failure
>
> == Summary ==
>
> Applying: drm/i915: split out i915_getparam.h from i915_drv.h
> Applying: drm/i915: split out i915_cmd_parser.h from i915_drv.h
> Applying: drm/i915: split out i915_gem_evict.h from i915_drv.h
> Applying: drm/i915: split out gem/i915_gem_userptr.h from i915_drv.h
> Applying: drm/i915: split out gem/i915_gem_tiling.h from i915_drv.h
> Applying: drm/i915: split out i915_gem.h declarations from i915_drv.h
> Applying: drm/i915: split out i915_gem_internal.h from i915_drv.h
> error: sha1 information is lacking or useless (drivers/gpu/drm/i915/i915_drv.h).
> error: could not build fake ancestor
> hint: Use 'git am --show-current-patch=diff' to see the failed patch
> Patch failed at 0007 drm/i915: split out i915_gem_internal.h from i915_drv.h
> When you have resolved this problem, run "git am --continue".
> If you prefer to skip this patch, run "git am --skip" instead.
> To restore the original branch and stop patching, run "git am --abort".
Don't know what gives, the series rebases just fine without conflicts.
I guess let's review first, and I'll split smaller series for CI because
this is going to be painful.
BR,
Jani.
--
Jani Nikula, Intel Open Source Graphics Center
^ permalink raw reply
* Re: [PATCH -next] ieee802154: atusb: move to new USB API
From: Stefan Schmidt @ 2022-01-05 20:27 UTC (permalink / raw)
To: Pavel Skripkin, alex.aring, davem, kuba, linux-wpan, netdev,
linux-kernel
In-Reply-To: <20220105144947.12540-1-paskripkin@gmail.com>
Hello.
On 05.01.22 15:49, Pavel Skripkin wrote:
> Old USB API is prone to uninit value bugs if error handling is not
> correct. Let's move atusb to use new USB API to
>
> 1) Make code more simple, since new API does not require memory
> to be allocates via kmalloc()
>
> 2) Defend driver from usb-related uninit value bugs.
>
> 3) Make code more modern and simple
>
> This patch removes atusb usb wrappers as Greg suggested [0], this will make
> code more obvious and easier to understand over time, and replaces old
> API calls with new ones.
>
> Also this patch adds and updates usb related error handling to prevent
> possible uninit value bugs in future
>
> Link: https://lore.kernel.org/all/YdL0GPxy4TdGDzOO@kroah.com/ [0]
> Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
> ---
>
> Only build tested.
Gave it a first quick run on real hardware here. Besides one small bug
(see below) it looked good.
Will give it a bit more testing over the next days.
> @@ -881,14 +819,27 @@ static int atusb_get_and_conf_chip(struct atusb *atusb)
> u8 man_id_0, man_id_1, part_num, version_num;
> const char *chip;
> struct ieee802154_hw *hw = atusb->hw;
> + int ret;
>
> - man_id_0 = atusb_read_reg(atusb, RG_MAN_ID_0);
> - man_id_1 = atusb_read_reg(atusb, RG_MAN_ID_1);
> - part_num = atusb_read_reg(atusb, RG_PART_NUM);
> - version_num = atusb_read_reg(atusb, RG_VERSION_NUM);
> + ret = usb_control_msg_recv(usb_dev, 0, ATUSB_REG_READ, ATUSB_REQ_FROM_DEV,
> + 0, RG_MAN_ID_0, &man_id_0, 1, 1000, GFP_KERNEL);
> + if (ret < 0)
> + return ret;
>
> - if (atusb->err)
> - return atusb->err;
> + ret = usb_control_msg_recv(usb_dev, 0, ATUSB_REG_READ, ATUSB_REQ_FROM_DEV,
> + 0, RG_MAN_ID_1, &man_id_1, 1, 1000, GFP_KERNEL);
> + if (ret < 0)
> + return ret;
> +
> + ret = usb_control_msg_recv(usb_dev, 0, ATUSB_REG_READ, ATUSB_REQ_FROM_DEV,
> + 0, RG_PART_NUM, &atusb, 1, 1000, GFP_KERNEL);
This needs to be written to &part_num and not &atusb.
Pretty nice for a first blind try without hardware. Thanks.
Will let you know if I find anything else from testing.
regards
Stefan Schmidt
^ permalink raw reply
* Re: [PATCH v8 13/40] x86/kernel: Make the bss.decrypted section shared in RMP table
From: Dave Hansen @ 2022-01-05 20:27 UTC (permalink / raw)
To: Brijesh Singh, Venu Busireddy
Cc: x86, linux-kernel, kvm, linux-efi, platform-driver-x86,
linux-coco, linux-mm, Thomas Gleixner, Ingo Molnar, Joerg Roedel,
Tom Lendacky, H. Peter Anvin, Ard Biesheuvel, Paolo Bonzini,
Sean Christopherson, Vitaly Kuznetsov, Jim Mattson,
Andy Lutomirski, Dave Hansen, Sergio Lopez, Peter Gonda,
Peter Zijlstra, Srinivas Pandruvada, David Rientjes, Dov Murik,
Tobin Feldman-Fitzthum, Borislav Petkov, Michael Roth,
Vlastimil Babka, Kirill A . Shutemov, Andi Kleen,
Dr . David Alan Gilbert, tony.luck, marcorr,
sathyanarayanan.kuppuswamy
In-Reply-To: <18eadf9d-8e31-0945-ccf4-2cb72b8e0dd4@amd.com>
On 1/5/22 11:52, Brijesh Singh wrote:
>>> for (; vaddr < vaddr_end; vaddr += PMD_SIZE) {
>>> + /*
>>> + * When SEV-SNP is active then transition the page to shared in the RMP
>>> + * table so that it is consistent with the page table attribute change.
>>> + */
>>> + early_snp_set_memory_shared(__pa(vaddr), __pa(vaddr), PTRS_PER_PMD);
>>
>> Shouldn't the first argument be vaddr as below?
>
> Nope, sme_postprocess_startup() is called while we are fixing the
> initial page table and running with identity mapping (so va == pa).
I'm not sure I've ever seen a line of code that wanted a comment so badly.
^ permalink raw reply
* Re: [PATCH 01/24] pinctrl: samsung: drop pin banks references on error paths
From: Krzysztof Kozlowski @ 2022-01-05 20:24 UTC (permalink / raw)
To: Sam Protsenko
Cc: Tomasz Figa, Sylwester Nawrocki, Linus Walleij, Rob Herring,
linux-arm-kernel, linux-samsung-soc, linux-gpio, devicetree,
linux-kernel, Marek Szyprowski, Sylwester Nawrocki, Chanho Park,
stable
In-Reply-To: <CAPLW+4mosbk2_NPFFP=sUmKjBoZOG3vNcmT+7sMtTunhbVqcxA@mail.gmail.com>
On 03/01/2022 15:49, Sam Protsenko wrote:
> On Fri, 31 Dec 2021 at 18:20, Krzysztof Kozlowski
> <krzysztof.kozlowski@canonical.com> wrote:
>>
>> The driver iterates over its devicetree children with
>> for_each_child_of_node() and stores for later found node pointer. This
>> has to be put in error paths to avoid leak during re-probing.
>>
>> Fixes: ab663789d697 ("pinctrl: samsung: Match pin banks with their device nodes")
>> Cc: <stable@vger.kernel.org>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
>> ---
>> drivers/pinctrl/samsung/pinctrl-samsung.c | 29 +++++++++++++++++------
>> 1 file changed, 22 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c
>> index 8941f658e7f1..f2864a7869b3 100644
>> --- a/drivers/pinctrl/samsung/pinctrl-samsung.c
>> +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c
>> @@ -1002,6 +1002,15 @@ samsung_pinctrl_get_soc_data_for_of_alias(struct platform_device *pdev)
>> return &(of_data->ctrl[id]);
>> }
>>
>> +static void samsung_banks_of_node_put(struct samsung_pinctrl_drv_data *d)
>> +{
>> + struct samsung_pin_bank *bank;
>> + unsigned int i;
>> +
>> + for (i = 0; i < d->nr_banks; ++i, ++bank)
>> + of_node_put(bank->of_node);
>
> But "bank" variable wasn't actually assigned before, only declared?
Good point, bank has to be assigned just like in patch 2/24.
>
>> +}
>> +
Best regards,
Krzysztof
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH 01/24] pinctrl: samsung: drop pin banks references on error paths
From: Krzysztof Kozlowski @ 2022-01-05 20:24 UTC (permalink / raw)
To: Sam Protsenko
Cc: Tomasz Figa, Sylwester Nawrocki, Linus Walleij, Rob Herring,
linux-arm-kernel, linux-samsung-soc, linux-gpio, devicetree,
linux-kernel, Marek Szyprowski, Sylwester Nawrocki, Chanho Park,
stable
In-Reply-To: <CAPLW+4mosbk2_NPFFP=sUmKjBoZOG3vNcmT+7sMtTunhbVqcxA@mail.gmail.com>
On 03/01/2022 15:49, Sam Protsenko wrote:
> On Fri, 31 Dec 2021 at 18:20, Krzysztof Kozlowski
> <krzysztof.kozlowski@canonical.com> wrote:
>>
>> The driver iterates over its devicetree children with
>> for_each_child_of_node() and stores for later found node pointer. This
>> has to be put in error paths to avoid leak during re-probing.
>>
>> Fixes: ab663789d697 ("pinctrl: samsung: Match pin banks with their device nodes")
>> Cc: <stable@vger.kernel.org>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
>> ---
>> drivers/pinctrl/samsung/pinctrl-samsung.c | 29 +++++++++++++++++------
>> 1 file changed, 22 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c
>> index 8941f658e7f1..f2864a7869b3 100644
>> --- a/drivers/pinctrl/samsung/pinctrl-samsung.c
>> +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c
>> @@ -1002,6 +1002,15 @@ samsung_pinctrl_get_soc_data_for_of_alias(struct platform_device *pdev)
>> return &(of_data->ctrl[id]);
>> }
>>
>> +static void samsung_banks_of_node_put(struct samsung_pinctrl_drv_data *d)
>> +{
>> + struct samsung_pin_bank *bank;
>> + unsigned int i;
>> +
>> + for (i = 0; i < d->nr_banks; ++i, ++bank)
>> + of_node_put(bank->of_node);
>
> But "bank" variable wasn't actually assigned before, only declared?
Good point, bank has to be assigned just like in patch 2/24.
>
>> +}
>> +
Best regards,
Krzysztof
^ permalink raw reply
* [PATCH] locking/local_lock: Make the empty local_lock_*() function a macro.
From: Sebastian Andrzej Siewior @ 2022-01-05 20:26 UTC (permalink / raw)
To: linux-kernel
Cc: Peter Zijlstra, Ingo Molnar, Will Deacon, Waiman Long,
Thomas Gleixner, Sebastian Andrzej Siewior
It has been said that local_lock() does not add any overhead compared to
preempt_disable() in a !LOCKDEP configuration. A microbenchmark showed
an unexpected result which can be reduced to the fact that local_lock()
was not entirely optimized away.
In the !LOCKDEP configuration local_lock_acquire() is an empty static
inline function. On x86 the this_cpu_ptr() argument of that function is
fully evaluated leading to an additional mov+add instructions which are
not needed and not used.
Replace the static inline function with a macro. The typecheck() macro
ensures that the argument is of proper type while the resulting
disassembly shows no traces of this_cpu_ptr().
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
On -rc8, size says:
| text data bss dec filename
| 19656718 8681015 3764440 32102173 vmlinux.old
| 19656218 8681015 3764440 32101673 vmlinux.new
Which is -500 text, not much but still.
include/linux/local_lock_internal.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/linux/local_lock_internal.h b/include/linux/local_lock_internal.h
index 975e33b793a77..6d635e8306d64 100644
--- a/include/linux/local_lock_internal.h
+++ b/include/linux/local_lock_internal.h
@@ -44,9 +44,9 @@ static inline void local_lock_debug_init(local_lock_t *l)
}
#else /* CONFIG_DEBUG_LOCK_ALLOC */
# define LOCAL_LOCK_DEBUG_INIT(lockname)
-static inline void local_lock_acquire(local_lock_t *l) { }
-static inline void local_lock_release(local_lock_t *l) { }
-static inline void local_lock_debug_init(local_lock_t *l) { }
+# define local_lock_acquire(__ll) do { typecheck(local_lock_t *, __ll); } while (0)
+# define local_lock_release(__ll) do { typecheck(local_lock_t *, __ll); } while (0)
+# define local_lock_debug_init(__ll) do { typecheck(local_lock_t *, __ll); } while (0)
#endif /* !CONFIG_DEBUG_LOCK_ALLOC */
#define INIT_LOCAL_LOCK(lockname) { LOCAL_LOCK_DEBUG_INIT(lockname) }
--
2.34.1
^ permalink raw reply related
* [PATCH] fsi: occ: Fetch OCC response header again to avoid checksum failure
From: Eddie James @ 2022-01-05 20:23 UTC (permalink / raw)
To: linux-fsi; +Cc: linux-kernel, joel, jk, alistair, eajames
In the event that the driver state is reset, and the previous OCC
operation had a sequence number of 1, there is the possibility that
the SRAM buffer is updated in between fetching the OCC response header
and the rest of the data (since the sequence number match is really a
false positive). This results in a checksum failure. To avoid this
condition, simply fetch the whole response rather than skipping the
header when fetching the rest of the response.
Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
drivers/fsi/fsi-occ.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/fsi/fsi-occ.c b/drivers/fsi/fsi-occ.c
index 7eaab1be0aa4..660c3fc43be5 100644
--- a/drivers/fsi/fsi-occ.c
+++ b/drivers/fsi/fsi-occ.c
@@ -546,10 +546,15 @@ int fsi_occ_submit(struct device *dev, const void *request, size_t req_len,
dev_dbg(dev, "resp_status=%02x resp_data_len=%d\n",
resp->return_status, resp_data_length);
- /* Grab the rest */
+ /*
+ * Grab the rest, including the occ response header again, just in case
+ * it changed in between our two getsram operations (this can happen
+ * despite the sequence number check if the driver state is reset). The
+ * data length shouldn't change at OCC runtime, and the response
+ * status, which may have changed, has to be checked by users anyway.
+ */
if (resp_data_length > 1) {
- /* already got 3 bytes resp, also need 2 bytes checksum */
- rc = occ_getsram(occ, 8, &resp->data[3], resp_data_length - 1);
+ rc = occ_getsram(occ, 0, resp, resp_data_length + 7);
if (rc)
goto done;
}
--
2.27.0
^ permalink raw reply related
* Re: [RFC PATCH 3/3] mm/memcg: Allow the task_obj optimization only on non-PREEMPTIBLE kernels.
From: Sebastian Andrzej Siewior @ 2022-01-05 20:22 UTC (permalink / raw)
To: Waiman Long
Cc: cgroups, linux-mm, Johannes Weiner, Michal Hocko,
Vladimir Davydov, Andrew Morton, Thomas Gleixner, Peter Zijlstra
In-Reply-To: <df637005-6c72-a1c6-c6b9-70f81f74884d@redhat.com>
On 2022-01-03 10:04:29 [-0500], Waiman Long wrote:
> On 1/3/22 09:44, Sebastian Andrzej Siewior wrote:
> > Is there something you recommend as a benchmark where I could get some
> > numbers?
>
> In the case of PREEMPT_DYNAMIC, it depends on the default setting which is
> used by most users. I will support disabling the optimization if
> defined(CONFIG_PREEMPT_RT) || defined(CONFIG_PREEMPT), just not by
> CONFIG_)PREEMPTION alone.
>
> As for microbenchmark, something that makes a lot of calls to malloc() or
> related allocations can be used.
Numbers I made:
Sandy Bridge Haswell Skylake AMD-A8 7100 Zen2 ARM64
PREEMPT 5,123,896,822 5,215,055,226 5,077,611,590 6,012,287,874 6,234,674,489 20,000,000,100
IRQ 7,494,119,638 6,810,367,629 10,620,130,377 4,178,546,086 4,898,076,012 13,538,461,925
For micro benchmarking I did 1.000.000.000 iterations of
preempt_disable()/enable() [PREEMPT] and local_irq_save()/restore()
[IRQ].
On a Sandy Bridge the PREEMPT loop took 5,123,896,822ns while the IRQ
loop took 7,494,119,638ns. The absolute numbers are not important, it is
worth noting that preemption off/on is less expensive than IRQ off/on.
Except for AMD and ARM64 where IRQ off/on was less expensive. The whole
loop was performed with disabled interrupts so I don't expect much
interference - but then I don't know much the µArch optimized away on
local_irq_restore() given that the interrupts were already disabled.
I don't have any recent Intel HW (I think) so I don't know if this is an
Intel only thing (IRQ off/on cheaper than preemption off/on) but I guess
that the recent uArch would behave similar to AMD.
Moving on: For the test I run 100,000,000 iterations of
kfree(kmalloc(128, GFP_ATOMIC | __GFP_ACCOUNT));
The BH suffix means that in_task() reported false during the allocation,
otherwise it reported true.
SD is the standard deviation.
SERVER means PREEMPT_NONE while PREEMPT means CONFIG_PREEMPT.
OPT means the optimisation (in_task() + task_obj) is active, NO-OPT
means no optimisation (irq_obj is always used).
The numbers are the time in ns needed for 100,000,000 iteration (alloc +
free). I run 5 tests and used the median value here. If the standard
deviation exceeded 10^9 then I repeated the test. The values remained in
the same range since usually only one value was off and the other
remained in the same range.
Sandy Bridge
SERVER OPT SERVER NO-OPT PREEMPT OPT PREEMPT NO-OPT
ALLOC/FREE 8,519,295,176 9,051,200,652 10,627,431,395 11,198,189,843
SD 5,309,768 29,253,976 129,102,317 40,681,909
ALLOC/FREE BH 9,996,704,330 8,927,026,031 11,680,149,900 11,139,356,465
SD 38,237,534 72,913,120 23,626,932 116,413,331
The optimisation is visible in the SERVER-OPT case (~1.5s difference in
the runtime (or 14.7ns per iteration)). There is hardly any difference
between BH and !BH in the SERVER-NO-OPT case.
For the SERVER case, the optimisation improves ~0.5s in runtime for the
!BH case.
For the PREEMPT case it also looks like ~0.5s improvement in the BH case
while in the BH case it looks the other way around.
DYN-SRV-OPT DYN-SRV-NO-OPT DYN-FULL-OPT DYN-FULL-NO-OPT
ALLOC/FREE 11,069,180,584 10,773,407,543 10,963,581,285 10,826,207,969
SD 23,195,912 112,763,104 13,145,589 33,543,625
ALLOC/FREE BH 11,443,342,069 10,720,094,700 11,064,914,727 10,955,883,521
SD 81,150,074 171,299,554 58,603,778 84,131,143
DYN is CONFIG_PREEMPT_DYNAMIC enabled and CONFIG_PREEMPT_NONE is
default. I don't see any difference vs CONFIG_PREEMPT except the
default preemption state (so I didn't test that). The preemption counter
is always forced-in so preempt_enable()/disable() is not optimized away.
SRV is the default value (PREEMPT_NONE) and FULL is the overriden
(preempt=full) state.
Based on that, I don't see any added value by the optimisation once
PREEMPT_DYNAMIC is enabled.
----
Zen2:
SERVER OPT SERVER NO-OPT PREEMPT OPT PREEMPT NO-OPT
ALLOC/FREE 8,126,735,313 8,751,307,383 9,822,927,142 10,045,105,425
SD 100,806,471 87,234,047 55,170,179 25,832,386
ALLOC/FREE BH 9,197,455,885 8,394,337,053 10,671,227,095 9,904,954,934
SD 155,223,919 57,800,997 47,529,496 105,260,566
On Zen2, the IRQ off/on was less expensive than preempt-off/on. So it
looks like I mixed up the numbers in for PREEMPT OPT and NO-OPT but I
re-run it twice and nothing significant changed… However the difference
on PREEMPT for the !BH case is not as significant as on Sandy Bridge
(~200ms here vs ~500ms there).
DYN-SRV-OPT DYN-SRV-NO-OPT DYN-FULL-OPT DYN-FULL-NO-OPT
ALLOC/FREE 9,680,498,929 10,180,973,847 9,644,453,405 10,224,416,854
SD 73,944,156 61,850,527 13,277,203 107,145,212
ALLOC/FREE BH 10,680,074,634 9,956,695,323 10,704,442,515 9,942,155,910
SD 75,535,172 34,524,493 54,625,678 87,163,920
For double testing and checking, the full git tree is available at [0]
and the script to parse the results is at [1].
[0] git://git.kernel.org/pub/scm/linux/kernel/git/bigeasy/staging memcg
[1] https://breakpoint.cc/parse-memcg.py
> Cheers,
> Longman
Sebastian
^ permalink raw reply
* Re: [RFC PATCH 3/3] mm/memcg: Allow the task_obj optimization only on non-PREEMPTIBLE kernels.
From: Sebastian Andrzej Siewior @ 2022-01-05 20:22 UTC (permalink / raw)
To: Waiman Long
Cc: cgroups-u79uwXL29TY76Z2rM5mHXA, linux-mm-Bw31MaZKKs3YtjvyW6yDsg,
Johannes Weiner, Michal Hocko, Vladimir Davydov, Andrew Morton,
Thomas Gleixner, Peter Zijlstra
In-Reply-To: <df637005-6c72-a1c6-c6b9-70f81f74884d-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
On 2022-01-03 10:04:29 [-0500], Waiman Long wrote:
> On 1/3/22 09:44, Sebastian Andrzej Siewior wrote:
> > Is there something you recommend as a benchmark where I could get some
> > numbers?
>
> In the case of PREEMPT_DYNAMIC, it depends on the default setting which is
> used by most users. I will support disabling the optimization if
> defined(CONFIG_PREEMPT_RT) || defined(CONFIG_PREEMPT), just not by
> CONFIG_)PREEMPTION alone.
>
> As for microbenchmark, something that makes a lot of calls to malloc() or
> related allocations can be used.
Numbers I made:
Sandy Bridge Haswell Skylake AMD-A8 7100 Zen2 ARM64
PREEMPT 5,123,896,822 5,215,055,226 5,077,611,590 6,012,287,874 6,234,674,489 20,000,000,100
IRQ 7,494,119,638 6,810,367,629 10,620,130,377 4,178,546,086 4,898,076,012 13,538,461,925
For micro benchmarking I did 1.000.000.000 iterations of
preempt_disable()/enable() [PREEMPT] and local_irq_save()/restore()
[IRQ].
On a Sandy Bridge the PREEMPT loop took 5,123,896,822ns while the IRQ
loop took 7,494,119,638ns. The absolute numbers are not important, it is
worth noting that preemption off/on is less expensive than IRQ off/on.
Except for AMD and ARM64 where IRQ off/on was less expensive. The whole
loop was performed with disabled interrupts so I don't expect much
interference - but then I don't know much the µArch optimized away on
local_irq_restore() given that the interrupts were already disabled.
I don't have any recent Intel HW (I think) so I don't know if this is an
Intel only thing (IRQ off/on cheaper than preemption off/on) but I guess
that the recent uArch would behave similar to AMD.
Moving on: For the test I run 100,000,000 iterations of
kfree(kmalloc(128, GFP_ATOMIC | __GFP_ACCOUNT));
The BH suffix means that in_task() reported false during the allocation,
otherwise it reported true.
SD is the standard deviation.
SERVER means PREEMPT_NONE while PREEMPT means CONFIG_PREEMPT.
OPT means the optimisation (in_task() + task_obj) is active, NO-OPT
means no optimisation (irq_obj is always used).
The numbers are the time in ns needed for 100,000,000 iteration (alloc +
free). I run 5 tests and used the median value here. If the standard
deviation exceeded 10^9 then I repeated the test. The values remained in
the same range since usually only one value was off and the other
remained in the same range.
Sandy Bridge
SERVER OPT SERVER NO-OPT PREEMPT OPT PREEMPT NO-OPT
ALLOC/FREE 8,519,295,176 9,051,200,652 10,627,431,395 11,198,189,843
SD 5,309,768 29,253,976 129,102,317 40,681,909
ALLOC/FREE BH 9,996,704,330 8,927,026,031 11,680,149,900 11,139,356,465
SD 38,237,534 72,913,120 23,626,932 116,413,331
The optimisation is visible in the SERVER-OPT case (~1.5s difference in
the runtime (or 14.7ns per iteration)). There is hardly any difference
between BH and !BH in the SERVER-NO-OPT case.
For the SERVER case, the optimisation improves ~0.5s in runtime for the
!BH case.
For the PREEMPT case it also looks like ~0.5s improvement in the BH case
while in the BH case it looks the other way around.
DYN-SRV-OPT DYN-SRV-NO-OPT DYN-FULL-OPT DYN-FULL-NO-OPT
ALLOC/FREE 11,069,180,584 10,773,407,543 10,963,581,285 10,826,207,969
SD 23,195,912 112,763,104 13,145,589 33,543,625
ALLOC/FREE BH 11,443,342,069 10,720,094,700 11,064,914,727 10,955,883,521
SD 81,150,074 171,299,554 58,603,778 84,131,143
DYN is CONFIG_PREEMPT_DYNAMIC enabled and CONFIG_PREEMPT_NONE is
default. I don't see any difference vs CONFIG_PREEMPT except the
default preemption state (so I didn't test that). The preemption counter
is always forced-in so preempt_enable()/disable() is not optimized away.
SRV is the default value (PREEMPT_NONE) and FULL is the overriden
(preempt=full) state.
Based on that, I don't see any added value by the optimisation once
PREEMPT_DYNAMIC is enabled.
----
Zen2:
SERVER OPT SERVER NO-OPT PREEMPT OPT PREEMPT NO-OPT
ALLOC/FREE 8,126,735,313 8,751,307,383 9,822,927,142 10,045,105,425
SD 100,806,471 87,234,047 55,170,179 25,832,386
ALLOC/FREE BH 9,197,455,885 8,394,337,053 10,671,227,095 9,904,954,934
SD 155,223,919 57,800,997 47,529,496 105,260,566
On Zen2, the IRQ off/on was less expensive than preempt-off/on. So it
looks like I mixed up the numbers in for PREEMPT OPT and NO-OPT but I
re-run it twice and nothing significant changed… However the difference
on PREEMPT for the !BH case is not as significant as on Sandy Bridge
(~200ms here vs ~500ms there).
DYN-SRV-OPT DYN-SRV-NO-OPT DYN-FULL-OPT DYN-FULL-NO-OPT
ALLOC/FREE 9,680,498,929 10,180,973,847 9,644,453,405 10,224,416,854
SD 73,944,156 61,850,527 13,277,203 107,145,212
ALLOC/FREE BH 10,680,074,634 9,956,695,323 10,704,442,515 9,942,155,910
SD 75,535,172 34,524,493 54,625,678 87,163,920
For double testing and checking, the full git tree is available at [0]
and the script to parse the results is at [1].
[0] git://git.kernel.org/pub/scm/linux/kernel/git/bigeasy/staging memcg
[1] https://breakpoint.cc/parse-memcg.py
> Cheers,
> Longman
Sebastian
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.