All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 7/9] tcmu: do not set max_blocks if data_bitmap has been setup
From: Mike Christie @ 2018-07-23 19:07 UTC (permalink / raw)
  To: target-devel

This patch prevents a bug where data_bitmap is allocated in
tcmu_configure_device, userspace changes the max_blocks setting, the
device is mapped to a LUN, then we try to access the data_bitmap based
on the new max_blocks limit which may now be out of range.

To prevent this, we just check if data_bitmap has been setup. If it has
then we fail the max_blocks update operation.

Signed-off-by: Mike Christie <mchristi@redhat.com>
---
 drivers/target/target_core_user.c | 73 +++++++++++++++++++++------------------
 1 file changed, 40 insertions(+), 33 deletions(-)

diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index 31cfe83..969ccba 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1811,9 +1811,11 @@ static int tcmu_configure_device(struct se_device *dev)
 
 	info = &udev->uio_info;
 
+	mutex_lock(&udev->cmdr_lock);
 	udev->data_bitmap = kcalloc(BITS_TO_LONGS(udev->max_blocks),
 				    sizeof(unsigned long),
 				    GFP_KERNEL);
+	mutex_unlock(&udev->cmdr_lock);
 	if (!udev->data_bitmap) {
 		ret = -ENOMEM;
 		goto err_bitmap_alloc;
@@ -2018,7 +2020,7 @@ enum {
 	{Opt_hw_block_size, "hw_block_size=%u"},
 	{Opt_hw_max_sectors, "hw_max_sectors=%u"},
 	{Opt_nl_reply_supported, "nl_reply_supported=%d"},
-	{Opt_max_data_area_mb, "max_data_area_mb=%u"},
+	{Opt_max_data_area_mb, "max_data_area_mb=%d"},
 	{Opt_err, NULL}
 };
 
@@ -2046,13 +2048,48 @@ static int tcmu_set_dev_attrib(substring_t *arg, u32 *dev_attrib)
 	return 0;
 }
 
