Message ID | 20240311165826.1728693-3-quic_jhugo@quicinc.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | accel/qaic: Add debugfs entries | expand |
Hi Jeffrey, kernel test robot noticed the following build warnings: [auto build test WARNING on drm-misc/drm-misc-next] [also build test WARNING on next-20240312] [cannot apply to linus/master v6.8] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Jeffrey-Hugo/accel-qaic-Add-bootlog-debugfs/20240312-010045 base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next patch link: https://lore.kernel.org/r/20240311165826.1728693-3-quic_jhugo%40quicinc.com patch subject: [PATCH 2/3] accel/qaic: Add fifo size debugfs config: microblaze-allmodconfig (https://download.01.org/0day-ci/archive/20240312/202403121628.x2PPKBRx-lkp@intel.com/config) compiler: microblaze-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240312/202403121628.x2PPKBRx-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202403121628.x2PPKBRx-lkp@intel.com/ All warnings (new ones prefixed by >>): drivers/accel/qaic/qaic_debugfs.c: In function 'qaic_debugfs_init': >> drivers/accel/qaic/qaic_debugfs.c:112:55: warning: '%03u' directive output may be truncated writing between 3 and 10 bytes into a region of size 6 [-Wformat-truncation=] 112 | snprintf(name, QAIC_DBC_DIR_NAME, "dbc%03u", i); | ^~~~ drivers/accel/qaic/qaic_debugfs.c:112:51: note: directive argument in the range [0, 4294967294] 112 | snprintf(name, QAIC_DBC_DIR_NAME, "dbc%03u", i); | ^~~~~~~~~ drivers/accel/qaic/qaic_debugfs.c:112:17: note: 'snprintf' output between 7 and 14 bytes into a destination of size 9 112 | snprintf(name, QAIC_DBC_DIR_NAME, "dbc%03u", i); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ vim +112 drivers/accel/qaic/qaic_debugfs.c 99 100 void qaic_debugfs_init(struct qaic_drm_device *qddev) 101 { 102 struct qaic_device *qdev = qddev->qdev; 103 struct dentry *debugfs_root; 104 struct dentry *debugfs_dir; 105 char name[QAIC_DBC_DIR_NAME]; 106 u32 i; 107 108 debugfs_root = to_drm(qddev)->debugfs_root; 109 110 debugfs_create_file("bootlog", 0400, debugfs_root, qdev, &bootlog_fops); 111 for (i = 0; i < qdev->num_dbc; ++i) { > 112 snprintf(name, QAIC_DBC_DIR_NAME, "dbc%03u", i); 113 debugfs_dir = debugfs_create_dir(name, debugfs_root); 114 debugfs_create_file("fifo_size", 0400, debugfs_dir, &qdev->dbc[i], &fifo_size_fops); 115 } 116 } 117
Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com> On 11.03.2024 17:58, Jeffrey Hugo wrote: > Each DMA Bridge Channel (dbc) has a unique configured fifo size which is > specified by the userspace client of that dbc. Since the fifo is > circular, it is useful to know the configured size when debugging > issues. > > Add a per-dbc subdirectory in debugfs and in each subdirectory add a > fifo_size entry that will display the size of that dbc's fifo when read. > > Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com> > Reviewed-by: Carl Vanderlip <quic_carlv@quicinc.com> > Reviewed-by: Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com> > --- > drivers/accel/qaic/qaic_debugfs.c | 31 +++++++++++++++++++++++++++++++ > 1 file changed, 31 insertions(+) > > diff --git a/drivers/accel/qaic/qaic_debugfs.c b/drivers/accel/qaic/qaic_debugfs.c > index 4f87fe29be1a..9d56cd451b64 100644 > --- a/drivers/accel/qaic/qaic_debugfs.c > +++ b/drivers/accel/qaic/qaic_debugfs.c > @@ -11,6 +11,7 @@ > #include <linux/mutex.h> > #include <linux/pci.h> > #include <linux/seq_file.h> > +#include <linux/sprintf.h> > #include <linux/string.h> > #include <linux/types.h> > #include <linux/workqueue.h> > @@ -20,6 +21,7 @@ > > #define BOOTLOG_POOL_SIZE 16 > #define BOOTLOG_MSG_SIZE 512 > +#define QAIC_DBC_DIR_NAME 9 > > struct bootlog_msg { > /* Buffer for bootlog messages */ > @@ -74,14 +76,43 @@ static const struct file_operations bootlog_fops = { > .release = single_release, > }; > > +static int read_dbc_fifo_size(struct seq_file *s, void *unused) > +{ > + struct dma_bridge_chan *dbc = s->private; > + > + seq_printf(s, "%u\n", dbc->nelem); > + return 0; > +} > + > +static int fifo_size_open(struct inode *inode, struct file *file) > +{ > + return single_open(file, read_dbc_fifo_size, inode->i_private); > +} > + > +static const struct file_operations fifo_size_fops = { > + .owner = THIS_MODULE, > + .open = fifo_size_open, > + .read = seq_read, > + .llseek = seq_lseek, > + .release = single_release, > +}; > + > void qaic_debugfs_init(struct qaic_drm_device *qddev) > { > struct qaic_device *qdev = qddev->qdev; > struct dentry *debugfs_root; > + struct dentry *debugfs_dir; > + char name[QAIC_DBC_DIR_NAME]; > + u32 i; > > debugfs_root = to_drm(qddev)->debugfs_root; > > debugfs_create_file("bootlog", 0400, debugfs_root, qdev, &bootlog_fops); > + for (i = 0; i < qdev->num_dbc; ++i) { > + snprintf(name, QAIC_DBC_DIR_NAME, "dbc%03u", i); > + debugfs_dir = debugfs_create_dir(name, debugfs_root); > + debugfs_create_file("fifo_size", 0400, debugfs_dir, &qdev->dbc[i], &fifo_size_fops); > + } > } > > static struct bootlog_page *alloc_bootlog_page(struct qaic_device *qdev)
diff --git a/drivers/accel/qaic/qaic_debugfs.c b/drivers/accel/qaic/qaic_debugfs.c index 4f87fe29be1a..9d56cd451b64 100644 --- a/drivers/accel/qaic/qaic_debugfs.c +++ b/drivers/accel/qaic/qaic_debugfs.c @@ -11,6 +11,7 @@ #include <linux/mutex.h> #include <linux/pci.h> #include <linux/seq_file.h> +#include <linux/sprintf.h> #include <linux/string.h> #include <linux/types.h> #include <linux/workqueue.h> @@ -20,6 +21,7 @@ #define BOOTLOG_POOL_SIZE 16 #define BOOTLOG_MSG_SIZE 512 +#define QAIC_DBC_DIR_NAME 9 struct bootlog_msg { /* Buffer for bootlog messages */ @@ -74,14 +76,43 @@ static const struct file_operations bootlog_fops = { .release = single_release, }; +static int read_dbc_fifo_size(struct seq_file *s, void *unused) +{ + struct dma_bridge_chan *dbc = s->private; + + seq_printf(s, "%u\n", dbc->nelem); + return 0; +} + +static int fifo_size_open(struct inode *inode, struct file *file) +{ + return single_open(file, read_dbc_fifo_size, inode->i_private); +} + +static const struct file_operations fifo_size_fops = { + .owner = THIS_MODULE, + .open = fifo_size_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + void qaic_debugfs_init(struct qaic_drm_device *qddev) { struct qaic_device *qdev = qddev->qdev; struct dentry *debugfs_root; + struct dentry *debugfs_dir; + char name[QAIC_DBC_DIR_NAME]; + u32 i; debugfs_root = to_drm(qddev)->debugfs_root; debugfs_create_file("bootlog", 0400, debugfs_root, qdev, &bootlog_fops); + for (i = 0; i < qdev->num_dbc; ++i) { + snprintf(name, QAIC_DBC_DIR_NAME, "dbc%03u", i); + debugfs_dir = debugfs_create_dir(name, debugfs_root); + debugfs_create_file("fifo_size", 0400, debugfs_dir, &qdev->dbc[i], &fifo_size_fops); + } } static struct bootlog_page *alloc_bootlog_page(struct qaic_device *qdev)