+static int tcmu_set_max_blocks_param(struct tcmu_dev *udev, substring_t *arg)
+{
+	int val, ret;
+
+	ret = match_int(arg, &val);
+	if (ret < 0) {
+		pr_err("match_int() failed for max_data_area_mb=. Error %d.\n",
+		       ret);
+		return ret;
+	}
+
+	if (val <= 0) {
+		pr_err("Invalid max_data_area %d.\n", val);
+		return -EINVAL;
+	}
+
+	mutex_lock(&udev->cmdr_lock);
+	if (udev->data_bitmap) {
+		pr_err("Cannot set max_data_area_mb after it has been enabled.\n");
+		ret = -EINVAL;
+		goto unlock;
+	}
+
+	udev->max_blocks = TCMU_MBS_TO_BLOCKS(val);
+	if (udev->max_blocks > tcmu_global_max_blocks) {
+		pr_err("%d is too large. Adjusting max_data_area_mb to global limit of %u\n",
+		       val, TCMU_BLOCKS_TO_MBS(tcmu_global_max_blocks));
+		udev->max_blocks = tcmu_global_max_blocks;
+	}
+
+unlock:
+	mutex_unlock(&udev->cmdr_lock);
+	return ret;
+}
+
 static ssize_t tcmu_set_configfs_dev_params(struct se_device *dev,
 		const char *page, ssize_t count)
 {
 	struct tcmu_dev *udev = TCMU_DEV(dev);
 	char *orig, *ptr, *opts, *arg_p;
 	substring_t args[MAX_OPT_ARGS];
-	int ret = 0, token, tmpval;
+	int ret = 0, token;
 
 	opts = kstrdup(page, GFP_KERNEL);
 	if (!opts)
@@ -2105,37 +2142,7 @@ static ssize_t tcmu_set_configfs_dev_params(struct se_device *dev,
 				pr_err("kstrtoint() failed for nl_reply_supported=\n");
 			break;
 		case Opt_max_data_area_mb:
-			if (dev->export_count) {
-				pr_err("Unable to set max_data_area_mb while exports exist\n");
-				ret = -EINVAL;
-				break;
-			}
-
-			arg_p = match_strdup(&args[0]);
-			if (!arg_p) {
-				ret = -ENOMEM;
-				break;
-			}
-			ret = kstrtoint(arg_p, 0, &tmpval);
-			kfree(arg_p);
-			if (ret < 0) {
-				pr_err("kstrtoint() failed for max_data_area_mb=\n");
-				break;
-			}
-
-			if (tmpval <= 0) {
-				pr_err("Invalid max_data_area %d\n", tmpval);
-				ret = -EINVAL;
-				break;
-			}
-
-			udev->max_blocks = TCMU_MBS_TO_BLOCKS(tmpval);
-			if (udev->max_blocks > tcmu_global_max_blocks) {
-				pr_err("%d is too large. Adjusting max_data_area_mb to global limit of %u\n",
-				       tmpval,
-				       TCMU_BLOCKS_TO_MBS(tcmu_global_max_blocks));
-				udev->max_blocks = tcmu_global_max_blocks;
-			}
+			ret = tcmu_set_max_blocks_param(udev, &args[0]);
 			break;
 		default:
 			break;
-- 
1.8.3.1


^ permalink raw reply related

* [PATCH 6/9] tcmu: unmap if dev is configured
From: Mike Christie @ 2018-07-23 19:07 UTC (permalink / raw)
  To: target-devel

The tcmu dev is added to the list of tcmu devices during configuration.
At this time the tcmu setup has completed, but lio core has not
completed its setup. The device is not yet usable so do not try to unmap
blocks from it

Signed-off-by: Mike Christie <mchristi@redhat.com>
---
 drivers/target/target_core_user.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index d6b4022..31cfe83 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -2581,6 +2581,11 @@ static void find_free_blocks(void)
 	list_for_each_entry(udev, &root_udev, node) {
 		mutex_lock(&udev->cmdr_lock);
 
+		if (!target_dev_configured(&udev->se_dev)) {
+			mutex_unlock(&udev->cmdr_lock);
+			continue;
+		}
+
 		/* Try to complete the finished commands first */
 		tcmu_handle_completions(udev);
 
-- 
1.8.3.1


^ permalink raw reply related

* [PATCH 5/9] tcmu: check if dev is configured before block/reset
From: Mike Christie @ 2018-07-23 19:07 UTC (permalink / raw)
  To: target-devel

Do not allow userspace to block or reset the ring until the device has
been configured. This will prevent the bug where userspace can write to
those files and access mb_addr before it has been setup.

Signed-off-by: Mike Christie <mchristi@redhat.com>
---
 drivers/target/target_core_user.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index bc8121f..d6b4022 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -2480,6 +2480,11 @@ static ssize_t tcmu_block_dev_store(struct config_item *item, const char *page,
 	u8 val;
 	int ret;
 
+	if (!target_dev_configured(&udev->se_dev)) {
+		pr_err("Device is not configured.\n");
+		return -EINVAL;
+	}
+
 	ret = kstrtou8(page, 0, &val);
 	if (ret < 0)
 		return ret;
@@ -2507,6 +2512,11 @@ static ssize_t tcmu_reset_ring_store(struct config_item *item, const char *page,
 	u8 val;
 	int ret;
 
+	if (!target_dev_configured(&udev->se_dev)) {
+		pr_err("Device is not configured.\n");
+		return -EINVAL;
+	}
+
 	ret = kstrtou8(page, 0, &val);
 	if (ret < 0)
 		return ret;
-- 
1.8.3.1


^ permalink raw reply related

* [PATCH 4/9] tcmu: use lio core se_device configuration helper
From: Mike Christie @ 2018-07-23 19:07 UTC (permalink / raw)
  To: target-devel

Use the lio core helper to check if the device is configured.

Signed-off-by: Mike Christie <mchristi@redhat.com>
---
 drivers/target/target_core_user.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index b010ed7..bc8121f 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1908,11 +1908,6 @@ static int tcmu_configure_device(struct se_device *dev)
 	return ret;
 }
 
-static bool tcmu_dev_configured(struct tcmu_dev *udev)
-{
-	return udev->uio_info.uio_dev ? true : false;
-}
-
 static void tcmu_free_device(struct se_device *dev)
 {
 	struct tcmu_dev *udev = TCMU_DEV(dev);
@@ -2305,7 +2300,7 @@ static ssize_t tcmu_dev_config_store(struct config_item *item, const char *page,
 		return -EINVAL;
 
 	/* Check if device has been configured before */
-	if (tcmu_dev_configured(udev)) {
+	if (target_dev_configured(&udev->se_dev)) {
 		ret = tcmu_send_dev_config_event(udev, page);
 		if (ret) {
 			pr_err("Unable to reconfigure device\n");
@@ -2367,7 +2362,7 @@ static ssize_t tcmu_dev_size_store(struct config_item *item, const char *page,
 		return ret;
 
 	/* Check if device has been configured before */
-	if (tcmu_dev_configured(udev)) {
+	if (target_dev_configured(&udev->se_dev)) {
 		ret = tcmu_send_dev_size_event(udev, val);
 		if (ret) {
 			pr_err("Unable to reconfigure device\n");
@@ -2449,7 +2444,7 @@ static ssize_t tcmu_emulate_write_cache_store(struct config_item *item,
 		return ret;
 
 	/* Check if device has been configured before */
-	if (tcmu_dev_configured(udev)) {
+	if (target_dev_configured(&udev->se_dev)) {
 		ret = tcmu_send_emulate_write_cache(udev, val);
 		if (ret) {
 			pr_err("Unable to reconfigure device\n");
-- 
1.8.3.1


^ permalink raw reply related

* [PATCH 3/9] target: add helper to check if dev is configured
From: Mike Christie @ 2018-07-23 19:07 UTC (permalink / raw)
  To: target-devel

This just adds a helper function to check if a device is configured and
it converts the target users to use it. The next patch will add a
backend module user so those types of modules do not have to know the
lio core details.

Signed-off-by: Mike Christie <mchristi@redhat.com>
---
 drivers/target/target_core_configfs.c        | 8 ++++----
 drivers/target/target_core_device.c          | 6 +++---
 drivers/target/target_core_fabric_configfs.c | 3 ++-
 include/target/target_core_backend.h         | 4 ++++
 4 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index 93d3ff3..f6b1549 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -810,7 +810,7 @@ static ssize_t pi_prot_type_store(struct config_item *item,
 		       dev->transport->name);
 		return -ENOSYS;
 	}
-	if (!(dev->dev_flags & DF_CONFIGURED)) {
+	if (!target_dev_configured(dev)) {
 		pr_err("DIF protection requires device to be configured\n");
 		return -ENODEV;
 	}
@@ -859,7 +859,7 @@ static ssize_t pi_prot_format_store(struct config_item *item,
 		       dev->transport->name);
 		return -ENOSYS;
 	}
-	if (!(dev->dev_flags & DF_CONFIGURED)) {
+	if (!target_dev_configured(dev)) {
 		pr_err("DIF protection format requires device to be configured\n");
 		return -ENODEV;
 	}
@@ -1948,7 +1948,7 @@ static ssize_t target_dev_enable_show(struct config_item *item, char *page)
 {
 	struct se_device *dev = to_device(item);
 
-	return snprintf(page, PAGE_SIZE, "%d\n", !!(dev->dev_flags & DF_CONFIGURED));
+	return snprintf(page, PAGE_SIZE, "%d\n", target_dev_configured(dev));
 }
 
 static ssize_t target_dev_enable_store(struct config_item *item,
@@ -2473,7 +2473,7 @@ static ssize_t target_tg_pt_gp_alua_access_state_store(struct config_item *item,
 			" tg_pt_gp ID: %hu\n", tg_pt_gp->tg_pt_gp_valid_id);
 		return -EINVAL;
 	}
-	if (!(dev->dev_flags & DF_CONFIGURED)) {
+	if (!target_dev_configured(dev)) {
 		pr_err("Unable to set alua_access_state while device is"
 		       " not configured\n");
 		return -ENODEV;
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
index 73675ee..47b5ef1 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -900,7 +900,7 @@ static int target_devices_idr_iter(int id, void *p, void *data)
 	 * to allow other callers to access partially setup devices,
 	 * so we skip them here.
 	 */
-	if (!(dev->dev_flags & DF_CONFIGURED))
+	if (!target_dev_configured(dev))
 		return 0;
 
 	iter->prev_item = config_item_get_unless_zero(&dev->dev_group.cg_item);
@@ -940,7 +940,7 @@ int target_configure_device(struct se_device *dev)
 	struct se_hba *hba = dev->se_hba;
 	int ret, id;
 
-	if (dev->dev_flags & DF_CONFIGURED) {
+	if (target_dev_configured(dev)) {
 		pr_err("se_dev->se_dev_ptr already set for storage"
 				" object\n");
 		return -EEXIST;
@@ -1045,7 +1045,7 @@ void target_free_device(struct se_device *dev)
 
 	WARN_ON(!list_empty(&dev->dev_sep_list));
 
-	if (dev->dev_flags & DF_CONFIGURED) {
+	if (target_dev_configured(dev)) {
 		destroy_workqueue(dev->tmr_wq);
 
 		dev->transport->destroy_device(dev);
diff --git a/drivers/target/target_core_fabric_configfs.c b/drivers/target/target_core_fabric_configfs.c
index 1fa436e..aa2f4f6 100644
--- a/drivers/target/target_core_fabric_configfs.c
+++ b/drivers/target/target_core_fabric_configfs.c
@@ -34,6 +34,7 @@
 #include <linux/configfs.h>
 
 #include <target/target_core_base.h>
+#include <target/target_core_backend.h>
 #include <target/target_core_fabric.h>
 
 #include "target_core_internal.h"
@@ -642,7 +643,7 @@ static int target_fabric_port_link(
 	}
 	dev = container_of(to_config_group(se_dev_ci), struct se_device, dev_group);
 
-	if (!(dev->dev_flags & DF_CONFIGURED)) {
+	if (!target_dev_configured(dev)) {
 		pr_err("se_device not configured yet, cannot port link\n");
 		return -ENODEV;
 	}
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h
index c3ac472..51b6f50 100644
--- a/include/target/target_core_backend.h
+++ b/include/target/target_core_backend.h
@@ -111,6 +111,10 @@ sense_reason_t passthrough_parse_cdb(struct se_cmd *cmd,
 bool target_configure_unmap_from_queue(struct se_dev_attrib *attrib,
 				       struct request_queue *q);
 
+static inline bool target_dev_configured(struct se_device *se_dev)
+{
+	return !!(se_dev->dev_flags & DF_CONFIGURED);
+}
 
 /* Only use get_unaligned_be24() if reading p - 1 is allowed. */
 static inline uint32_t get_unaligned_be24(const uint8_t *const p)
-- 
1.8.3.1


^ permalink raw reply related

* [PATCH 2/9] tcmu: initialize list head
From: Mike Christie @ 2018-07-23 19:07 UTC (permalink / raw)
  To: target-devel

Use INIT_LIST_HEAD to initialize node list head.

Signed-off-by: Mike Christie <mchristi@redhat.com>
---
 drivers/target/target_core_user.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index fafe65f..b010ed7 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1342,6 +1342,7 @@ static struct se_device *tcmu_alloc_device(struct se_hba *hba, const char *name)
 	udev->max_blocks = DATA_BLOCK_BITS_DEF;
 	mutex_init(&udev->cmdr_lock);
 
+	INIT_LIST_HEAD(&udev->node);
 	INIT_LIST_HEAD(&udev->timedout_entry);
 	INIT_LIST_HEAD(&udev->cmdr_queue);
 	idr_init(&udev->commands);
-- 
1.8.3.1


^ permalink raw reply related

* [PATCH 1/9] target_core_user: fix double unlock
From: Mike Christie @ 2018-07-23 19:07 UTC (permalink / raw)
  To: target-devel

The caller of queue_cmd_ring grabs and releases the lock, so
the tcmu_setup_cmd_timer failure handling inside queue_cmd_ring
should not call mutex_unlock.

Signed-off-by: Mike Christie <mchristi@redhat.com>
---
 drivers/target/target_core_user.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index 847707a..fafe65f 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1066,7 +1066,6 @@ static sense_reason_t queue_cmd_ring(struct tcmu_cmd *tcmu_cmd, int *scsi_err)
 				   &udev->cmd_timer);
 	if (ret) {
 		tcmu_cmd_free_data(tcmu_cmd, tcmu_cmd->dbi_cnt);
-		mutex_unlock(&udev->cmdr_lock);
 
 		*scsi_err = TCM_OUT_OF_RESOURCES;
 		return -1;
-- 
1.8.3.1


^ permalink raw reply related

* [PATCH 0/9] tcmu: configuration fixes and cleanups
From: Mike Christie @ 2018-07-23 19:07 UTC (permalink / raw)
  To: target-devel

The following patches were made over Martin's for-next branch.

The first patch fixes a locking bug in the command setup path. The rest
of the patches fix several bugs and cleanup the setup and configuration
code paths.



^ permalink raw reply

* Re: [PATCH v2 bpf 2/3] bpf: Replace [u]int32_t and [u]int64_t in libbpf
From: Yonghong Song @ 2018-07-23 18:04 UTC (permalink / raw)
  To: Martin KaFai Lau, netdev; +Cc: Alexei Starovoitov, Daniel Borkmann, kernel-team
In-Reply-To: <20180721182043.1401089-3-kafai@fb.com>



On 7/21/18 11:20 AM, Martin KaFai Lau wrote:
> This patch replaces [u]int32_t and [u]int64_t usage with
> __[su]32 and __[su]64.  The same change goes for [u]int16_t
> and [u]int8_t.
> 
> Fixes: 8a138aed4a80 ("bpf: btf: Add BTF support to libbpf")
> Signed-off-by: Martin KaFai Lau <kafai@fb.com>
> ---
>   tools/lib/bpf/btf.c    | 28 +++++++++++++---------------
>   tools/lib/bpf/btf.h    |  8 ++++----
>   tools/lib/bpf/libbpf.c | 12 ++++++------
>   tools/lib/bpf/libbpf.h |  4 ++--
>   4 files changed, 25 insertions(+), 27 deletions(-)
> 
> diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
> index 8c54a4b6f187..ce77b5b57912 100644
> --- a/tools/lib/bpf/btf.c
> +++ b/tools/lib/bpf/btf.c
> @@ -2,7 +2,6 @@
>   /* Copyright (c) 2018 Facebook */
>   
>   #include <stdlib.h>
> -#include <stdint.h>
>   #include <string.h>
>   #include <unistd.h>
>   #include <errno.h>
> @@ -27,13 +26,13 @@ struct btf {
>   	struct btf_type **types;
>   	const char *strings;
>   	void *nohdr_data;
> -	uint32_t nr_types;
> -	uint32_t types_size;
> -	uint32_t data_size;
> +	__u32 nr_types;
> +	__u32 types_size;
> +	__u32 data_size;
>   	int fd;
>   };
>   
> -static const char *btf_name_by_offset(const struct btf *btf, uint32_t offset)
> +static const char *btf_name_by_offset(const struct btf *btf, __u32 offset)
>   {
>   	if (offset < btf->hdr->str_len)
>   		return &btf->strings[offset];
> @@ -151,7 +150,7 @@ static int btf_parse_type_sec(struct btf *btf, btf_print_fn_t err_log)
>   
>   	while (next_type < end_type) {
>   		struct btf_type *t = next_type;
> -		uint16_t vlen = BTF_INFO_VLEN(t->info);
> +		__u16 vlen = BTF_INFO_VLEN(t->info);
>   		int err;
>   
>   		next_type += sizeof(*t);
> @@ -191,7 +190,7 @@ static int btf_parse_type_sec(struct btf *btf, btf_print_fn_t err_log)
>   }
>   
>   static const struct btf_type *btf_type_by_id(const struct btf *btf,
> -					     uint32_t type_id)
> +					     __u32 type_id)
>   {
>   	if (type_id > btf->nr_types)
>   		return NULL;
> @@ -226,12 +225,12 @@ static int64_t btf_type_size(const struct btf_type *t)

Missing this one:
    static int64_t btf_type_size(const struct btf_type *t)

There are a couple of instances of using u32 instead of __u32, better to 
use __u32 everywhere in the same file:
                 u32 expand_by, new_size;
         u32 meta_left;


>   
>   #define MAX_RESOLVE_DEPTH 32
>   
> -int64_t btf__resolve_size(const struct btf *btf, uint32_t type_id)
> +__s64 btf__resolve_size(const struct btf *btf, __u32 type_id)
>   {
>   	const struct btf_array *array;
>   	const struct btf_type *t;
> -	uint32_t nelems = 1;
> -	int64_t size = -1;
> +	__u32 nelems = 1;
> +	__s64 size = -1;
>   	int i;
>   
>   	t = btf_type_by_id(btf, type_id);
> @@ -271,9 +270,9 @@ int64_t btf__resolve_size(const struct btf *btf, uint32_t type_id)
>   	return nelems * size;
>   }
>   
> -int32_t btf__find_by_name(const struct btf *btf, const char *type_name)
> +__s32 btf__find_by_name(const struct btf *btf, const char *type_name)
>   {
> -	uint32_t i;
> +	__u32 i;
>   
>   	if (!strcmp(type_name, "void"))
>   		return 0;
> @@ -302,10 +301,9 @@ void btf__free(struct btf *btf)
>   	free(btf);
>   }
>   
> -struct btf *btf__new(uint8_t *data, uint32_t size,
> -		     btf_print_fn_t err_log)
> +struct btf *btf__new(__u8 *data, __u32 size, btf_print_fn_t err_log)
>   {
> -	uint32_t log_buf_size = 0;
> +	__u32 log_buf_size = 0;
>   	char *log_buf = NULL;
>   	struct btf *btf;
>   	int err;
> diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h
> index 74bb344035bb..ed3a84370ccc 100644
> --- a/tools/lib/bpf/btf.h
> +++ b/tools/lib/bpf/btf.h
> @@ -4,7 +4,7 @@
>   #ifndef __BPF_BTF_H
>   #define __BPF_BTF_H
>   
> -#include <stdint.h>
> +#include <linux/types.h>
>   
>   #define BTF_ELF_SEC ".BTF"
>   
> @@ -14,9 +14,9 @@ typedef int (*btf_print_fn_t)(const char *, ...)
>   	__attribute__((format(printf, 1, 2)));
>   
>   void btf__free(struct btf *btf);
> -struct btf *btf__new(uint8_t *data, uint32_t size, btf_print_fn_t err_log);
> -int32_t btf__find_by_name(const struct btf *btf, const char *type_name);
> -int64_t btf__resolve_size(const struct btf *btf, uint32_t type_id);
> +struct btf *btf__new(__u8 *data, __u32 size, btf_print_fn_t err_log);
> +__s32 btf__find_by_name(const struct btf *btf, const char *type_name);
> +__s64 btf__resolve_size(const struct btf *btf, __u32 type_id);
>   int btf__fd(const struct btf *btf);
>   
>   #endif
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index a1e96b5de5ff..6deb4fe4fffe 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -216,8 +216,8 @@ struct bpf_map {
>   	size_t offset;
>   	int map_ifindex;
>   	struct bpf_map_def def;
> -	uint32_t btf_key_type_id;
> -	uint32_t btf_value_type_id;
> +	__u32 btf_key_type_id;
> +	__u32 btf_value_type_id;
>   	void *priv;
>   	bpf_map_clear_priv_t clear_priv;
>   };
> @@ -1016,8 +1016,8 @@ static int bpf_map_find_btf_info(struct bpf_map *map, const struct btf *btf)
>   {
>   	struct bpf_map_def *def = &map->def;
>   	const size_t max_name = 256;
> -	int64_t key_size, value_size;
> -	int32_t key_id, value_id;
> +	__s64 key_size, value_size;
> +	__s32 key_id, value_id;
>   	char name[max_name];
>   
>   	/* Find key type by name from BTF */
> @@ -2089,12 +2089,12 @@ const char *bpf_map__name(struct bpf_map *map)
>   	return map ? map->name : NULL;
>   }
>   
> -uint32_t bpf_map__btf_key_type_id(const struct bpf_map *map)
> +__u32 bpf_map__btf_key_type_id(const struct bpf_map *map)
>   {
>   	return map ? map->btf_key_type_id : 0;
>   }
>   
> -uint32_t bpf_map__btf_value_type_id(const struct bpf_map *map)
> +__u32 bpf_map__btf_value_type_id(const struct bpf_map *map)
>   {
>   	return map ? map->btf_value_type_id : 0;
>   }
> diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
> index 09976531aa74..b33ae02f7d0e 100644
> --- a/tools/lib/bpf/libbpf.h
> +++ b/tools/lib/bpf/libbpf.h
> @@ -244,8 +244,8 @@ bpf_map__next(struct bpf_map *map, struct bpf_object *obj);
>   int bpf_map__fd(struct bpf_map *map);
>   const struct bpf_map_def *bpf_map__def(struct bpf_map *map);
>   const char *bpf_map__name(struct bpf_map *map);
> -uint32_t bpf_map__btf_key_type_id(const struct bpf_map *map);
> -uint32_t bpf_map__btf_value_type_id(const struct bpf_map *map);
> +__u32 bpf_map__btf_key_type_id(const struct bpf_map *map);
> +__u32 bpf_map__btf_value_type_id(const struct bpf_map *map);
>   
>   typedef void (*bpf_map_clear_priv_t)(struct bpf_map *, void *);
>   int bpf_map__set_priv(struct bpf_map *map, void *priv,
> 

^ permalink raw reply

* Re: [EXTERNAL] [meta-processor-sdk][PATCH] tidl-utils: Add tidl-utils to devkit
From: Jacob Stiffler @ 2018-07-23 19:07 UTC (permalink / raw)
  To: Djordje Senicic, meta-arago; +Cc: d-senicic1
In-Reply-To: <1532371124-500-1-git-send-email-x0157990@ti.com>

nativesdk-tidl-utils does not build.


ERROR: Nothing RPROVIDES 'nativesdk-tidl-api' (but 
virtual:nativesdk:/media/hdd1/jake/oe/tisdk-rocko/sources/meta-arago/meta-arago-extras/recipes-ti/tidl-utils/tidl-utils.bb 
RDEPENDS on or otherwise requires it)
NOTE: Runtime target 'nativesdk-tidl-api' is unbuildable, removing...
Missing or unbuildable dependency chain was: ['nativesdk-tidl-api']
ERROR: Required build target 'nativesdk-tidl-utils' has no buildable 
providers.
Missing or unbuildable dependency chain was: ['nativesdk-tidl-utils', 
'nativesdk-tidl-api']
ERROR: Nothing RPROVIDES 'nativesdk-tidl-api' (but 
virtual:nativesdk:/media/hdd1/jake/oe/tisdk-rocko/sources/meta-arago/meta-arago-extras/recipes-ti/tidl-utils/tidl-utils.bb 
RDEPENDS on or otherwise requires it)
NOTE: Runtime target 'nativesdk-tidl-api' is unbuildable, removing...
Missing or unbuildable dependency chain was: ['nativesdk-tidl-api']
ERROR: Required build target 'nativesdk-tidl-utils' has no buildable 
providers.
Missing or unbuildable dependency chain was: ['nativesdk-tidl-utils', 
'nativesdk-tidl-api']


On 7/23/2018 2:38 PM, Djordje Senicic wrote:
> * Include tidl-utils package along with tidl-viewer into devkit
>
> Signed-off-by: Djordje Senicic <x0157990@ti.com>
> ---
>   .../packagegroups/nativesdk-packagegroup-arago-sdk-host.bbappend      | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/recipes-core/packagegroups/nativesdk-packagegroup-arago-sdk-host.bbappend b/recipes-core/packagegroups/nativesdk-packagegroup-arago-sdk-host.bbappend
> index 514d125..b0fafee 100644
> --- a/recipes-core/packagegroups/nativesdk-packagegroup-arago-sdk-host.bbappend
> +++ b/recipes-core/packagegroups/nativesdk-packagegroup-arago-sdk-host.bbappend
> @@ -1,3 +1,3 @@
> -PR_append = ".tisdk0"
> +PR_append = ".tisdk1"
>   
> -EXTRA_TI_TOOLS_append = " nativesdk-tidl-viewer"
> +EXTRA_TI_TOOLS_append = " nativesdk-tidl-viewer nativesdk-tidl-utils "



^ permalink raw reply

* Re: [PATCH v2] rfkill: fix spelling mistake contidion to condition
From: David Miller @ 2018-07-23 19:06 UTC (permalink / raw)
  To: rgb; +Cc: netdev, linux-audit
In-Reply-To: <d20eb29b5ab96608af9e68ba219f15c3bdc080b4.1532369437.git.rgb@redhat.com>

From: Richard Guy Briggs <rgb@redhat.com>
Date: Mon, 23 Jul 2018 14:47:30 -0400

> This came about while trying to determine if there would be any pattern
> match on contid, a new audit container identifier internal variable.
> This was the only one.
> 
> Signed-off-by: Richard Guy Briggs <rgb@redhat.com>

As per MAINTAINERS, rfkill patches should be sent to the linux-wireless
list and the maintainer, Johannes Berg.

Thank you.

^ permalink raw reply

* Re: [PATCH 03/11] ASoC: SOF: Add driver debug support.
From: Mark Brown @ 2018-07-23 19:03 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel
In-Reply-To: <20180719185335.30912-3-liam.r.girdwood@linux.intel.com>


[-- Attachment #1.1: Type: text/plain, Size: 243 bytes --]

On Thu, Jul 19, 2018 at 07:53:27PM +0100, Liam Girdwood wrote:

> +	/* copy from DSP MMIO */
> +	pm_runtime_get(sdev->dev);
> +	memcpy_fromio(buf,  dfse->buf + pos, size);
> +	pm_runtime_put(sdev->dev);

Doesn't this need to be a _get_sync()?

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply

* Re: [Qemu-devel] [PATCH for-3.0] tests/libqtest: Improve kill_qemu() assert
From: Peter Maydell @ 2018-07-23 19:02 UTC (permalink / raw)
  To: Eric Blake
  Cc: QEMU Developers, Michael S . Tsirkin, Richard Henderson,
	Alex Bennée, Philippe Mathieu-Daudé, patches@linaro.org
In-Reply-To: <763fe1d3-e2ac-a3e6-69e7-edee07f3c578@redhat.com>

On 23 July 2018 at 19:59, Eric Blake <eblake@redhat.com> wrote:
> In other words, why are we special-casing death-by-coredump, when ALL
> non-zero exit status (whether or not a core dump was involved) is contrary
> to the assumptions of the testsuite?

Because we're trying to get as much actual information
as we have out into the logs, not merely "die so the test
fails"...

thanks
-- PMM

^ permalink raw reply

* Re: [PATCH v3 2/3] perf arm64: Generate system call table from asm/unistd.h
From: Arnaldo Carvalho de Melo @ 2018-07-23 19:01 UTC (permalink / raw)
  To: Kim Phillips
  Cc: Arnaldo Carvalho de Melo, Ravi Bangoria, Alexander Shishkin,
	Hendrik Brueckner, Jiri Olsa, Michael Ellerman, Namhyung Kim,
	Thomas Richter, Peter Zijlstra, Ingo Molnar, linux-kernel
In-Reply-To: <20180723185905.GA13220@kernel.org>

Em Mon, Jul 23, 2018 at 03:59:05PM -0300, Arnaldo Carvalho de Melo escreveu:
> A quick hack is to do this instead:

I'm going with this quick hack applied so that I can pass all tests,
feel free to provide an alternative patch that makes
tools/include/uapi/asm-generic/unistd.h be used when included by
tools/arch/arm64/include/uapi/asm/unistd.h, that I haven't tried to do
and looks the right fix.

- Arnaldo
 
> diff --git a/tools/perf/arch/arm64/Makefile b/tools/perf/arch/arm64/Makefile
> index 85fdf4949db3..f013b115dc86 100644
> --- a/tools/perf/arch/arm64/Makefile
> +++ b/tools/perf/arch/arm64/Makefile
> @@ -11,7 +11,7 @@ PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
>  
>  out    := $(OUTPUT)arch/arm64/include/generated/asm
>  header := $(out)/syscalls.c
> -sysdef := $(srctree)/tools/arch/arm64/include/uapi/asm/unistd.h
> +sysdef := $(srctree)/tools/include/uapi/asm-generic/unistd.h
>  sysprf := $(srctree)/tools/perf/arch/arm64/entry/syscalls/
>  systbl := $(sysprf)/mksyscalltbl
>  
> diff --git a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
> index c21023509960..52e197317d3e 100755
> --- a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
> +++ b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
> @@ -28,6 +28,7 @@ create_table_from_c()
>  
>  	cat <<-_EoHEADER
>  		#include <stdio.h>
> +		#define __ARCH_WANT_RENAMEAT
>  		#include "$input"
>  		int main(int argc, char *argv[])
>  		{

^ permalink raw reply

* Re: [PATCH v2 bpf 1/3] bpf: btf: Sync uapi btf.h to tools
From: Yonghong Song @ 2018-07-23 17:58 UTC (permalink / raw)
  To: Martin KaFai Lau, netdev; +Cc: Alexei Starovoitov, Daniel Borkmann, kernel-team
In-Reply-To: <20180721182043.1401089-2-kafai@fb.com>



On 7/21/18 11:20 AM, Martin KaFai Lau wrote:
> This patch sync the uapi btf.h to tools/
> 
> Fixes: 36fc3c8c282c bpf: btf: Clean up BTF_INT_BITS() in uapi btf.h
> Signed-off-by: Martin KaFai Lau <kafai@fb.com>

Acked-by: Yonghong Song <yhs@fb.com>

> ---
>   tools/include/uapi/linux/btf.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/include/uapi/linux/btf.h b/tools/include/uapi/linux/btf.h
> index 0b5ddbe135a4..972265f32871 100644
> --- a/tools/include/uapi/linux/btf.h
> +++ b/tools/include/uapi/linux/btf.h
> @@ -76,7 +76,7 @@ struct btf_type {
>    */
>   #define BTF_INT_ENCODING(VAL)	(((VAL) & 0x0f000000) >> 24)
>   #define BTF_INT_OFFSET(VAL)	(((VAL  & 0x00ff0000)) >> 16)
> -#define BTF_INT_BITS(VAL)	((VAL)  & 0x0000ffff)
> +#define BTF_INT_BITS(VAL)	((VAL)  & 0x000000ff)
>   
>   /* Attributes stored in the BTF_INT_ENCODING */
>   #define BTF_INT_SIGNED	(1 << 0)

^ permalink raw reply

* Re: [PATCH 0/3] PTI for x86-32 Fixes and Updates
From: Linus Torvalds @ 2018-07-23 19:00 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Joerg Roedel, Thomas Gleixner, Ingo Molnar, Peter Anvin,
	the arch/x86 maintainers, Linux Kernel Mailing List, linux-mm,
	Andrew Lutomirski, Dave Hansen, Josh Poimboeuf,
	Jürgen Groß, Peter Zijlstra, Borislav Petkov,
	Jiri Kosina, Boris Ostrovsky, Brian Gerst, David Laight,
	Denys Vlasenko, Eduardo Valentin, Greg Kroah-Hartman, Will Deacon,
	Liguori, Anthony, Daniel Gruss, Hugh Dickins, Kees Cook,
	Andrea Arcangeli, Waiman Long, David H . Gutteridge, Joerg Roedel,
	Arnaldo Carvalho de Melo, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim
In-Reply-To: <20180723140925.GA4285@amd>

On Mon, Jul 23, 2018 at 7:09 AM Pavel Machek <pavel@ucw.cz> wrote:
>
> Meanwhile... it looks like gcc is not slowed down significantly, but
> other stuff sees 30% .. 40% slowdowns... which is rather
> significant.

That is more or less expected.

Gcc spends about 90+% of its time in user space, and the system calls
it *does* do tend to be "real work" (open/read/etc). And modern gcc's
no longer have the pipe between cpp and cc1, so they don't have that
issue either (which would have sjhown the PTI slowdown a lot more)

Some other loads will do a lot more time traversing the user/kernel
boundary, and in 32-bit mode you won't be able to take advantage of
the address space ID's, so you really get the full effect.

> Would it be possible to have per-process control of kpti? I have
> some processes where trading of speed for security would make sense.

That was pretty extensively discussed, and no sane model for it was
ever agreed upon.  Some people wanted it per-thread, others per-mm,
and it wasn't clear how to set it either and how it should inherit
across fork/exec, and what the namespace rules etc should be.

You absolutely need to inherit it (so that you can say "I trust this
session" or whatever), but at the same time you *don't* want to
inherit if you have a server you trust that then spawns user processes
(think "I want systemd to not have the overhead, but the user
processes it spawns obviously do need protection").

It was just a morass. Nothing came out of it.  I guess people can
discuss it again, but it's not simple.

               Linus

^ permalink raw reply

* Re: rte_mbuf library likely()/unlikely()
From: Morten Brørup @ 2018-07-23 18:59 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Olivier Matz, dev
In-Reply-To: <20180723103757.47e4c26b@xeon-e3>


> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Monday, July 23, 2018 7:38 PM
> To: Morten Brørup
> Cc: Olivier Matz; dev@dpdk.org
> Subject: Re: [dpdk-dev] rte_mbuf library likely()/unlikely()
> 
> On Mon, 23 Jul 2018 15:53:42 +0200
> Morten Brørup <mb@smartsharesystems.com> wrote:
> 
> > Hi Olivier,
> >
> >
> >
> > I noticed that __rte_pktmbuf_read() could do with an unlikely(), so I
> went through the entire library. Here are my suggested modifications.
> >
> >
> >
> >
> >
> > diff -bu rte_mbuf.c.orig rte_mbuf.c
> >
> > --- rte_mbuf.c.orig     2018-07-23 15:13:22.000000000 +0200
> >
> > +++ rte_mbuf.c  2018-07-23 15:32:53.000000000 +0200
> >
> > @@ -173,19 +173,19 @@
> >
> > {
> >
> >         unsigned int nb_segs, pkt_len;
> >
> >
> >
> > -       if (m == NULL)
> >
> > +       if (unlikely(m == NULL))
> >
> >                 rte_panic("mbuf is NULL\n");
> >
> >
> 
> Adding is unlikely is not necessary since rte_panic is marked with cold
> attribute
> which has the same effect.

I was not aware of this. Although it is not visible from the source code files using rte_panic(), it probably means we shouldn't as so much as I thought. Here's an updated patch for rte_mbuf.c, where it is relevant. The other two suggested patches are unaffected.

diff -bu rte_mbuf.c.orig rte_mbuf.c
--- rte_mbuf.c.orig     2018-07-23 15:13:22.000000000 +0200
+++ rte_mbuf.c  2018-07-23 20:52:35.000000000 +0200
@@ -249,7 +249,7 @@
        const struct rte_mbuf *seg = m;
        uint32_t buf_off = 0, copy_len;

-       if (off + len > rte_pktmbuf_pkt_len(m))
+       if (unlikely(off + len > rte_pktmbuf_pkt_len(m)))
                return NULL;

        while (off >= rte_pktmbuf_data_len(seg)) {
@@ -257,7 +257,7 @@
                seg = seg->next;
        }

-       if (off + len <= rte_pktmbuf_data_len(seg))
+       if (likely(off + len <= rte_pktmbuf_data_len(seg)))
                return rte_pktmbuf_mtod_offset(seg, char *, off);

        /* rare case: header is split among several segments */
@@ -344,7 +344,7 @@
        unsigned int i;
        int ret;

-       if (buflen == 0)
+       if (unlikely(buflen == 0))
                return -1;

        buf[0] = '\0';
@@ -355,9 +355,9 @@
                if (name == NULL)
                        name = rx_flags[i].default_name;
                ret = snprintf(buf, buflen, "%s ", name);
-               if (ret < 0)
+               if (unlikely(ret < 0))
                        return -1;
-               if ((size_t)ret >= buflen)
+               if (unlikely((size_t)ret >= buflen))
                        return -1;
                buf += ret;
                buflen -= ret;
@@ -440,7 +440,7 @@
        unsigned int i;
        int ret;

-       if (buflen == 0)
+       if (unlikely(buflen == 0))
                return -1;

        buf[0] = '\0';
@@ -451,9 +451,9 @@
                if (name == NULL)
                        name = tx_flags[i].default_name;
                ret = snprintf(buf, buflen, "%s ", name);
-               if (ret < 0)
+               if (unlikely(ret < 0))
                        return -1;
-               if ((size_t)ret >= buflen)
+               if (unlikely((size_t)ret >= buflen))
                        return -1;
                buf += ret;
                buflen -= ret;


Med venlig hilsen / kind regards
- Morten Brørup

^ permalink raw reply

* [ANNOUNCEMENT] Yocto Project 2.3.4 (pyro 17.0.4) Released
From: Tracy Graydon @ 2018-07-23 18:59 UTC (permalink / raw)
  To: yocto-announce, yocto

Hello,

The latest release of the Yocto Project 2.3.4 (pyro-17.0.4) is now available for download at:

http://downloads.yoctoproject.org/releases/yocto/yocto-2.3.4/poky-pyro-17.0.4.tar.bz2
http://mirrors.kernel.org/yocto/yocto/yocto-2.3.4/poky-pyro-17.0.4.tar.bz2

A gpg signed version of these release notes is available at:

http://downloads.yoctoproject.org/releases/yocto/yocto-2.3.4/RELEASENOTES

Full pass test report is available at:

https://wiki.yoctoproject.org/wiki/WW25_-_2018-06-22-_Full_Test_Cycle_-_2.3.4_rc1

Thank you to everyone for your contributions to this release!

Tracy Graydon
Yocto Project Build and Release
tracy.graydon@intel.com


-------------------
yocto-2.3.4 Errata
---------------------

Release Name: eclipse-poky-neon-pyro-17.0.4
Branch: neon/pyro
Tag: neon/pyro-17.0.4
Hash: a5dbc01b96be55c4ec2f774af9996a8086e402ab
md5: db1ce34974dd42b1b65ccfe844bf4f8c
Download Locations:
http://downloads.yoctoproject.org/releases/yocto/yocto-2.3.4/eclipse-poky-neon-pyro-17.0.4.tar.bz2
http://mirrors.kernel.org/yocto/yocto/yocto-2.3.4/eclipse-poky-neon-pyro-17.0.4.tar.bz2

Release Name: eclipse-poky-oxygen-pyro-17.0.4
Branch: oxygen/pyro
Tag: oxygen/pyro-17.0.4
Hash: 020fc5814d2028654879356296b647002caf30b6
md5: 7753cfd309b8d9113a9106b5b5f380ff
Download Locations:
http://downloads.yoctoproject.org/releases/yocto/yocto-2.3.4/eclipse-poky-oxygen-pyro-17.0.4.tar.bz2
http://mirrors.kernel.org/yocto/yocto/yocto-2.3.4/eclipse-poky-oxygen-pyro-17.0.4.tar.bz2

Release Name: meta-qt3-pyro-17.0.4
Branch: pyro
Tag: pyro-17.0.4
Hash: f33b73a9563f2dfdfd0ee37b61d65d90197a456f
md5: 1e00f9b5cdcfecddc9387632485afb9b
Download Locations:
http://downloads.yoctoproject.org/releases/yocto/yocto-2.3.4/meta-qt3-pyro-17.0.4.tar.bz2
http://mirrors.kernel.org/yocto/yocto/yocto-2.3.4/meta-qt3-pyro-17.0.4.tar.bz2

Release Name: meta-qt4-pyro-17.0.4
Branch: pyro
Tag: pyro-17.0.4
Hash: 88989ae3abe98b30089e7518d3adabe990c40a10
md5: ae741cba79b1166b54b96757e90785cb
Download Locations:
http://downloads.yoctoproject.org/releases/yocto/yocto-2.3.4/meta-qt4-pyro-17.0.4.tar.bz2
http://mirrors.kernel.org/yocto/yocto/yocto-2.3.4/meta-qt4-pyro-17.0.4.tar.bz2

Release Name: poky-pyro-17.0.4
Branch: pyro
Tag: pyro-17.0.4
Hash: ebb42af2829edfca1a23c7a51a431c656ffc2090
md5: cc8378a3f0dc763bbc6f154e64d9d602
Download Locations:
http://downloads.yoctoproject.org/releases/yocto/yocto-2.3.4/poky-pyro-17.0.4.tar.bz2
http://mirrors.kernel.org/yocto/yocto/yocto-2.3.4/poky-pyro-17.0.4.tar.bz2


----------------
 Known Issues
----------------
N/A

----------------
Security Fixes
----------------
libvorbis: CVE-2018-5146
libvorbis: CVE-2017-14632
libvorbis: CVE-2017-14633
libtirpc: Fix CVE-2017-8779
bluez5: fix out-of-bounds access in SDP server (CVE-2017-1000250)


----------------
Fixes
----------------
poky.ent: Updated release month variable to "June 2018"
documentation: Updated release date scheme to use variable.
documentation: Updated Manual Notes
build-appliance-image: Update to pyro head revision
poky: Update version to 2.3.4
ruby: Update to 2.4.4
ruby: fix typo in gmp PACKAGECONFIG option
ruby: remove spurious db build dependency
ruby: upgrade to 2.4.2
ruby: upgrade to 2.4.1
scripts/test-dependencies.sh: remove
sstate-diff-machines.sh: Replace MACHINE_ARCH only at the beginning and separated with dash
sstate-sysroot-cruft.sh: Extend the whitelist
libpng: update SRC_URI to use osl
mpfr: Update SRC_URI to use gnu
byacc: Fic SRC_URI to use yocto sources loc.
libpng: fix MIRRORS usage
neon: update SRC_URI
libpng: use SourceForge mirror
gdb: fix header ordering for TRAP_HWBKPT
glibc: add missing TRAP_BRANCH/TRAP_HWBKPT definitions
libmpc: fix SRC_URI
distcc: Change SRC_URI
e2fsprogs: fix compatibility with glibc 2.27
qemu: fix memfd_create with glibc 2.27
package_manager.py: Explicit complementary fail
sdk: streamline locale removal
cross-localedef-native: add way to specify which locale archive to write
package-manager: add install_glob()
package_manager: improve install_complementary
sdk: generate locale archive and remove packages
populate_sdk_base: depend on nativesdk-glibc-locale
populate_sdk: install UTF-8 locales in SDKs
sdk: only install locales if we're using glibc
sdk: install specified locales into SDK
glibc: relocate locale paths in nativesdk
glibc: don't use host locales in nativesdk
default-distrovars: don't rename locales for nativesdk
bitbake.conf: Add comm to HOSTTOOLS
world-broken.inc: blacklist portmap on musl
uninative: Add compatiblity version check
yocto-uninative: Upgrade to 1.8 version with glibc 2.27
unfs3: Fix libtirpc usage for unfs3-native version
unfs3: Fix build with musl
libtirpc: Extend to native and nativesdk recipes
libtirpc: stop dropping in NIS headers
libtirpc: upgrade to 1.0.2
libtirpc: Fix build error due to missing stdint.h> include
libtirpc: Enable des APIs for musl
libtirpc: Expose key_secretkey_is_set API
libtirpc: Backport fixes from 1.0.2rc3
gcc: Remove patch causing ICE on x86_64 valgrind compile
gcc6: Backport few more patches
gcc6: enable FL_LPAE flag for armv7ve cores
gcc7/gcc6: Fix unaligned STRD issue on ARM
gcc6: Upgrade to 6.4
gcc-6.3: Backport patch to fix ICE on ARM
gcc-runtime: Disable libitm on riscv
bitbake: providers: Fix determinism issue
openssh: Atomically generate host keys
linux-yocto-rt/4.1: update to include spectre fixes
linux-yocto/4.1: updated to include spectre fixes
linux-yocto-tiny/4.1: update with spectre fixes
linux-yocto-tiny/4.1: update to 4.1.49 plus meltdown
linux-yocto-rt/4.1: update to 4.1.49 plus meltdown
linux-yocto/4.1: update to 4.1.49 plus meltdown
bitbake.conf: add tools required by testimage to HOSTTOOLS conditionally
bitbake.conf: add ssh to HOSTTOOLS_NONFATAL
oeqa/runtime/buildcpio: Use our own mirror for source
qemurunner: Simplify binary data handling
oeqa: Clean up logger handling
oeqa/targetcontrol: Drop unused get_target_controller function
testimage: Pass the logger into OERuntimeTestContextExecutor.getTarget()
oeqa/qemurunner: Use logger.debug, not logger.info
qemurunner: Ensure logging handler is removed
sshcontrol.py: in copy_to() always use scp
qemurunner: fix bad indentation in serial login
qemurunner: print tail qemu log in case bootlog is empty
qemurunner.py: wait for PID to appear in procfs
qemurunner.py: refactor searching for QEMU PID
oeqa/qemurunner: Improve logging
qemurunner: Tweak qemu pid starting timeout code
ovmf-native: fix compile issue on new OS like FC27 and Ubuntu 17
openssl: Upgrade from 1.0.2k to 1.0.2n
p11-kit: take source code from official git
package_rpm.bbclass: Fix matching of architecture independent packages
image_types_wic.bbclass: Ensure '-c image_wic' works
kernel-yocto/4.9: update to v4.9.82
distutils-base.bbclass: Do not use -pie with hardening
python3-nose: rename ${bindir}/nosetests into ${bindir}/nosetests3
grub: Fix device mapper dependency
linux-firmware: Add reference to iwlwifi-8000C firmware
python3-setuptools: extend to nativesdk
tzdata: update to 2018c
tzcode: update to 2018c
tzdata: update 2017c
tzcode-native: update to 2017c
linux-yocto/4.9: update to v4.9.78
linux-yocto/4.4: update to v4.4.113
linux-yocto/4.4: update to 4.4.99
linux-yocto/4.9: fix aufs build
linux-yocto/4.9: update to v4.9.71
linux-yocto/4.x: configuration updates
linux-yocto/4.9: update to v4.9.65
linux-yocto/4.9: update to v4.9.61
linux-yocto/4.9: update to v4.9.57
linux-yocto/4.4: update to v4.4.93
linux-yocto-tiny: Enable qemux86-64 on linux-yocto-tiny 4.10
linux-yocto-tiny: Enable qemux86-64 on linux-yocto-tiny 4.9
linux-yocto-tiny: Enable qemux86-64 on linux-yocto-tiny 4.4
pax-utils: update SRC_URI
documentation: Updated manual revision table for 2.3.4 release date
dev-manual: Fixed variable link to DEFAULTTUNE variable
documentation: Updates to support a 2.3.4 point release
ref-manual, yocto-project-qs, poky.ent: Fixed CentOS package
ref-manual: Updated Note to use bullet forms
populate_sdk_ext: Set cleandirs correctly
lib/oe/package_manager/sdk: Ensure do_populate_sdk_ext and do_populate_sdk repos don't conflict
python3-native: Add python3-misc-native to RPROVIDES
insane: consider INSANE_SKIP without package-specifier too
linux-firmware: Bump to bf04291 revision
linux-firmware: Split out the QAT firmware
linux-firmware: make i.MX SDMA split complete
linux-firmware: Split i.MX SDMA firmwares
linux-firmware: package Broadcom BCM43362 firmware
linux-firmware: bump to latest linux-firmware git revision
linux-firmware: package Marvell PCIe WiFi firmwares
linux-firmware: package ibt-firmware
linux-firmware: package iwlfifi-3160-[10-17] firmware
linux-firmware: add support for mt7601u WiFi chip
linux-firmware: package Qualcomm QCA firmware
linux-firmware: enable netronome firmware
image: Expand PV to avoid AUTOREV parsing failures
bitbake: bitbake-user-manual: Fixed porno hack for hello world example
webkitgtk: update to 2.18.5 (includes Spectre mitigations; see commit description)
libunwind: Disable documentation explicitly
ovmf: Fix build with gcc7
portmaper: checkuri fails.
linux-firmware: Remove iwlwifi-8000C-19 SRC_URI
diffstat: use HTTP mirror for SRC_URI
liburi-perl: update SRC_URI to yoctoproject mirror
v86d: take tarball from debian
staging.bbclass: handle postinst-useradd-* fixmes
runqemu: Add workaround for APIC hang on pre 4.15 kernels on qemux86
cross.bbclass: Remove usage of host flags for cross-compilation
archiver: preserve sysroot paths in configured mode
archiver: avoid archiving source for glibc-locale
archiver.bbclass: adapt do_unpack_and_patch to RSS
archiver.bbclass: fix do_ar_original error for matchbox-desktop
archiver.bbclass: do not cause kernel rebuilds
archiver.bbclass: various fixes for original+diff mode
archiver.bbclass: enhance do_ar_recipe task signature
archiver: Escape recipe name in regex
classes: drop image dependencies on TOPDIR variable
image.bbclass: drop initramfs bundle related code
local.conf.sample: Weakly set BB_DISKMON_DIRS
documenation: Prepared docs for a 2.3.3 point release



^ permalink raw reply

* Re: [Qemu-devel] [PATCH for-3.0] tests/libqtest: Improve kill_qemu() assert
From: Eric Blake @ 2018-07-23 18:59 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Michael S . Tsirkin, Richard Henderson, Alex Bennée,
	Philippe Mathieu-Daudé, patches
In-Reply-To: <20180723184752.22150-1-peter.maydell@linaro.org>

On 07/23/2018 01:47 PM, Peter Maydell wrote:
> In kill_qemu() we have an assert that checks that the QEMU process
> didn't dump core:
>              assert(!WCOREDUMP(wstatus));
> 
> Unfortunately the WCOREDUMP macro here means the resulting message
> is not very easy to comprehend on at least some systems:
> 
> ahci-test: tests/libqtest.c:113: kill_qemu: Assertion `!(((__extension__ (((union { __typeof(wstatus) __in; int __i; }) { .__in = (wstatus) }).__i))) & 0x80)' failed.
> 
> and it doesn't identify what signal the process took.
> 
> Instead of using a raw assert, print the information in an
> easier to understand way:
> 
> /i386/ahci/sanity: tests/libqtest.c:119: kill_qemu() tried to terminate QEMU process but it dumped core with signal 11 (Segmentation fault)
> Aborted (core dumped)
> 
> (Of course, the really useful information would be why the QEMU
> process dumped core in the first place, but we don't have that
> by the time the test program has picked up the exit status.)

Last time we bike-shedded this, I suggested that we fix things to call 
waitpid() in a loop, and that we just assert that exit status is 0:

https://lists.gnu.org/archive/html/qemu-devel/2018-05/msg05610.html

In other words, why are we special-casing death-by-coredump, when ALL 
non-zero exit status (whether or not a core dump was involved) is 
contrary to the assumptions of the testsuite?

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

^ permalink raw reply

* Re: [PATCH v3 2/3] perf arm64: Generate system call table from asm/unistd.h
From: Arnaldo Carvalho de Melo @ 2018-07-23 18:59 UTC (permalink / raw)
  To: Kim Phillips
  Cc: Arnaldo Carvalho de Melo, Ravi Bangoria, Alexander Shishkin,
	Hendrik Brueckner, Jiri Olsa, Michael Ellerman, Namhyung Kim,
	Thomas Richter, Peter Zijlstra, Ingo Molnar, linux-kernel
In-Reply-To: <20180720150653.GD4329@kernel.org>

Em Fri, Jul 20, 2018 at 12:06:53PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Wed, Jul 18, 2018 at 12:57:52PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Fri, Jul 06, 2018 at 04:34:43PM -0500, Kim Phillips escreveu:
> > > This should speed up accessing new system calls introduced with the
> > > kernel rather than waiting for libaudit updates to include them.
> > > 
> > > Using the existing other arch scripts resulted in this error:
> > > 
> > > tools/perf/arch/arm64/entry/syscalls//mksyscalltbl: 25: printf: __NR3264_ftruncate: expected numeric value
> > > 
> > > because, unlike other arches, asm-generic's unistd.h does things like:
> > > 
> > >  #define __NR_ftruncate __NR3264_ftruncate
> > > 
> > > Turning the scripts printf's %d into a %s resulted in this in the
> > > generated syscalls.c file:
> > > 
> > >     static const char *syscalltbl_arm64[] = {
> > >             [__NR3264_ftruncate] = "ftruncate",
> > > 
> > > So we use the host C compiler to fold the macros, and print them out
> > > from within a temporary C program, in order to get the correct output:
> > > 
> > >     static const char *syscalltbl_arm64[] = {
> > >             [46] = "ftruncate",
> > > 
> > 
> > One of my containers, ubuntu:14.04.4-x-linaro-arm64, that build perf in
> > a cross-build env, failed to build, please take a look if what is in the
> > output below is enough for you to find the problem, perhaps you forgot
> > to add the new files grabbed from the kernel sources to the
> > tools/perf/MANIFEST file that is used to create the tarball that is then
> > used to test build it? I'll check that later, in a hurry right now.
> 

So it fails with:

perfbuilder@7dbfe2fe9bef:/git/perf$ tools/perf/arch/arm64/entry/syscalls/mksyscalltbl /gcc-linaro-5.4.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc gcc tools/arch/arm64/include/uapi/asm/unistd.h
static const char *syscalltbl_arm64[] = {
<stdin>: In function 'main':
<stdin>:257:38: error: '__NR_getrandom' undeclared (first use in this function)
<stdin>:257:38: note: each undeclared identifier is reported only once for each function it appears in
<stdin>:258:41: error: '__NR_memfd_create' undeclared (first use in this function)
<stdin>:259:32: error: '__NR_bpf' undeclared (first use in this function)
<stdin>:260:37: error: '__NR_execveat' undeclared (first use in this function)
tools/perf/arch/arm64/entry/syscalls/mksyscalltbl: 47: tools/perf/arch/arm64/entry/syscalls/mksyscalltbl: /tmp/create-table-60liya: Permission denied

Because it uses as input this file
tools/arch/arm64/include/uapi/asm/unistd.h, that basically just does:

perfbuilder@1015f8b85ded:/git/perf$ cat tools/arch/arm64/include/uapi/asm/unistd.h
#define __ARCH_WANT_RENAMEAT

#include <asm-generic/unistd.h>
perfbuilder@1015f8b85ded:/git/perf$

And this ends up getting the system's asm-generic/unistd.h file, not the one
shipped in tools/, so:

perfbuilder@1015f8b85ded:/git/perf$ grep bpf /usr/include/asm-generic/unistd.h 
perfbuilder@1015f8b85ded:/git/perf$ grep _NR_ /usr/include/asm-generic/unistd.h  | tail -4
#define __NR_mmap2 __NR3264_mmap
#define __NR_fadvise64_64 __NR3264_fadvise64
#define __NR_stat64 __NR3264_stat
#define __NR_lstat64 __NR3264_lstat
perfbuilder@1015f8b85ded:/git/perf$ 

A quick hack is to do this instead:

diff --git a/tools/perf/arch/arm64/Makefile b/tools/perf/arch/arm64/Makefile
index 85fdf4949db3..f013b115dc86 100644
--- a/tools/perf/arch/arm64/Makefile
+++ b/tools/perf/arch/arm64/Makefile
@@ -11,7 +11,7 @@ PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
 
 out    := $(OUTPUT)arch/arm64/include/generated/asm
 header := $(out)/syscalls.c
-sysdef := $(srctree)/tools/arch/arm64/include/uapi/asm/unistd.h
+sysdef := $(srctree)/tools/include/uapi/asm-generic/unistd.h
 sysprf := $(srctree)/tools/perf/arch/arm64/entry/syscalls/
 systbl := $(sysprf)/mksyscalltbl
 
diff --git a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
index c21023509960..52e197317d3e 100755
--- a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
+++ b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
@@ -28,6 +28,7 @@ create_table_from_c()
 
 	cat <<-_EoHEADER
 		#include <stdio.h>
+		#define __ARCH_WANT_RENAMEAT
 		#include "$input"
 		int main(int argc, char *argv[])
 		{

^ permalink raw reply related

* Re: [PATCH 02/11] ASoC: SOF: Add Sound Open Firmware KControl support
From: Mark Brown @ 2018-07-23 18:58 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel
In-Reply-To: <20180719185335.30912-2-liam.r.girdwood@linux.intel.com>


[-- Attachment #1.1: Type: text/plain, Size: 161 bytes --]

On Thu, Jul 19, 2018 at 07:53:26PM +0100, Liam Girdwood wrote:

> +	pm_runtime_get_sync(sdev->dev);

There's no error checking on any of the runtime PM calls...

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply

* [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_rotation_crc: Move platform checks to one place for non exhaust fence cases (rev5)
From: Patchwork @ 2018-07-23 18:58 UTC (permalink / raw)
  To: Radhakrishna Sripada; +Cc: igt-dev
In-Reply-To: <20180723182545.19461-1-radhakrishna.sripada@intel.com>

== Series Details ==

Series: tests/kms_rotation_crc: Move platform checks to one place for non exhaust fence cases (rev5)
URL   : https://patchwork.freedesktop.org/series/40553/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4521 -> IGTPW_1632 =

== Summary - SUCCESS ==

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/40553/revisions/5/mbox/

== Known issues ==

  Here are the changes found in IGTPW_1632 that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@drv_module_reload@basic-reload:
      fi-glk-j4005:       PASS -> DMESG-WARN (fdo#106248, fdo#106725)

    igt@gem_pwrite@basic:
      fi-glk-j4005:       PASS -> DMESG-WARN (fdo#105719)

    igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic:
      fi-glk-j4005:       PASS -> FAIL (fdo#106765)

    igt@kms_flip@basic-flip-vs-modeset:
      fi-glk-j4005:       PASS -> DMESG-WARN (fdo#106000, fdo#106097)

    igt@kms_flip@basic-flip-vs-wf_vblank:
      fi-glk-j4005:       PASS -> FAIL (fdo#100368)

    igt@kms_frontbuffer_tracking@basic:
      fi-hsw-peppy:       PASS -> DMESG-FAIL (fdo#102614, fdo#106103)

    
    ==== Possible fixes ====

    igt@debugfs_test@read_all_entries:
      fi-snb-2520m:       INCOMPLETE (fdo#103713) -> PASS

    igt@prime_vgem@basic-fence-flip:
      fi-ilk-650:         FAIL (fdo#104008) -> PASS

    
  fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
  fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614
  fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
  fdo#104008 https://bugs.freedesktop.org/show_bug.cgi?id=104008
  fdo#105719 https://bugs.freedesktop.org/show_bug.cgi?id=105719
  fdo#106000 https://bugs.freedesktop.org/show_bug.cgi?id=106000
  fdo#106097 https://bugs.freedesktop.org/show_bug.cgi?id=106097
  fdo#106103 https://bugs.freedesktop.org/show_bug.cgi?id=106103
  fdo#106248 https://bugs.freedesktop.org/show_bug.cgi?id=106248
  fdo#106725 https://bugs.freedesktop.org/show_bug.cgi?id=106725
  fdo#106765 https://bugs.freedesktop.org/show_bug.cgi?id=106765


== Participating hosts (47 -> 43) ==

  Additional (1): fi-bsw-kefka 
  Missing    (5): fi-ctg-p8600 fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-hsw-4200u 


== Build changes ==

    * IGT: IGT_4570 -> IGTPW_1632

  CI_DRM_4521: a4ebbd84c682fd30edbde6ac0e48d150d4c5c066 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1632: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1632/
  IGT_4570: 65cdccdc7bcbb791d791aeeeecb784a382110a3c @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1632/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply

* Re: [PATCH 3/5] coccinelle: exclude sha1dc source files from static analysis
From: Eric Sunshine @ 2018-07-23 18:57 UTC (permalink / raw)
  To: SZEDER Gábor
  Cc: Junio C Hamano, Git List, René Scharfe, Derrick Stolee,
	Nguyễn Thái Ngọc Duy
In-Reply-To: <CAM0VKjkJoqRFmXdnuujSaiZ=hvz6MeAmgoUQNAkZ+82ZrKtotw@mail.gmail.com>

On Mon, Jul 23, 2018 at 2:44 PM SZEDER Gábor <szeder.dev@gmail.com> wrote:
> On Mon, Jul 23, 2018 at 8:28 PM Eric Sunshine <sunshine@sunshineco.com> wrote:
> > On Mon, Jul 23, 2018 at 9:51 AM SZEDER Gábor <szeder.dev@gmail.com> wrote:
> > > +ifdef DC_SHA1_SUBMODULE
> > > +COCCI_SOURCES = $(filter-out sha1collisiondetection/%,$(C_SOURCES))
> > > +else
> > > +COCCI_SOURCES = $(filter-out sha1dc/%,$(C_SOURCES))
> > > +endif
> >
> > Can't you just filter out both of these unconditionally without
> > worrying about DC_SHA1_SUBMODULE?
>
> I'm not sure what you mean by that.  Like this perhaps?
>
>   COCCI_SOURCES = $(filter-out sha1collisiondetection/%,$(filter-out
> sha1dc/%,$(C_SOURCES)))
>
> While it's only a single line, I don't think it's any easier on the
> eyes.

I wasn't worried about readability or one or two lines (indeed, you
could still do the filtering over two statements).

What I meant was that sha1dc/ contains files whether DC_SHA1_SUBMODULE
is defined or not. If the idea of this change is that there's no point
in having Coccinelle check those foreign, imported files (and waste
time in the process), then I was thinking that you'd want to omit
sha1dc/* regardless of whether DC_SHA1_SUBMODULE is defined.

Looking more closely at the Makefile, however, I see that C_SOURCES
holds only one or the other of sha1dc/* or
sha1collisiondetection/lib/*, so my concern is unfounded, which
explains why my question confused you.

^ permalink raw reply

* Re: [PATCH 1/1] i2c: rcar: handle RXDMA HW behaviour on Gen3
From: Wolfram Sang @ 2018-07-23 17:55 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, linux-renesas-soc, Yoshihiro Shimoda,
	Geert Uytterhoeven
In-Reply-To: <20180628204538.866-2-wsa+renesas@sang-engineering.com>

[-- Attachment #1: Type: text/plain, Size: 624 bytes --]

On Thu, Jun 28, 2018 at 10:45:38PM +0200, Wolfram Sang wrote:
> On Gen3, we can only do RXDMA once per transfer reliably. For that, we
> must reset the device, then we can have RXDMA once. This patch
> implements this. When there is no reset controller or the reset fails,
> RXDMA will be blocked completely. Otherwise, it will be disabled after
> the first RXDMA transfer. Based on a commit from the BSP by Hiromitsu
> Yamasaki, yet completely refactored to handle multiple read messages
> within one transfer.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply

* Re: [PATCH 01/11] ASoC: SOF: Add Sound Open Firmware driver core
From: Mark Brown @ 2018-07-23 18:56 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel
In-Reply-To: <20180719185335.30912-1-liam.r.girdwood@linux.intel.com>


[-- Attachment #1.1: Type: text/plain, Size: 2389 bytes --]

On Thu, Jul 19, 2018 at 07:53:25PM +0100, Liam Girdwood wrote:

> The Sound Open Firmware driver core is a generic architecture
> independent layer that allows SOF to be used on many different different
> architectures and platforms. It abstracts DSP operations and IO methods

> +++ b/include/sound/soc.h
> @@ -1133,6 +1133,7 @@ struct snd_soc_pcm_runtime {
>  	/* runtime devices */
>  	struct snd_pcm *pcm;
>  	struct snd_compr *compr;
> +	struct snd_sof_pcm *sof;
>  	struct snd_soc_dai *codec_dai;
>  	struct snd_soc_dai *cpu_dai;

Can we rename this somehow to be less specific to SoF or move it to be
somewhere other than the runtime structure?  I can see why you've done
this but I can also see every DSP vendor turning up and trying to add
their own field in here.

> +/*
> + * This file is provided under a dual BSD/GPLv2 license.  When using or
> + * redistributing this file, you may do so under either license.
> + *
> + * Copyright(c) 2017 Intel Corporation. All rights reserved.

2017?

> index 000000000000..29458909182a
> --- /dev/null
> +++ b/sound/soc/sof/core.c
> @@ -0,0 +1,373 @@
> +// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
> +/*
> + * This file is provided under a dual BSD/GPLv2 license.  When using or

Please make the entire comment a C++ one, it makes it look more
intentional.

> +static inline unsigned int sof_get_pages(size_t size)
> +{
> +	return (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
> +}

This feels like there should be a generic MM function for it?

> +/*
> + * Generic buffer page table creation.
> + */
> +
> +int snd_sof_create_page_table(struct snd_sof_dev *sdev,
> +			      struct snd_dma_buffer *dmab,
> +			      unsigned char *page_table, size_t size)
> +{
> +	int i, pages;
> +
> +	pages = snd_sgbuf_aligned_pages(size);
> +
> +	dev_dbg(sdev->dev, "generating page table for %p size 0x%zx pages %d\n",
> +		dmab->area, size, pages);
> +
> +	for (i = 0; i < pages; i++) {
> +		u32 idx = (((i << 2) + i)) >> 1;
> +		u32 pfn = snd_sgbuf_get_addr(dmab, i * PAGE_SIZE) >> PAGE_SHIFT;
> +		u32 *pg_table;
> +
> +		dev_dbg(sdev->dev, "pfn i %i idx %d pfn %x\n", i, idx, pfn);
> +
> +		pg_table = (u32 *)(page_table + idx);
> +
> +		if (i & 1)
> +			*pg_table |= (pfn << 4);
> +		else
> +			*pg_table |= pfn;
> +	}

I'm not 100% clear what this is intended to do - lots of magic numbers
and dependencies on the host memory configuration.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply


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.